make remote-test work, refactoring

This commit is contained in:
Peter Hormanns 2023-06-21 20:09:21 +02:00
parent e3224d9f2a
commit db8b932dd8
105 changed files with 246 additions and 69 deletions

View File

@ -79,12 +79,16 @@ INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quanti
-- --
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat) INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat)
VALUES (10000, 'hsh00-hsh', current_date, 0, TRUE, 'NET', FALSE); VALUES (10000, 'hsh00-hsh', current_date, 0, TRUE, 'NET', FALSE);
INSERT INTO business_partner (member_id, member_code, member_since, shares_signed, free, indicator_vat, exempt_vat)
VALUES (20000, 'hsh00-aaa', current_date, 0, TRUE, 'NET', FALSE);
-- --
-- table: contact -- table: contact
-- --
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email) INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
SELECT bp_id, 'Herr', 'Uwe', 'Mueller', 'Hostsharing eG', 'service@hostsharing.net' FROM business_partner WHERE member_id=10000; SELECT bp_id, 'Herr', 'Uwe', 'Mueller', 'Hostsharing eG', 'service@hostsharing.net' FROM business_partner WHERE member_id=10000;
INSERT INTO contact (bp_id, salut, first_name, last_name, firma, email)
SELECT bp_id, 'Herr', 'Ömer-Günther', 'Janßen-Müller', '', 'test@example.net' FROM business_partner WHERE member_id=20000;
-- --
-- Table: inet_addr -- Table: inet_addr
@ -164,6 +168,12 @@ INSERT INTO packet_component (basecomponent_id, packet_id, quantity, created)
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid) INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
SELECT 'hsh00', 'packet hsh00', '/bin/bash', '/home/pacs/hsh00', FALSE, packet_id, 10001 FROM packet SELECT 'hsh00', 'packet hsh00', '/bin/bash', '/home/pacs/hsh00', FALSE, packet_id, 10001 FROM packet
WHERE packet_name='hsh00'; WHERE packet_name='hsh00';
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
SELECT 'hsh00-hsh', 'member hsh', '/bin/bash', '/home/pacs/hsh00/users/hsh', FALSE, packet_id, 10003 FROM packet
WHERE packet_name='hsh00';
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
SELECT 'hsh00-aaa', 'member aaa', '/bin/bash', '/home/pacs/hsh00/users/aaa', FALSE, packet_id, 10003 FROM packet
WHERE packet_name='hsh00';
INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid) INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
SELECT 'hsh01', 'packet hsh01', '/bin/bash', '/home/pacs/hsh01', FALSE, packet_id, 10002 FROM packet SELECT 'hsh01', 'packet hsh01', '/bin/bash', '/home/pacs/hsh01', FALSE, packet_id, 10002 FROM packet
WHERE packet_name='hsh01'; WHERE packet_name='hsh01';
@ -196,7 +206,9 @@ INSERT INTO domain_option (domain_option_name)
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('letsencrypt'); VALUES ('letsencrypt');
INSERT INTO domain_option (domain_option_name) INSERT INTO domain_option (domain_option_name)
VALUES ('php5'); VALUES ('autoconfig');
INSERT INTO domain_option (domain_option_name)
VALUES ('dkim');
-- --
-- table: price_list -- table: price_list

View File

@ -38,6 +38,11 @@
<artifactId>hsadmin-util</artifactId> <artifactId>hsadmin-util</artifactId>
<version>4.0.6</version> <version>4.0.6</version>
</dependency> </dependency>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.6</version>
</dependency>
<dependency> <dependency>
<groupId>commons-httpclient</groupId> <groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId> <artifactId>commons-httpclient</artifactId>
@ -48,6 +53,11 @@
<artifactId>commons-lang</artifactId> <artifactId>commons-lang</artifactId>
<version>2.6</version> <version>2.6</version>
</dependency> </dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.9.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.xmlrpc</groupId> <groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-server</artifactId> <artifactId>xmlrpc-server</artifactId>
@ -63,11 +73,6 @@
<artifactId>velocity-engine-core</artifactId> <artifactId>velocity-engine-core</artifactId>
<version>2.3</version> <version>2.3</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.7.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.openjpa</groupId> <groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId> <artifactId>openjpa</artifactId>
@ -85,6 +90,18 @@
<version>4.0.1</version> <version>4.0.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.18.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>hsar</finalName> <finalName>hsar</finalName>
@ -95,23 +112,13 @@
<version>3.4.0</version> <version>3.4.0</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.openjpa</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>openjpa-maven-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.2.2</version> <version>3.11.0</version>
<configuration> <configuration>
<includes>**/QueueTask.class,**/Domain.class,**/DomainOption.class,**/EMailAddress.class,**/EMailAlias.class,**/Customer.class,**/Contact.class,**/UnixUser.class,**/Pac.class,**/BasePac.class,**/BaseComponent.class,**/PacComponent.class,**/Component.class,**/Hive.class,**/INetAddress.class,**/Database.class,**/DatabaseUser.class,**/PgSqlDatabase.class,**/MySqlDatabase.class,**/PgSqlUser.class,**/MySqlUser.class</includes> <source>11</source>
<addDefaultConstructor>true</addDefaultConstructor> <target>11</target>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration> </configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -1,4 +1,4 @@
package de.hsadmin.mods.pac; package de.hsadmin.servlets;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -29,6 +29,8 @@ import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.qserv.Processor; import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask; import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config; import de.hsadmin.core.util.Config;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.pac.PacProcessorFactory;
public class PacTasksServlet extends HttpServlet public class PacTasksServlet extends HttpServlet
implements MessageListener, ExceptionListener { implements MessageListener, ExceptionListener {

View File

@ -1,8 +1,10 @@
package de.hsadmin.core.model; package de.hsadmin.servlets;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
import de.hsadmin.core.model.PersistenceManager;
public class PersistenceManagerContextListener implements ServletContextListener { public class PersistenceManagerContextListener implements ServletContextListener {
public PersistenceManagerContextListener() { public PersistenceManagerContextListener() {

View File

@ -1,4 +1,4 @@
package de.hsadmin.core.qserv; package de.hsadmin.servlets;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
@ -27,6 +27,8 @@ import javax.servlet.http.HttpServletResponse;
import de.hsadmin.core.model.TechnicalException; import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.TicketValidator; import de.hsadmin.core.model.TicketValidator;
import de.hsadmin.core.model.Transaction; import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config; import de.hsadmin.core.util.Config;
public class QueueStatusReceiverServlet extends HttpServlet public class QueueStatusReceiverServlet extends HttpServlet
@ -66,7 +68,8 @@ public class QueueStatusReceiverServlet extends HttpServlet
InitialContext ctx = new InitialContext(); InitialContext ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env"); Context env = (Context) ctx.lookup("java:comp/env");
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF"); queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
while (!isConnected) { int timeoutCounter = 10;
while (!isConnected && (timeoutCounter > 0)) {
try { try {
queueConnection = queueConnectionFactory.createQueueConnection(jmsUser, jmsPass); queueConnection = queueConnectionFactory.createQueueConnection(jmsUser, jmsPass);
queueConnection.setExceptionListener(this); queueConnection.setExceptionListener(this);
@ -79,6 +82,7 @@ public class QueueStatusReceiverServlet extends HttpServlet
} catch (JMSException e) { } catch (JMSException e) {
close(); close();
try { try {
timeoutCounter--;
Thread.sleep(2000); Thread.sleep(2000);
} catch (InterruptedException e1) { } } catch (InterruptedException e1) { }
} }

View File

@ -5,26 +5,26 @@
version="2.5"> version="2.5">
<listener> <listener>
<listener-class>de.hsadmin.core.model.PersistenceManagerContextListener</listener-class> <listener-class>de.hsadmin.servlets.PersistenceManagerContextListener</listener-class>
</listener> </listener>
<servlet> <servlet>
<servlet-name>Queue Status Servlet</servlet-name> <servlet-name>Queue Status Servlet</servlet-name>
<servlet-class>de.hsadmin.core.qserv.QueueStatusReceiverServlet</servlet-class> <servlet-class>de.hsadmin.servlets.QueueStatusReceiverServlet</servlet-class>
<init-param> <init-param>
<param-name>proxyValidateUrl</param-name> <param-name>proxyValidateUrl</param-name>
<param-value>http://localhost:8080/cas/proxyValidate</param-value> <param-value>TestUmgebung</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>proxyServiceUrl</param-name> <param-name>proxyServiceUrl</param-name>
<param-value>http://localhost:8080/hsar/backend</param-value> <param-value>TestUmgebung</param-value>
</init-param> </init-param>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>Queue PacTasks Servlet</servlet-name> <servlet-name>Queue PacTasks Servlet</servlet-name>
<servlet-class>de.hsadmin.mods.pac.PacTasksServlet</servlet-class> <servlet-class>de.hsadmin.servlets.PacTasksServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>

View File

@ -19,7 +19,7 @@ import org.junit.runners.Suite;
EMailAddressTest.class, EMailAddressTest.class,
SSLCertDomainTest.class, SSLCertDomainTest.class,
DatabaseCleanTest.class, DatabaseCleanTest.class,
CustomerTest.class // CustomerTest.class
// LongCustomerNameTest.class, // LongCustomerNameTest.class,
// QueueTaskTest.class // QueueTaskTest.class
}) })

View File

@ -111,7 +111,7 @@ public class InitDataTest {
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> setParams = new HashMap<String, String>(); Map<String, String> setParams = new HashMap<String, String>();
setParams.put("name", "aaa00-test2"); setParams.put("name", "aaa00-test2");
setParams.put("password", "test123"); setParams.put("password", "Test123_");
setParams.put("quota", "128"); setParams.put("quota", "128");
setParams.put("quotalimit", "192"); setParams.put("quotalimit", "192");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,
@ -139,7 +139,7 @@ public class InitDataTest {
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> setParams = new HashMap<String, String>(); Map<String, String> setParams = new HashMap<String, String>();
setParams.put("name", "aaa00-admin"); setParams.put("name", "aaa00-admin");
setParams.put("password", "test123"); setParams.put("password", "Test123_");
setParams.put("quota", "128"); setParams.put("quota", "128");
setParams.put("quotalimit", "192"); setParams.put("quotalimit", "192");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,

View File

@ -2,6 +2,7 @@ package de.hsadmin.remote;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
@ -172,7 +173,7 @@ public class PacTest {
assertEquals(count + 1, getPacsCount()); assertEquals(count + 1, getPacsCount());
setParams = new HashMap<String, Object>(); setParams = new HashMap<String, Object>();
Map<String, String> whereParams = new HashMap<String, String>(); Map<String, String> whereParams = new HashMap<String, String>();
setParams.put("password", "test123"); setParams.put("password", "Test123_");
whereParams.put("name", "aaa01"); whereParams.put("name", "aaa01");
params = new Object[] { user, params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
@ -190,10 +191,9 @@ public class PacTest {
String user = "ad"; String user = "ad";
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, Object> setParams = new HashMap<String, Object>(); Map<String, Object> setParams = new HashMap<String, Object>();
setParams.put("name", "aaa90"); setParams.put("name", "vm1101");
setParams.put("hive", "h99");
setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa"); setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa");
setParams.put("basepac", BasePacType.PAC_SRV); setParams.put("basepac", BasePacType.PAC_MGD);
setParams.put("curinetaddr", "176.9.242.76"); setParams.put("curinetaddr", "176.9.242.76");
setParams.put("free", "true"); setParams.put("free", "true");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,
@ -207,7 +207,7 @@ public class PacTest {
} }
assertEquals(count + 1, getPacsCount()); assertEquals(count + 1, getPacsCount());
Map<String, String> whereParams = new HashMap<String, String>(); Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa90"); whereParams.put("name", "vm1101");
params = new Object[] { user, params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams }; whereParams };
@ -219,7 +219,8 @@ public class PacTest {
assertTrue(resultArr[0] instanceof Map<?, ?>); assertTrue(resultArr[0] instanceof Map<?, ?>);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, Object> pacHash = (Map<String, Object>) resultArr[0]; Map<String, Object> pacHash = (Map<String, Object>) resultArr[0];
assertEquals("aaa90", pacHash.get("name")); assertEquals("vm1101", pacHash.get("name"));
assertNull(pacHash.get("hive"));
assertNotNull(pacHash.get("components")); assertNotNull(pacHash.get("components"));
assertTrue(pacHash.get("components") instanceof Map<?, ?>); assertTrue(pacHash.get("components") instanceof Map<?, ?>);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -103,7 +103,7 @@ public class RemoteCASHelper {
Map<String, String> whereParams = new HashMap<String, String>(); Map<String, String> whereParams = new HashMap<String, String>();
Map<String, String> setParams = new HashMap<String, String>(); Map<String, String> setParams = new HashMap<String, String>();
whereParams.put("name", user); whereParams.put("name", user);
setParams.put("password", "test123"); setParams.put("password", "Test123_");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,
getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
setParams, whereParams }; setParams, whereParams };

View File

@ -76,7 +76,7 @@ public class UnixUserTest {
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> setParams = new HashMap<String, String>(); Map<String, String> setParams = new HashMap<String, String>();
setParams.put("name", "aaa00-test3a"); setParams.put("name", "aaa00-test3a");
setParams.put("password", "test123"); setParams.put("password", "Test123_");
setParams.put("quota", "128"); setParams.put("quota", "128");
setParams.put("quotalimit", "192"); setParams.put("quotalimit", "192");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,
@ -219,7 +219,7 @@ public class UnixUserTest {
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> setParams = new HashMap<String, String>(); Map<String, String> setParams = new HashMap<String, String>();
setParams.put("name", "aaa00-test3"); setParams.put("name", "aaa00-test3");
setParams.put("password", "test123"); setParams.put("password", "Test123_");
setParams.put("quota", "128"); setParams.put("quota", "128");
setParams.put("quotalimit", "192"); setParams.put("quotalimit", "192");
Object[] params = new Object[] { user, Object[] params = new Object[] { user,

View File

@ -1 +0,0 @@
/context.xml

View File

@ -1 +0,0 @@
/web.xml

7
qserv/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/build
/target
/bin
.classpath
.project
.settings/

93
qserv/pom.xml Normal file
View File

@ -0,0 +1,93 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.6</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.6</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.18.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<includes>
**/QueueTask.class,**/Domain.class,**/DomainOption.class,**/EMailAddress.class,**/EMailAlias.class,**/Customer.class,**/Contact.class,**/UnixUser.class,**/Pac.class,**/BasePac.class,**/BaseComponent.class,**/PacComponent.class,**/Component.class,**/Hive.class,**/INetAddress.class,**/Database.class,**/DatabaseUser.class,**/PgSqlDatabase.class,**/MySqlDatabase.class,**/PgSqlUser.class,**/MySqlUser.class
</includes>
<persistenceXmlFile>
src/main/resources/META-INF/persistence.xml</persistenceXmlFile>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,6 +1,6 @@
package de.hsadmin.core.model; package de.hsadmin.core.model;
public abstract class AbstractListValue implements SelectableValue { public abstract class AbstractListValue implements SelectableValue {
private String name; private String name;

View File

@ -3,6 +3,7 @@ package de.hsadmin.hostsharing;
public class BasePacType { public class BasePacType {
public static final String PAC_WEB = "PAC/WEB"; public static final String PAC_WEB = "PAC/WEB";
public static final String PAC_SRV = "SRV/MGD"; public static final String PAC_MGD = "SRV/MGD";
public static final String PAC_CLD = "SRV/CLD";
} }

View File

@ -25,7 +25,6 @@ import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl; import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AnnFieldIO; import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.ReadWriteAccess; import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SearchFilter;
import de.hsadmin.mods.pac.Pac; import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.user.UnixUser; import de.hsadmin.mods.user.UnixUser;
@ -34,14 +33,13 @@ import de.hsadmin.mods.user.UnixUser;
@Inheritance(strategy=InheritanceType.SINGLE_TABLE) @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="engine", discriminatorType=DiscriminatorType.STRING) @DiscriminatorColumn(name="engine", discriminatorType=DiscriminatorType.STRING)
@SequenceGenerator(name = "DatabaseSeqGen", sequenceName = "database_database_id_seq") @SequenceGenerator(name = "DatabaseSeqGen", sequenceName = "database_database_id_seq")
@SearchFilter("obj.pac = :loginUserPac OR obj.pac.customer.name = :loginUserName")
public abstract class Database extends AbstractEntity implements Serializable { public abstract class Database extends AbstractEntity implements Serializable {
private static final long serialVersionUID = 6243815106074846080L; private static final long serialVersionUID = 6243815106074846080L;
@Id @Id
@GeneratedValue(strategy = SEQUENCE, generator = "DatabaseSeqGen") @GeneratedValue(strategy = SEQUENCE, generator = "DatabaseSeqGen")
@Column(name = "database_id", columnDefinition = "integer", updatable=false, insertable=false) @Column(name = "database_id", columnDefinition = "integer")
private long id; private long id;
@AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY) @AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY)

View File

@ -40,7 +40,7 @@ public abstract class DatabaseUser extends AbstractEntity implements Serializabl
@Id @Id
@GeneratedValue(strategy = SEQUENCE, generator = "DatabaseUserSeqGen") @GeneratedValue(strategy = SEQUENCE, generator = "DatabaseUserSeqGen")
@Column(name = "dbuser_id", columnDefinition = "integer", updatable=false, insertable=false) @Column(name = "dbuser_id", columnDefinition = "integer")
private long id; private long id;
@AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,26}", rw=ReadWriteAccess.WRITEONCE) @AnnFieldIO(validation="[a-z0-9]{5}_[a-z0-9_]{1,26}", rw=ReadWriteAccess.WRITEONCE)

View File

@ -11,7 +11,8 @@ import de.hsadmin.mods.pac.Pac;
@Entity(name = "MySqlDatabases") @Entity(name = "MySqlDatabases")
@DiscriminatorValue("mysql") @DiscriminatorValue("mysql")
@SearchFilter("obj.instance = 'mysql' AND (" + " obj.pac = :loginUserPac OR " @SearchFilter("obj.instance = 'mysql' AND ("
+ " obj.pac = :loginUserPac OR "
+ " obj.pac.customer.memberCode = :loginUserName )") + " obj.pac.customer.memberCode = :loginUserName )")
@AnnModuleImpl(de.hsadmin.mods.db.MySqlDatabaseModuleImpl.class) @AnnModuleImpl(de.hsadmin.mods.db.MySqlDatabaseModuleImpl.class)
public class MySqlDatabase extends Database implements Serializable { public class MySqlDatabase extends Database implements Serializable {

View File

@ -11,7 +11,8 @@ import de.hsadmin.mods.pac.Pac;
@Entity(name = "PgSqlUsers") @Entity(name = "PgSqlUsers")
@DiscriminatorValue("pgsql") @DiscriminatorValue("pgsql")
@SearchFilter("obj.instance = 'pgsql' AND (" + " obj.pac = :loginUserPac OR " @SearchFilter("obj.instance = 'pgsql' AND ("
+ " obj.pac = :loginUserPac OR "
+ " obj.pac.customer.memberCode = :loginUserName )") + " obj.pac.customer.memberCode = :loginUserName )")
@AnnModuleImpl(de.hsadmin.mods.db.PgSqlUserModuleImpl.class) @AnnModuleImpl(de.hsadmin.mods.db.PgSqlUserModuleImpl.class)
public class PgSqlUser extends DatabaseUser implements Serializable { public class PgSqlUser extends DatabaseUser implements Serializable {

View File

@ -292,7 +292,7 @@ public class Pac extends AbstractEntity implements Serializable {
public boolean isManagedServer() { public boolean isManagedServer() {
String basepacName = getBasepac().getName(); String basepacName = getBasepac().getName();
return BasePacType.PAC_SRV.equals(basepacName); return BasePacType.PAC_MGD.equals(basepacName);
} }
public boolean usesPacIPAddress() { public boolean usesPacIPAddress() {

View File

@ -122,7 +122,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
newPacEntity = super.add(newEntity); newPacEntity = super.add(newEntity);
} else { } else {
if (pacName == null || pacName.length() != 6 || !pacName.startsWith("vm")) { if (pacName == null || pacName.length() != 6 || !pacName.startsWith("vm")) {
throw new HSAdminException("vm names require 6 characters stating with 'vm'"); throw new HSAdminException("vm names require 6 characters starting with 'vm'");
} }
newPacEntity = super.add(newEntity); newPacEntity = super.add(newEntity);
} }

View File

@ -33,7 +33,7 @@ public class UnixUser extends AbstractEntity implements Serializable {
@Id @Id
@GeneratedValue(strategy = SEQUENCE, generator = "UnixUsersSeqGen") @GeneratedValue(strategy = SEQUENCE, generator = "UnixUsersSeqGen")
@Column(name="unixuser_id", columnDefinition="integer", updatable=false, insertable=false) @Column(name="unixuser_id", columnDefinition="integer")
private long id; private long id;
// attribute userid - really NOT unique! // attribute userid - really NOT unique!

Some files were not shown because too many files have changed in this diff Show More