Die drei Tests für DomainOptionen haben weniger Fehler und prüfen die Anzahl der gesetzten Optionen.

This commit is contained in:
Purodha Blissenbach 2012-07-18 12:11:08 +00:00
parent 6a6f4bff94
commit 9453174b83

View File

@ -17,6 +17,8 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import de.hsadmin.mods.dom.Domain;
public class DomainTest {
private static final String MODULE = "domain";
@ -140,6 +142,7 @@ public class DomainTest {
assertNotNull(execute);
fail("exception expected");
} catch (XmlRpcException e) {
assertEquals(getDomOptionsCount(),0);
}
}
@ -160,6 +163,7 @@ public class DomainTest {
try {
Object execute = client.execute(MODULE + ".update", params);
assertNotNull(execute);
assertEquals(getDomOptionsCount(),1);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
@ -183,6 +187,7 @@ public class DomainTest {
try {
Object execute = client.execute(MODULE + ".update", params);
assertNotNull(execute);
assertEquals(getDomOptionsCount(),2);
} catch (XmlRpcException e) {
fail(e.getMessage());
}
@ -206,4 +211,23 @@ public class DomainTest {
return count;
}
private int getDomOptionsCount() {
int count = 0;
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
Map<String, String> whereParams = new HashMap<String, String>();
whereParams.put("name", "example01.org");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
whereParams };
try {
Object execute = client.execute(MODULE + ".search", params);
Object[] result = (Object[]) execute;
count = ( (Domain) result[0] ).getDomainOptions().size();
} catch (XmlRpcException e) {
fail(e.getMessage());
}
return count;
}
}