1 23 24 package com.rift.coad.lib.naming.cos; 25 26 import junit.framework.*; 27 import java.util.Enumeration ; 28 import java.util.Properties ; 29 import java.io.Serializable ; 30 import javax.naming.CompoundName ; 31 import javax.naming.Name ; 32 import javax.naming.NameParser ; 33 import javax.naming.NamingException ; 34 35 40 public class NamingParserTest extends TestCase { 41 42 public NamingParserTest(String testName) { 43 super(testName); 44 } 45 46 protected void setUp() throws Exception { 47 } 48 49 protected void tearDown() throws Exception { 50 } 51 52 public static Test suite() { 53 TestSuite suite = new TestSuite(NamingParserTest.class); 54 55 return suite; 56 } 57 58 61 public void testParse() throws Exception { 62 System.out.println("parse"); 63 64 String name = ""; 65 NamingParser instance = new NamingParser(); 66 67 Name result = instance.parse("java:comp/test/freddy"); 68 int index = 0; 69 for (Enumeration enumer = result.getAll(); enumer.hasMoreElements();index++) { 70 String value = enumer.nextElement().toString(); 71 if ((index == 0) && (!value.equals("java:comp"))) { 72 fail("Parsing failed"); 73 } 74 if ((index == 1) && (!value.equals("test"))) { 75 fail("Parsing failed"); 76 } 77 if ((index == 2) && (!value.equals("freddy"))) { 78 fail("Parsing failed"); 79 } 80 } 81 } 82 83 } 84 | Popular Tags |