HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2011-05-05 c2da1b8f8e1329921cc4d2398730e473ef127ad6
Test Hostmaster ad
2 files modified
56 ■■■■■ changed files
hsarback/test/de/hsadmin/remote/CustomerTest.java 6 ●●●● patch | view | raw | blame | history
hsarback/test/de/hsadmin/remote/InitDataTest.java 50 ●●●●● patch | view | raw | blame | history
hsarback/test/de/hsadmin/remote/CustomerTest.java
@@ -95,7 +95,7 @@
    @Test
    public void testSearchAsPacAdmin() {
        String user = "peh00";
        String user = "aaa00";
        String grantingTicketURL = cas.getGrantingTicketURL(user);
        Map<String, String> whereParams = new HashMap<String, String>();
        Object[] params = new Object[] { user, 
@@ -112,7 +112,7 @@
    @Test
    public void testSearchAsPacUser() {
        String user = "peh00-phor";
        String user = "aaa00-test2";
        String grantingTicketURL = cas.getGrantingTicketURL(user);
        Map<String, String> whereParams = new HashMap<String, String>();
        Object[] params = new Object[] { user, 
@@ -129,7 +129,7 @@
    @Test
    public void testSearchAsMember() {
        String user = "hsh00-peh";
        String user = "hsh00-aaa";
        String grantingTicketURL = cas.getGrantingTicketURL(user);
        Map<String, String> whereParams = new HashMap<String, String>();
        Object[] params = new Object[] { user, 
hsarback/test/de/hsadmin/remote/InitDataTest.java
@@ -17,6 +17,7 @@
    private static final String CUST_MODULE = "member";
    private static final String PAC_MODULE = "pac";
    private static final String USER_MODULE = "user";
    
    private XmlRpcClient client;
    private RemoteCASHelper cas;
@@ -93,6 +94,35 @@
    }
    @Test
    public void testAddUser() {
        int count = getUsersCount();
        try {
            String user = "aaa00";
            String grantingTicketURL = cas.getGrantingTicketURL(user);
            Map<String, String> setParams = new HashMap<String, String>();
            setParams.put("name", "aaa00-test2");
            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");
            }
        } catch (XmlRpcException e) {
            fail(e.getMessage());
        }
        assertEquals(count + 1, getUsersCount());
    }
//    @Test
    public void testDelPac() {
        int count = getPacsCount();
        String user = "ad";
@@ -110,7 +140,7 @@
        assertEquals(count - 1, getPacsCount());
    }
    @Test
//    @Test
    public void testDelMember() {
        int count = getMembersCount();
        String user = "ad";
@@ -166,4 +196,22 @@
        return count;
    }
    private int getUsersCount() {
        int count = -1;
        try {
            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()),
                    whereParams };
            Object execute = client.execute(USER_MODULE + ".search", params);
            Object[] result = (Object[]) execute;
            count = result.length;
        } catch (XmlRpcException e) {
            fail(e.getMessage());
        }
        return count;
    }
}