1 23 24 29 30 package com.sun.enterprise.admin.wsmgmt.registry; 31 32 36 37 import com.sun.enterprise.admin.wsmgmt.registry.*; 38 39 import junit.framework.TestCase; 40 import junit.framework.TestResult; 41 import junit.framework.TestSuite; 42 import com.sun.enterprise.config.ConfigContext; 43 import com.sun.enterprise.config.ConfigBean; 44 import com.sun.enterprise.config.ConfigFactory; 45 import com.sun.enterprise.config.ConfigException; 46 import com.sun.enterprise.admin.wsmgmt.registry.ConfigHelper; 47 48 49 import java.util.List ; 50 import java.util.Map ; 51 import java.util.HashMap ; 52 import java.util.Iterator ; 53 54 public class ConfigHelperTest extends TestCase { 55 56 public ConfigHelperTest(String name) { 57 super(name); 58 } 59 60 public void testListRegistryLocations() throws ConfigException { 61 try { 62 String [] locations = ch_query.listRegistryLocations(); 63 System.out.println("Looking up Connection Jndi Name. Name" + 64 " should be "+POOL_NAME); 65 66 if(locations.length == 1){ 67 System.out.println("Locations = "+ locations[0]); 68 assertEquals("Looked up Registry Location ", POOL_NAME, 69 locations[0]); 70 } else{ 71 fail(" Returned wrong number of RegistryLocation"); 72 } 73 } catch (ConfigException ce) { 74 ce.printStackTrace(); 75 throw ce; 76 } 77 } 78 79 80 protected void setUp() { 81 try{ 82 System.out.println("ConfigHelperTest"); 83 ch_query = ConfigHelper.getInstanceToQueryRegistryLocations(); 84 ConfigContext ctx = ConfigFactory.createConfigContext(URL); 85 ch_query.setConfigContext(ctx); 86 } catch (Exception e){ 87 e.printStackTrace(); 88 } 89 } 90 91 private final static String URL = 92 "tests/com/sun/enterprise/admin/wsmgmt/registry/connectionpool-domain.xml"; 93 private final static String POOL_NAME = "foojndi"; 94 95 private ConfigHelper ch_query = null; 96 private ConfigHelper ch_add_delete = null; 97 public static void main(String args[]) { 98 junit.textui.TestRunner.run(ConfigHelperTest.class); 99 } 100 } 101 | Popular Tags |