]> WPIA git - gigi.git/commitdiff
More DNS-ping and email ping failtests.
authorFelix Dörre <felix@dogcraft.de>
Thu, 28 Aug 2014 13:35:01 +0000 (15:35 +0200)
committerFelix Dörre <felix@dogcraft.de>
Thu, 28 Aug 2014 13:36:52 +0000 (15:36 +0200)
+profiling output for "purging Database"

tests/org/cacert/gigi/ping/TestDNS.java
tests/org/cacert/gigi/testUtils/ManagedTest.java

index 4ee94743c8a48f66e969f373dcfa26f64b3e2863..cf15419962766e9ce71caa3bef41101735560a74 100644 (file)
@@ -29,7 +29,7 @@ import org.junit.Test;
 public class TestDNS extends ManagedTest {
 
     @Test
-    public void testDNSSanity() throws IOException, NamingException {
+    public void dnsSanity() throws IOException, NamingException {
 
         String token = RandomToken.generateToken(16);
         String value = RandomToken.generateToken(16);
@@ -40,22 +40,35 @@ public class TestDNS extends ManagedTest {
     }
 
     @Test
-    public void testEmailAndDNSSuccess() throws IOException, InterruptedException, SQLException, NamingException {
+    public void emailAndDNSSuccess() throws IOException, InterruptedException, SQLException, NamingException {
         testEmailAndDNS(0, 0, true, true);
     }
 
     @After
-    public void test() throws SQLException, IOException {
+    public void purgeDbAfterTest() throws SQLException, IOException {
         purgeDatabase();
     }
 
     @Test
-    public void testEmailAndDNSFail() throws IOException, InterruptedException, SQLException, NamingException {
+    public void dnsFail() throws IOException, InterruptedException, SQLException, NamingException {
         testEmailAndDNS(1, 0, false, true);
-        purgeDatabase();
+    }
+
+    @Test
+    public void dnsContentFail() throws IOException, InterruptedException, SQLException, NamingException {
         testEmailAndDNS(2, 0, false, true);
     }
 
+    @Test
+    public void emailFail() throws IOException, InterruptedException, SQLException, NamingException {
+        testEmailAndDNS(0, 1, true, false);
+    }
+
+    @Test
+    public void emailAndDNSFail() throws IOException, InterruptedException, SQLException, NamingException {
+        testEmailAndDNS(2, 1, false, false);
+    }
+
     public void testEmailAndDNS(int dnsVariant, int emailVariant, boolean successDNS, boolean successMail) throws IOException, InterruptedException, SQLException, NamingException {
         String email = createUniqueName() + "@example.org";
         createVerifiedUser("a", "b", email, TEST_PASSWORD);
@@ -93,8 +106,10 @@ public class TestDNS extends ManagedTest {
         URL u2 = new URL(u.toString() + m1.group(1));
 
         TestMail mail = getMailReciever().recieve();
-        String link = mail.extractLink();
-        new URL(link).openConnection().getHeaderField("");
+        if (emailVariant == 0) {
+            String link = mail.extractLink();
+            new URL(link).openConnection().getHeaderField("");
+        }
 
         PreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT COUNT(*) FROM domainPinglog");
         while (true) {
index 77822f52380101b47ff7d7c4ca17db1687255d6e..637b272aaed9dcba7e3681e10b1e8eab80f6607b 100644 (file)
@@ -150,7 +150,8 @@ public class ManagedTest {
     }
 
     public static void purgeDatabase() throws SQLException, IOException {
-        System.out.println("... purging Database");
+        System.out.print("... purging Database");
+        long ms = System.currentTimeMillis();
         try {
             DatabaseManager.run(new String[] {
                     testProps.getProperty("sql.driver"), testProps.getProperty("sql.url"), testProps.getProperty("sql.user"), testProps.getProperty("sql.password")
@@ -158,6 +159,7 @@ public class ManagedTest {
         } catch (ClassNotFoundException e) {
             e.printStackTrace();
         }
+        System.out.println(" in " + (System.currentTimeMillis() - ms) + " ms");
     }
 
     private static Properties generateMainProps() {