]> WPIA git - gigi.git/commitdiff
UPD: Assume ping-env tests
authorFelix Dörre <felix@dogcraft.de>
Mon, 22 Sep 2014 17:03:57 +0000 (19:03 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 22 Sep 2014 17:03:57 +0000 (19:03 +0200)
tests/org/cacert/gigi/ping/TestDNS.java
tests/org/cacert/gigi/ping/TestHTTP.java
tests/org/cacert/gigi/ping/TestSSL.java
tests/org/cacert/gigi/testUtils/PingTest.java

index 606efa29073f5c0e3afcf9a7d75c8b4827ae4314..a298cdca3068bb4c0d7abfb0224851449be27753 100644 (file)
@@ -1,6 +1,7 @@
 package org.cacert.gigi.ping;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 import java.io.IOException;
 import java.net.URL;
@@ -60,6 +61,7 @@ public class TestDNS extends PingTest {
     public void testEmailAndDNS(int dnsVariant, int emailVariant, boolean successDNS, boolean successMail) throws IOException, InterruptedException, SQLException, NamingException {
 
         String test = getTestProps().getProperty("domain.dnstest");
+        assumeNotNull(test);
 
         URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
         Matcher m = initailizeDomainForm(u);
@@ -91,8 +93,11 @@ public class TestDNS extends PingTest {
 
     private String readDNS(String token) throws NamingException {
         String test = getTestProps().getProperty("domain.dnstest");
+        assumeNotNull(test);
         String targetDomain = token + "._cacert._auth." + test;
-        String[] data = DNSUtil.getTXTEntries(targetDomain, getTestProps().getProperty("domain.testns"));
+        String testns = getTestProps().getProperty("domain.testns");
+        assumeNotNull(testns);
+        String[] data = DNSUtil.getTXTEntries(targetDomain, testns);
         assertEquals(1, data.length);
         return data[0];
 
index ef780befe4b4158369558fd0ee531e67b9fb5db7..dffab08f2413a05bfbe8fdc4f44934cf2f124e5b 100644 (file)
@@ -1,6 +1,7 @@
 package org.cacert.gigi.ping;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -50,6 +51,7 @@ public class TestHTTP extends PingTest {
     public void testEmailAndHTTP(int httpVariant, int emailVariant, boolean successHTTP, boolean successMail) throws IOException, InterruptedException, SQLException {
 
         String test = getTestProps().getProperty("domain.http");
+        assumeNotNull(test);
 
         URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
         Matcher m = initailizeDomainForm(u);
@@ -79,7 +81,9 @@ public class TestHTTP extends PingTest {
     }
 
     private String readHTTP(String token) throws IOException {
-        URL u = new URL("http://" + getTestProps().getProperty("domain.http") + "/cacert-" + token + ".txt");
+        String httpDom = getTestProps().getProperty("domain.http");
+        assumeNotNull(httpDom);
+        URL u = new URL("http://" + httpDom + "/cacert-" + token + ".txt");
         return IOUtils.readURL(new InputStreamReader(u.openStream())).trim();
 
     }
index 26f276265d62577bc0a09158508c0524e4b82472..8684481ec5d2937aba5642cc54ec102aba5fa200 100644 (file)
@@ -1,6 +1,7 @@
 package org.cacert.gigi.ping;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 import java.io.IOException;
 import java.net.Socket;
@@ -88,7 +89,7 @@ public class TestSSL extends PingTest {
 
     private void testEmailAndSSL(int sslVariant, int emailVariant, boolean successMail) throws IOException, InterruptedException, SQLException, GeneralSecurityException, GigiApiException {
         String test = getTestProps().getProperty("domain.local");
-
+        assumeNotNull(test);
         URL u = new URL("https://" + getServerName() + DomainOverview.PATH);
 
         initailizeDomainForm(u);
index 5095d680690f8eb776c92125aaf4471aee071356..0a65ec51f44e734181b7c5969d3a4eb12f9b5c08 100644 (file)
@@ -1,6 +1,7 @@
 package org.cacert.gigi.testUtils;
 
 import static org.junit.Assert.*;
+import static org.junit.Assume.*;
 
 import java.io.IOException;
 import java.net.HttpURLConnection;
@@ -21,6 +22,7 @@ public abstract class PingTest extends ClientTest {
 
     protected static void updateService(String token, String value, String action) throws IOException, MalformedURLException {
         String manage = getTestProps().getProperty("domain.manage");
+        assumeNotNull(manage);
         String url = manage + "t1=" + token + "&t2=" + value + "&action=" + action;
         assertEquals(200, ((HttpURLConnection) new URL(url).openConnection()).getResponseCode());
     }