]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/ping/TestDNS.java
Fix: some nullpointer references (coverity).
[gigi.git] / tests / org / cacert / gigi / ping / TestDNS.java
index 761694513c3f6e7783506820b47fb18d33b4d734..021012a196f25432106bbc34c663ba64760db8ee 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;
@@ -11,12 +12,13 @@ import java.util.regex.Pattern;
 
 import javax.naming.NamingException;
 
-import org.cacert.gigi.pages.account.DomainOverview;
+import org.cacert.gigi.pages.account.domain.DomainOverview;
 import org.cacert.gigi.testUtils.IOUtils;
 import org.cacert.gigi.testUtils.PingTest;
 import org.cacert.gigi.testUtils.TestEmailReciever.TestMail;
 import org.cacert.gigi.util.DNSUtil;
 import org.cacert.gigi.util.RandomToken;
+import org.junit.Assert;
 import org.junit.Test;
 
 public class TestDNS extends PingTest {
@@ -60,6 +62,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);
@@ -76,8 +79,8 @@ public class TestDNS extends PingTest {
 
         TestMail mail = getMailReciever().recieve();
         if (emailVariant == 0) {
-            String link = mail.extractLink();
-            new URL(link).openConnection().getHeaderField("");
+            Assert.assertNotNull(mail);
+            mail.verify();
         }
 
         waitForPings(2);
@@ -91,8 +94,11 @@ public class TestDNS extends PingTest {
 
     private String readDNS(String token) throws NamingException {
         String test = getTestProps().getProperty("domain.dnstest");
-        String targetDomain = "cacert-" + token + "." + test;
-        String[] data = DNSUtil.getTXTEntries(targetDomain, getTestProps().getProperty("domain.testns"));
+        assumeNotNull(test);
+        String targetDomain = token + "._cacert._auth." + test;
+        String testns = getTestProps().getProperty("domain.testns");
+        assumeNotNull(testns);
+        String[] data = DNSUtil.getTXTEntries(targetDomain, testns);
         assertEquals(1, data.length);
         return data[0];