1 package com.ca.commons.jndi; 2 3 import junit.framework.*; 4 5 6 7 8 14 15 public class JNDIOpsTest extends TestCase 16 { 17 18 public JNDIOpsTest(String name) 19 { 20 super(name); 21 } 22 23 24 public static Test suite() 25 { 26 return new TestSuite(JNDIOpsTest.class); 27 } 28 29 30 31 protected void setUp() 32 { 33 } 34 35 36 37 public static void main(String [] args) 38 { 39 junit.textui.TestRunner.run(suite()); 40 } 41 42 43 44 47 public void testURLEncoding() 48 { 49 assertEquals("ldap://localhost:19389", JNDIOps.makeServerURL("ldap://localhost:19389", null)); 50 assertEquals("ldap://localhost:19389", JNDIOps.makeServerURL("ldap://localhost:19389", "")); 51 assertEquals("ldap:///o=University%20of%20Michigan,c=US", JNDIOps.makeServerURL("ldap://", "o=University of Michigan,c=US")); 52 assertEquals("ldap:///o=University%20of%20Michigan,c=US", JNDIOps.makeServerURL("ldap:///","o=University of Michigan,c=US" )); 53 assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US", JNDIOps.makeServerURL("ldap://ldap.itd.umich.edu", "o=University of Michigan,c=US")); 54 assertEquals("ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US", JNDIOps.makeServerURL("ldap://ldap.itd.umich.edu/","o=University of Michigan,c=US" )); 55 assertEquals("ldap://ldap.question.com/o=Question%3f,c=US", JNDIOps.makeServerURL("ldap://ldap.question.com", "o=Question?,c=US")); 56 assertEquals("ldap:///o=%20%3c%3e%3f%23%25%7b%7d%7c%5c%5e%7e%5b%5d%27", JNDIOps.makeServerURL("ldap:///", "o= <>\"#%{}|\\^~[]'")); 57 } 58 59 } | Popular Tags |