diff --git a/hsarback/test/de/hsadmin/remote/InitDataTest.java b/hsarback/test/de/hsadmin/remote/InitDataTest.java index 3788288..c7c3cce 100644 --- a/hsarback/test/de/hsadmin/remote/InitDataTest.java +++ b/hsarback/test/de/hsadmin/remote/InitDataTest.java @@ -18,6 +18,7 @@ public class InitDataTest { private static final String CUST_MODULE = "member"; private static final String PAC_MODULE = "pac"; private static final String USER_MODULE = "user"; + private static final String DOM_MODULE = "domain"; private XmlRpcClient client; private RemoteCASHelper cas; @@ -122,6 +123,50 @@ public class InitDataTest { assertEquals(count + 1, getUsersCount()); } + @Test + public void testAddDomain() { + int count = getUsersCount(); + try { + String user = "aaa00"; + String grantingTicketURL = cas.getGrantingTicketURL(user); + Map setParams = new HashMap(); + setParams.put("name", "aaa00-admin"); + setParams.put("password", "test123"); + setParams.put("quota", "128"); + setParams.put("quotalimit", "192"); + Object[] params = new Object[] { user, + cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), + setParams }; + Object execute = client.execute(USER_MODULE + ".add", params); + if (execute instanceof Map) { + Map entry = (Map) execute; + assertEquals("aaa00-test2", entry.get("name")); + assertEquals("aaa00", entry.get("pac")); + assertEquals(null, entry.get("password")); + } else { + fail("map expected"); + } + grantingTicketURL = cas.getGrantingTicketURL(user); + setParams = new HashMap(); + setParams.put("user", "aaa00-admin"); + setParams.put("name", "example01.org"); + params = new Object[] { user, + cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), + setParams }; + execute = client.execute(DOM_MODULE + ".add", params); + if (execute instanceof Map) { + Map entry = (Map) execute; + assertEquals("example01.org", entry.get("name")); + assertEquals("aaa00", entry.get("pac")); + } else { + fail("map expected"); + } + } catch (XmlRpcException e) { + fail(e.getMessage()); + } + assertEquals(count + 1, getUsersCount()); + } + // @Test public void testDelPac() { int count = getPacsCount(); diff --git a/hsarback/test/de/hsadmin/remote/RoleTest.java b/hsarback/test/de/hsadmin/remote/RoleTest.java index 7f114f7..0236509 100644 --- a/hsarback/test/de/hsadmin/remote/RoleTest.java +++ b/hsarback/test/de/hsadmin/remote/RoleTest.java @@ -45,7 +45,7 @@ public class RoleTest { Object[] result = (Object[]) execute; assertTrue(result.length == 1); String role = (String) ((Map) result[0]).get("role"); - assertEquals("PAC_ADMIN", role); + assertEquals("PAC_ADMIN_DW", role); } catch (XmlRpcException e) { fail(e.getMessage()); }