Compare commits
No commits in common. "0941515461af53e892882651b3698888e2f658b4" and "e57a3d7c840af4c1a82f6385a06926c93685137d" have entirely different histories.
0941515461
...
e57a3d7c84
39
Makefile
39
Makefile
@ -1,39 +0,0 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
info:
|
||||
@echo "Achtung: nur auf Entwicklungs- und Testservern einsetzen!"
|
||||
@echo "make build: build the jar files"
|
||||
@echo "make psql: start psql shell on the database"
|
||||
@echo "make resetdata: reset the data in the database"
|
||||
@echo "make run: run catalina and watch the output"
|
||||
@echo "make test: run all continuous integration tests"
|
||||
@echo "make testdomain: run one specific test for domains"
|
||||
|
||||
build:
|
||||
source ~/.profile
|
||||
cd ~/hsadmin/util && mvn clean install
|
||||
cd ~/hsadmin/qserv && mvn clean install
|
||||
cd ~/hsadmin/hsarback && mvn package -DskipTests
|
||||
cp ~/hsadmin/qserv/target/hsadmin-*.jar ~/tomcatmq/webapps/hsar/WEB-INF/lib/
|
||||
cp ~/hsadmin/util/target/hsadmin-*.jar ~/tomcatmq/webapps/hsar/WEB-INF/lib/
|
||||
|
||||
|
||||
resetdata:
|
||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/dropschema.sql
|
||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/schema.sql
|
||||
psql -U tim03_hsatest < ~/hsadmin/hsarback/database/data.sql
|
||||
|
||||
test: resetdata
|
||||
source ~/.profile
|
||||
cd ~/hsadmin/hsarback && mvn test -Dtest=ContinuousIntegrationTest
|
||||
|
||||
testdomain: resetdata
|
||||
source ~/.profile
|
||||
cd ~/hsadmin/hsarback && mvn test -Dtest=InitDataTest && mvn test -Dtest=DomainTest
|
||||
|
||||
run:
|
||||
source ~/.profile
|
||||
cd ~/tomcatmq && ./bin/catalina.sh run
|
||||
|
||||
psql:
|
||||
WHOAMI=`whoami` && psql -U $${WHOAMI//\-/_}
|
@ -19,7 +19,7 @@ import org.junit.Test;
|
||||
public class DomainTest {
|
||||
|
||||
private static final String MODULE = "domain";
|
||||
|
||||
|
||||
private XmlRpcClient client;
|
||||
private RemoteCASHelper cas;
|
||||
|
||||
@ -40,8 +40,8 @@ public class DomainTest {
|
||||
String user = "aaa00";
|
||||
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
whereParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".search", params);
|
||||
@ -61,15 +61,15 @@ public class DomainTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateWithoutPermissionFail() {
|
||||
public void testUpdate() {
|
||||
String user = "aaa00";
|
||||
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||
Map<String, String> setParams = new HashMap<String, String>();
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
setParams.put("user", "aaa00");
|
||||
whereParams.put("name", "example01.org");
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams, whereParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".update", params);
|
||||
@ -87,8 +87,8 @@ public class DomainTest {
|
||||
Map<String, String> setParams = new HashMap<String, String>();
|
||||
setParams.put("name", "f8n.de");
|
||||
setParams.put("user", "aaa00-admin");
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".add", params);
|
||||
@ -99,100 +99,6 @@ public class DomainTest {
|
||||
assertEquals(count + 1, getDomsCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateDomain() {
|
||||
String user = "aaa00";
|
||||
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||
|
||||
// first create the domain
|
||||
Map<String, Object> setParams = new HashMap<String, Object>();
|
||||
setParams.put("name", "exampleupdate.de");
|
||||
setParams.put("user", "aaa00-admin");
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".add", params);
|
||||
assertTrue(execute instanceof Map<?, ?>);
|
||||
} catch (XmlRpcException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// check initial values
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
whereParams.put("name", "exampleupdate.de");
|
||||
params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
whereParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".search", params);
|
||||
if (execute instanceof Object[]) {
|
||||
Object[] result = (Object[]) execute;
|
||||
assertTrue("expected 1 result, but got " + result.length, 1 == result.length);
|
||||
for (Object o : result) {
|
||||
if (o instanceof Map<?, ?>) {
|
||||
Map<?, ?> row = (Map<?, ?>) o;
|
||||
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
|
||||
assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames")));
|
||||
Object[] domainoptions = (Object[]) row.get("domainoptions");
|
||||
String options = "";
|
||||
for (Object option: domainoptions) {
|
||||
options += option + " ";
|
||||
}
|
||||
String defaultDomainOptions = "htdocsfallback indexes dkim autoconfig greylisting includes letsencrypt multiviews ";
|
||||
assertTrue("Domainoptions should be " + defaultDomainOptions + " but are " + options, defaultDomainOptions.equals(options));
|
||||
}
|
||||
else {
|
||||
fail("Map<?, ?> expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fail("Object[] expected");
|
||||
}
|
||||
} catch (XmlRpcException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
|
||||
// now update the domain
|
||||
setParams = new HashMap<String, Object>();
|
||||
whereParams = new HashMap<String, String>();
|
||||
setParams.put("validsubdomainnames", "www2");
|
||||
setParams.put("domainoptions", new String[] {"greylisting", "letsencrypt"});
|
||||
whereParams.put("name", "exampleupdate.de");
|
||||
params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams, whereParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".update", params);
|
||||
if (execute instanceof Object[]) {
|
||||
Object[] result = (Object[]) execute;
|
||||
assertTrue("expected 1 result, but got " + result.length, 1 == result.length);
|
||||
for (Object o : result) {
|
||||
if (o instanceof Map<?, ?>) {
|
||||
Map<?, ?> row = (Map<?, ?>) o;
|
||||
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
|
||||
assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames")));
|
||||
Object[] domainoptions = (Object[]) row.get("domainoptions");
|
||||
String options = "";
|
||||
for (Object option: domainoptions) {
|
||||
options += option + " ";
|
||||
}
|
||||
assertTrue("Domainoptions should be greylisting letsencrypt but are " + options, "greylisting letsencrypt ".equals(options));
|
||||
}
|
||||
else {
|
||||
fail("Map<?, ?> expected");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fail("Object[] expected");
|
||||
}
|
||||
} catch (XmlRpcException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateForeignSubdomain() throws UnknownHostException, IOException {
|
||||
int count = getDomsCount();
|
||||
@ -201,8 +107,8 @@ public class DomainTest {
|
||||
Map<String, String> setParams = new HashMap<String, String>();
|
||||
setParams.put("name", "f6n.de");
|
||||
setParams.put("user", "aaa00-admin");
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".add", params);
|
||||
@ -217,8 +123,8 @@ public class DomainTest {
|
||||
setParams = new HashMap<String, String>();
|
||||
setParams.put("name", "subdomain.f6n.de");
|
||||
setParams.put("user", "aaa01");
|
||||
params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
setParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".add", params);
|
||||
@ -234,8 +140,8 @@ public class DomainTest {
|
||||
String user = "aaa00";
|
||||
String grantingTicketURL = cas.getGrantingTicketURL(user);
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
Object[] params = new Object[] { user,
|
||||
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
|
||||
whereParams };
|
||||
try {
|
||||
Object execute = client.execute(MODULE + ".search", params);
|
||||
|
Loading…
Reference in New Issue
Block a user