X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fping%2FTestHTTP.java;h=31fecd942bb53e2ba4055aad9a182d77b953cbff;hb=78aea4e2c6a8e99ba546c4189d7071d57c1aaf3b;hp=624faefff71d1e61ae5436b0343d6941424bcf00;hpb=cd0c67fc376ea0ab65cfcb195efcf095f9942d89;p=gigi.git diff --git a/tests/org/cacert/gigi/ping/TestHTTP.java b/tests/org/cacert/gigi/ping/TestHTTP.java index 624faeff..31fecd94 100644 --- a/tests/org/cacert/gigi/ping/TestHTTP.java +++ b/tests/org/cacert/gigi/ping/TestHTTP.java @@ -17,8 +17,7 @@ import javax.naming.NamingException; import org.cacert.gigi.GigiApiException; import org.cacert.gigi.dbObjects.Domain; import org.cacert.gigi.dbObjects.DomainPingConfiguration; -import org.cacert.gigi.dbObjects.DomainPingConfiguration.PingType; -import org.cacert.gigi.pages.account.domain.DomainOverview; +import org.cacert.gigi.dbObjects.DomainPingType; import org.cacert.gigi.testUtils.IOUtils; import org.cacert.gigi.testUtils.PingTest; import org.cacert.gigi.testUtils.TestEmailReceiver.TestMail; @@ -58,8 +57,7 @@ public class TestHTTP extends PingTest { String test = getTestProps().getProperty("domain.http"); assumeNotNull(test); - URL u = new URL("https://" + getServerName() + DomainOverview.PATH); - Matcher m = initailizeDomainForm(u); + Matcher m = initailizeDomainForm(); updateService(m.group(1) + (httpVariant == 1 ? "a" : ""), m.group(2) + (httpVariant == 2 ? "a" : ""), "http"); String content = "newdomain=" + URLEncoder.encode(test, "UTF-8") + // @@ -69,7 +67,7 @@ public class TestHTTP extends PingTest { "&ssl-type-2=direct&ssl-port-2=" + // "&ssl-type-3=direct&ssl-port-3=" + // "&adddomain&csrf=" + csrf; - URL u2 = sendDomainForm(u, content); + String p2 = sendDomainForm(content); TestMail mail = getMailReciever().receive(); if (emailVariant == 0) { @@ -77,18 +75,18 @@ public class TestHTTP extends PingTest { } waitForPings(2); - String newcontent = IOUtils.readURL(cookie(u2.openConnection(), cookie)); + String newcontent = IOUtils.readURL(get(p2)); Pattern pat = Pattern.compile("http\\s*success"); assertTrue(newcontent, !successHTTP ^ pat.matcher(newcontent).find()); pat = Pattern.compile("email\\s*success"); assertTrue(newcontent, !successMail ^ pat.matcher(newcontent).find()); if (successHTTP) { // give it a second try - int id = Integer.parseInt(u2.toString().replaceFirst("^.*/([0-9]+)$", "$1")); + int id = Integer.parseInt(p2.replaceFirst("^.*/([0-9]+)$", "$1")); Domain d = Domain.getById(id); DomainPingConfiguration dpc = null; for (DomainPingConfiguration conf : d.getConfiguredPings()) { - if (conf.getType() == PingType.HTTP) { + if (conf.getType() == DomainPingType.HTTP) { dpc = conf; break; } @@ -96,7 +94,7 @@ public class TestHTTP extends PingTest { if (dpc == null) { fail("Http config not found"); } - String res = executeBasicWebInteraction(cookie, u2.getPath(), "configId=" + dpc.getId()); + String res = executeBasicWebInteraction(cookie, p2, "configId=" + dpc.getId()); assertThat(res, containsString("only allowed after")); } }