1 13 14 package org.ejbca.util.dn; 15 16 import junit.framework.TestCase; 17 18 import org.apache.log4j.Logger; 19 import org.ejbca.util.CertTools; 20 21 22 27 public class TestDnComponents extends TestCase { 28 private static Logger log = Logger.getLogger(TestDnComponents.class); 29 30 35 public TestDnComponents(String name) { 36 super(name); 37 } 38 39 protected void setUp() throws Exception { 40 log.debug(">setUp()"); 41 log.debug("<setUp()"); 42 } 43 44 protected void tearDown() throws Exception { 45 log.debug(">tearDown()"); 46 log.debug("<tearDown()"); 47 } 48 49 54 public void test01CheckObjects() throws Exception { 55 String [] s = DnComponents.getDnObjects(); 56 assertEquals(21, s.length); 57 assertEquals("unstructuredaddress",s[0]); 58 assertEquals("unstructuredname",s[1]); 59 assertEquals("dn",s[5]); 60 assertEquals("uid",s[6]); 61 assertEquals("cn",s[7]); 62 assertEquals("t",s[14]); 63 assertEquals("c",s[20]); 64 65 String [] s1 = DnComponents.getDnObjectsReverse(); 66 assertEquals(21, s1.length); 67 assertEquals("unstructuredaddress",s1[20]); 68 assertEquals("unstructuredname",s1[19]); 69 assertEquals("uid",s1[14]); 70 assertEquals("cn",s1[13]); 71 assertEquals("t",s1[6]); 72 assertEquals("c",s1[0]); 73 74 String [] s2 = DnComponents.getDnObjects(); 75 assertEquals(21, s2.length); 76 assertEquals("unstructuredaddress",s2[0]); 77 assertEquals("unstructuredname",s2[1]); 78 assertEquals("uid",s2[6]); 79 assertEquals("cn",s2[7]); 80 assertEquals("t",s2[14]); 81 assertEquals("c",s2[20]); 82 83 } 84 public void test02() { 85 String dn = CertTools.stringToBCDNString("uri=fff,CN=oid,C=se"); 86 System.out.println(dn); 87 } 88 89 } 90 | Popular Tags |