work on tests

This commit is contained in:
Peter Hormanns 2011-05-06 16:28:11 +00:00
parent 36c884c899
commit fde981d8ab
8 changed files with 90 additions and 74 deletions

View File

@ -36,7 +36,7 @@ public class DomainTest {
@Test
public void testSearchAllAsPacAdmin() {
String user = "peh00";
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
Object[] params = new Object[] { user,
@ -49,7 +49,7 @@ public class DomainTest {
for (Object o : result) {
if (o instanceof Map<?, ?>) {
Map<?, ?> row = (Map<?, ?>) o;
assertEquals("peh00", row.get("user"));
assertEquals("aaa00", row.get("user"));
} else {
fail("map expected");
}

View File

@ -35,7 +35,7 @@ public class EMailAddressTest {
@Test
public void testSearchAllAsPacAdmin() {
String user = "peh00";
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
Object[] params = new Object[] { user,
@ -48,7 +48,7 @@ public class EMailAddressTest {
for (Object o : result) {
if (o instanceof Map<?, ?>) {
Map<?, ?> row = (Map<?, ?>) o;
assertEquals("peh00", row.get("pac"));
assertEquals("aaa00", row.get("pac"));
} else {
fail("map expected");
}
@ -60,7 +60,7 @@ public class EMailAddressTest {
@Test
public void testSearchAsPacAdmin() {
String user = "peh00";
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("domain", "herzensklaenge.de");
@ -74,7 +74,7 @@ public class EMailAddressTest {
for (Object o : result) {
if (o instanceof Map<?, ?>) {
Map<?, ?> row = (Map<?, ?>) o;
assertEquals("peh00", row.get("pac"));
assertEquals("aaa00", row.get("pac"));
} else {
fail("map expected");
}
@ -87,11 +87,11 @@ public class EMailAddressTest {
@Test
public void testUpdate() {
int count = getTargetCount();
String user = "peh00";
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("target", "peh00-phor");
setParams.put("target", "aaa00-test2");
whereParams.put("domain", "jalin.de");
whereParams.put("localpart", "fax");
Object[] params = new Object[] { user,
@ -107,7 +107,7 @@ public class EMailAddressTest {
assertEquals(count + 1, getTargetCount());
setParams = new HashMap<String, String>();
whereParams = new HashMap<String, String>();
setParams.put("target", "peh00-hotline");
setParams.put("target", "aaa00-test2");
whereParams.put("domain", "jalin.de");
whereParams.put("localpart", "fax");
params = new Object[] { user,

View File

@ -33,7 +33,7 @@ public class EMailAliasTest {
@Test
public void testSearchAllAsPacAdmin() {
String user = "peh00";
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
Object[] params = new Object[] { user,
@ -46,7 +46,7 @@ public class EMailAliasTest {
for (Object o : result) {
if (o instanceof Map<?, ?>) {
Map<?, ?> row = (Map<?, ?>) o;
assertEquals("peh00", row.get("pac"));
assertEquals("aaa00", row.get("pac"));
} else {
fail("map expected");
}

View File

@ -48,10 +48,33 @@ public class MysqlDbTest {
try {
Object execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
params[1] = cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL());
setParams.put("name", "aaa00_db2");
execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count + 1, getDBsCount());
assertEquals(count + 2, getDBsCount());
}
@Test
public void testDelete() {
int count = getDBsCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa00_db2");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".delete", params);
assertNull(execute);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count - 1, getDBsCount());
}
@Test
@ -71,25 +94,6 @@ public class MysqlDbTest {
}
}
@Test
public void testDelete() {
int count = getDBsCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa00_db1");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".delete", params);
assertNull(execute);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count - 1, getDBsCount());
}
private int getDBsCount() {
int count = 0;
String user = "aaa00";

View File

@ -48,10 +48,14 @@ public class MysqlUserTest {
try {
Object execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
setParams.put("name", "aaa00_dba2");
params[1] = cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL());
execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count + 1, getDBUsersCount());
assertEquals(count + 2, getDBUsersCount());
}
@Test
@ -71,13 +75,13 @@ public class MysqlUserTest {
}
}
@Test @Ignore
@Test
public void testDelete() {
int count = getDBUsersCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa00_dba");
whereParams.put("name", "aaa00_dba2");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };

View File

@ -48,27 +48,14 @@ public class PgsqlDbTest {
try {
Object execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
setParams.put("name", "aaa00_db2");
params[1] = cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL());
execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count + 1, getDBsCount());
}
@Test
public void testSearch() {
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 };
try {
Object execute = client.execute(MODULE + ".search", params);
Object[] result = (Object[]) execute;
assertEquals(1, result.length);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count + 2, getDBsCount());
}
@Test
@ -90,6 +77,23 @@ public class PgsqlDbTest {
assertEquals(count - 1, getDBsCount());
}
@Test
public void testSearch() {
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 };
try {
Object execute = client.execute(MODULE + ".search", params);
Object[] result = (Object[]) execute;
assertEquals(1, result.length);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
}
private int getDBsCount() {
int count = 0;
String user = "aaa00";

View File

@ -48,10 +48,33 @@ public class PgsqlUserTest {
try {
Object execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
setParams.put("name", "aaa00_dba2");
params[1] = cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL());
execute = client.execute(MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count + 1, getDBsCount());
assertEquals(count + 2, getDBsCount());
}
@Test
public void testDelete() {
int count = getDBsCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa00_dba2");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".delete", params);
assertNull(execute);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count - 1, getDBsCount());
}
@Test
@ -71,25 +94,6 @@ public class PgsqlUserTest {
}
}
@Test @Ignore
public void testDelete() {
int count = getDBsCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "aaa00_dba");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".delete", params);
assertNull(execute);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
assertEquals(count - 1, getDBsCount());
}
private int getDBsCount() {
int count = 0;
String user = "aaa00";

View File

@ -12,10 +12,10 @@ import org.junit.runners.Suite;
MysqlDbTest.class,
PgsqlUserTest.class,
PgsqlDbTest.class,
CustomerTest.class
// EMailAliasTest.class,
// EMailAddressTest.class,
// DomainTest.class,
// EMailAddressTest.class,
CustomerTest.class
// HostmasterTest.class,
// QueueTaskTest.class
})