*** empty log message ***
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / common / AQHTest.java
index 4811444..8aeeb63 100755 (executable)
@@ -80,7 +80,7 @@ public class AQHTest extends TestCase {
        public void testExpiration() {
                try {
                        AttributeQueryHandle aqh = new AttributeQueryHandle("Walter", goodKey, 1l, testHs);
-                       Thread.sleep(2);
+                       Thread.sleep(50);
                        assertTrue("AttributeQueryHandle failed to expire appropriately", aqh.isExpired());
                } catch (InterruptedException e) {
                } catch (HandleException e) {
@@ -88,7 +88,7 @@ public class AQHTest extends TestCase {
                }
        }
        /**
-        * Ensue that all of our UUIDs are not identical
+        * Ensure that all of our UUIDs are not identical
         */
        public void testDups() {
                try {
@@ -101,4 +101,36 @@ public class AQHTest extends TestCase {
                        fail("Failed to create AttributeQueryHandle" + e);
                }
        }
+       
+       /**
+        * Make sure that it is works to create an AQH where the username contains
+        * the character that is used for field separation during serialization
+        */
+       
+       public void testSeparator() {
+               
+               try {
+                       
+               String userName = "Test||Test";
+               
+               //Create an AQH
+               AttributeQueryHandle originalAQH =
+                       new AttributeQueryHandle(userName, goodKey, 300000l, testHs);
+                       
+               //Ensure that the principal was set correctly
+               assertEquals("Principal incorrect", userName, originalAQH.getPrincipal());
+               
+               //Create a new AQH from the serialized first AQH
+               AttributeQueryHandle secondAQH =
+                       new AttributeQueryHandle(originalAQH.serialize(), goodKey);
+                       
+               //Ensure that the principal was set correctly
+               assertEquals("Principal incorrect", userName, secondAQH.getPrincipal());
+               
+               } catch (HandleException e) {
+                       fail("Failed to create AttributeQueryHandle" + e);
+               }
+               
+               
+       }
 }
\ No newline at end of file