]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/TestDomain.java
ADD: more advanced domain name verification (public suffix, punycode)
[gigi.git] / tests / org / cacert / gigi / TestDomain.java
index 7ff9b53b92b8cfbe793131eb9101ecee2135716d..bf7118df4d52973a5d94c5082970ada7f1d6092c 100644 (file)
@@ -19,29 +19,29 @@ public class TestDomain extends ManagedTest {
     @Test
     public void testDomain() throws InterruptedException, GigiApiException {
         assertEquals(0, us.getDomains().length);
-        Domain d = new Domain(us, "v1.example.org");
+        Domain d = new Domain(us, "v1example.org");
         assertEquals(0, d.getId());
         d.insert();
         Domain[] domains = us.getDomains();
         assertEquals(1, domains.length);
-        assertEquals("v1.example.org", domains[0].getSuffix());
+        assertEquals("v1example.org", domains[0].getSuffix());
         assertEquals(domains[0].getOwner().getId(), us.getId());
         assertNotEquals(0, domains[0].getId());
         assertNotEquals(0, d.getId());
         assertEquals(d.getId(), domains[0].getId());
 
-        Domain d2 = new Domain(us, "v2.example.org");
+        Domain d2 = new Domain(us, "v2-example.org");
         assertEquals(0, d2.getId());
         d2.insert();
 
         domains = us.getDomains();
         assertEquals(2, domains.length);
-        if ( !domains[1].getSuffix().equals("v2.example.org")) {
+        if ( !domains[1].getSuffix().equals("v2-example.org")) {
             Domain d1 = domains[0];
             domains[0] = domains[1];
             domains[1] = d1;
         }
-        assertEquals("v2.example.org", domains[1].getSuffix());
+        assertEquals("v2-example.org", domains[1].getSuffix());
         assertEquals(domains[0].getOwner().getId(), us.getId());
         assertEquals(domains[1].getOwner().getId(), us.getId());
         assertNotEquals(0, domains[0].getId());
@@ -52,10 +52,10 @@ public class TestDomain extends ManagedTest {
 
     @Test
     public void testDoubleDomain() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "dub.example.org");
+        Domain d = new Domain(us, "dub-example.org");
         d.insert();
         try {
-            Domain d2 = new Domain(us, "dub.example.org");
+            Domain d2 = new Domain(us, "dub-example.org");
             d2.insert();
             fail("expected exception");
         } catch (GigiApiException e) {
@@ -65,66 +65,16 @@ public class TestDomain extends ManagedTest {
 
     @Test
     public void testDoubleDomainDelete() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "del.example.org");
+        Domain d = new Domain(us, "delexample.org");
         d.insert();
         d.delete();
-        Domain d2 = new Domain(us, "del.example.org");
+        Domain d2 = new Domain(us, "delexample.org");
         d2.insert();
     }
 
-    @Test
-    public void testPrefixCheck() throws InterruptedException, GigiApiException {
-        String uni = createUniqueName() + "un.tld";
-        Domain d0 = new Domain(us, uni);
-        d0.insert();
-        d0.delete();
-        Domain d = new Domain(us, "pref." + uni);
-        d.insert();
-
-        Domain d2 = new Domain(us, uni);
-        try {
-            d2.insert();
-            fail("Prefix match failed");
-        } catch (GigiApiException e) {
-        }
-        d2 = new Domain(us, "a.pref." + uni);
-        try {
-            d2.insert();
-            fail("Prefix match failed");
-        } catch (GigiApiException e) {
-        }
-        d2 = new Domain(us, "pref." + uni);
-        try {
-            d2.insert();
-            fail("exact match failed");
-        } catch (GigiApiException e) {
-        }
-
-    }
-
-    @Test
-    public void testDoubleDomainPrefix() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "pref.aexample.org");
-        d.insert();
-        Domain d2 = new Domain(us, "a.pref.aexample.org");
-        try {
-            d2.insert();
-            fail("expected exception");
-        } catch (GigiApiException e) {
-            // expected
-        }
-        Domain d3 = new Domain(us, "aexample.org");
-        try {
-            d3.insert();
-            fail("expected exception");
-        } catch (GigiApiException e) {
-            // expected
-        }
-    }
-
     @Test
     public void testDoubleInsertDomain() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "dins.example.org");
+        Domain d = new Domain(us, "dins-example.org");
         d.insert();
         try {
             d.insert();