X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2Fping%2FTestHTTP.java;h=6ee6f6e821cecc958eb2a338ea9503fd3437dd25;hp=ef780befe4b4158369558fd0ee531e67b9fb5db7;hb=9474df27407dd99134876f2c8a2a3b6e7d1fae6a;hpb=b1092da65fd373d945343e01dd8975ec3b84db0a diff --git a/tests/org/cacert/gigi/ping/TestHTTP.java b/tests/org/cacert/gigi/ping/TestHTTP.java index ef780bef..6ee6f6e8 100644 --- a/tests/org/cacert/gigi/ping/TestHTTP.java +++ b/tests/org/cacert/gigi/ping/TestHTTP.java @@ -1,6 +1,8 @@ package org.cacert.gigi.ping; +import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; +import static org.junit.Assume.*; import java.io.IOException; import java.io.InputStreamReader; @@ -12,6 +14,10 @@ import java.util.regex.Pattern; 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.testUtils.IOUtils; import org.cacert.gigi.testUtils.PingTest; @@ -33,23 +39,24 @@ public class TestHTTP extends PingTest { } @Test - public void httpAndMailSuccess() throws IOException, InterruptedException, SQLException { + public void httpAndMailSuccess() throws Exception { testEmailAndHTTP(0, 0, true, true); } @Test - public void httpFailKeyAndMailSuccess() throws IOException, InterruptedException, SQLException { + public void httpFailKeyAndMailSuccess() throws Exception { testEmailAndHTTP(1, 0, false, true); } @Test - public void httpFailValAndMailFail() throws IOException, InterruptedException, SQLException { + public void httpFailValAndMailFail() throws Exception { testEmailAndHTTP(2, 1, false, false); } - public void testEmailAndHTTP(int httpVariant, int emailVariant, boolean successHTTP, boolean successMail) throws IOException, InterruptedException, SQLException { + public void testEmailAndHTTP(int httpVariant, int emailVariant, boolean successHTTP, boolean successMail) throws IOException, InterruptedException, SQLException, GigiApiException { String test = getTestProps().getProperty("domain.http"); + assumeNotNull(test); URL u = new URL("https://" + getServerName() + DomainOverview.PATH); Matcher m = initailizeDomainForm(u); @@ -66,8 +73,7 @@ public class TestHTTP extends PingTest { TestMail mail = getMailReciever().recieve(); if (emailVariant == 0) { - String link = mail.extractLink(); - new URL(link).openConnection().getHeaderField(""); + mail.verify(); } waitForPings(2); @@ -76,11 +82,30 @@ public class TestHTTP extends PingTest { assertTrue(newcontent, !successHTTP ^ pat.matcher(newcontent).find()); pat = Pattern.compile("