]> WPIA git - gigi.git/blobdiff - tests/org/cacert/gigi/TestDomain.java
Merge "Suggestions to enhance the SQL call pattern."
[gigi.git] / tests / org / cacert / gigi / TestDomain.java
index a833cd91c83e73a7d5e036e1b5fa3766eb43347f..91f29c7a0389daaab33e9c25be80806c69218905 100644 (file)
@@ -19,7 +19,7 @@ public class TestDomain extends ManagedTest {
     @Test
     public void testDomain() throws InterruptedException, GigiApiException {
         assertEquals(0, us.getDomains().length);
-        Domain d = new Domain(us, "v1example.org");
+        Domain d = new Domain(us, us, "v1example.org");
         Domain[] domains = us.getDomains();
         assertEquals(1, domains.length);
         assertEquals("v1example.org", domains[0].getSuffix());
@@ -28,7 +28,7 @@ public class TestDomain extends ManagedTest {
         assertNotEquals(0, d.getId());
         assertEquals(d.getId(), domains[0].getId());
 
-        Domain d2 = new Domain(us, "v2-example.org");
+        new Domain(us, us, "v2-example.org");
 
         domains = us.getDomains();
         assertEquals(2, domains.length);
@@ -48,10 +48,22 @@ public class TestDomain extends ManagedTest {
 
     @Test
     public void testDoubleDomain() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "dub-example.org");
+        new Domain(us, us, "dub-example.org");
         try {
-            Domain d2 = new Domain(us, "dub-example.org");
-            fail("expected exception");
+            new Domain(us, us, "dub-example.org");
+            fail("expected exception, was able to insert domain (with different case) a second time");
+        } catch (GigiApiException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testDoubleDomainCase() throws InterruptedException, GigiApiException {
+        Domain d = new Domain(us, us, "dub2-ExaMple.Org");
+        assertEquals("dub2-example.org", d.getSuffix());
+        try {
+            new Domain(us, us, "duB2-eXample.oRG");
+            fail("expected exception, was able to insert domain (with different case) a second time");
         } catch (GigiApiException e) {
             // expected
         }
@@ -59,9 +71,9 @@ public class TestDomain extends ManagedTest {
 
     @Test
     public void testDoubleDomainDelete() throws InterruptedException, GigiApiException {
-        Domain d = new Domain(us, "delexample.org");
+        Domain d = new Domain(us, us, "delexample.org");
         d.delete();
-        Domain d2 = new Domain(us, "delexample.org");
+        new Domain(us, us, "delexample.org");
     }
 
 }