From 6a6f4bff94eee82233ecb8b3ce14ef72c9b4f995 Mon Sep 17 00:00:00 2001 From: Purodha Blissenbach Date: Wed, 18 Jul 2012 11:53:41 +0000 Subject: [PATCH] =?UTF-8?q?Teste,=20ob=20eine=20und=20zwei=20g=C3=BCltige?= =?UTF-8?q?=20Domainoptionen=20angenommen=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/de/hsadmin/remote/DomainTest.java | 55 ++++++++++++++++++- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/hsarback/test/de/hsadmin/remote/DomainTest.java b/hsarback/test/de/hsadmin/remote/DomainTest.java index e19ec77..3a55bab 100644 --- a/hsarback/test/de/hsadmin/remote/DomainTest.java +++ b/hsarback/test/de/hsadmin/remote/DomainTest.java @@ -6,7 +6,9 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.xmlrpc.XmlRpcException; @@ -120,13 +122,15 @@ public class DomainTest { } @Test - public void testIvalidOption() { + public void testInvalidOption() { String user = "aaa00"; String grantingTicketURL = cas.getGrantingTicketURL(user); - Map setParams = new HashMap(); + Map setParams = new HashMap(); Map whereParams = new HashMap(); setParams.put("user", "aaa00"); - setParams.put("domainoptions", "invalide"); + List optionslist = new ArrayList(); + optionslist.add("invalide"); + setParams.put("domainoptions", optionslist); whereParams.put("name", "example01.org"); Object[] params = new Object[] { user, cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), @@ -139,6 +143,51 @@ public class DomainTest { } } + @Test + public void testOneValidOption() { + String user = "aaa00"; + String grantingTicketURL = cas.getGrantingTicketURL(user); + Map setParams = new HashMap(); + Map whereParams = new HashMap(); + setParams.put("user", "aaa00"); + List optionslist = new ArrayList(); + optionslist.add("graylisting"); + setParams.put("domainoptions", optionslist); + whereParams.put("name", "example01.org"); + Object[] params = new Object[] { user, + cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), + setParams, whereParams }; + try { + Object execute = client.execute(MODULE + ".update", params); + assertNotNull(execute); + } catch (XmlRpcException e) { + fail(e.getMessage()); + } + } + + @Test + public void testTwoValidOptions() { + String user = "aaa00"; + String grantingTicketURL = cas.getGrantingTicketURL(user); + Map setParams = new HashMap(); + Map whereParams = new HashMap(); + setParams.put("user", "aaa00"); + List optionslist = new ArrayList(); + optionslist.add("htdocsfallback"); + optionslist.add("graylisting"); + setParams.put("domainoptions", optionslist); + whereParams.put("name", "example01.org"); + Object[] params = new Object[] { user, + cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), + setParams, whereParams }; + try { + Object execute = client.execute(MODULE + ".update", params); + assertNotNull(execute); + } catch (XmlRpcException e) { + fail(e.getMessage()); + } + } + private int getDomsCount() { int count = 0; String user = "aaa00";