1 23 package com.sun.enterprise.management.ext.wsmgmt; 24 25 import java.util.Set ; 26 import java.util.Iterator ; 27 import java.io.IOException ; 28 import java.util.Map ; 29 import java.util.HashMap ; 30 31 import com.sun.appserv.management.j2ee.WebServiceEndpoint; 32 import com.sun.appserv.management.monitor.WebServiceEndpointMonitor; 33 34 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr; 35 import com.sun.appserv.management.ext.wsmgmt.WebServiceEndpointInfo; 36 37 import com.sun.enterprise.management.AMXTestBase; 38 import com.sun.enterprise.management.Capabilities; 39 40 41 42 44 public final class WebServiceMgrTest extends AMXTestBase 45 { 46 47 public WebServiceMgrTest(){ 48 } 49 50 public static Capabilities 51 getCapabilities() 52 { 53 return getOfflineCapableCapabilities( false ); 54 } 55 56 public void testGetWebServiceMgr() { 57 assert (getDomainRoot().getWebServiceMgr() != null); 58 } 59 60 public void testGetWebServiceNames() { 61 java.util.Map m = null; 62 63 m = getDomainRoot().getWebServiceMgr().getWebServiceEndpointKeys(); 64 65 if ( m == null) { 66 System.out.println("No web services found "); 67 return; 68 } 69 70 System.out.println("Number of web services " + m.keySet().size()); 71 System.out.println("Fully qualified names..."); 72 for (Iterator iter = m.keySet().iterator(); iter.hasNext();) { 73 String key = (String )iter.next(); 74 System.out.println("Looking for runtime objects for " + key); 75 Set <WebServiceEndpoint> epSet = 76 getDomainRoot().getWebServiceMgr().getWebServiceEndpointSet(key, 77 "server"); 78 if ( epSet != null) { 79 System.out.println("Found " + epSet.size() + " for " + key); 80 for(Iterator epItr = epSet.iterator(); epItr.hasNext();) { 81 WebServiceEndpoint ep = (WebServiceEndpoint) epItr.next(); 82 System.out.println("Found " + ep.getName() ); 83 WebServiceEndpointMonitor epm = (WebServiceEndpointMonitor) 84 ep.getMonitoringPeer(); 85 System.out.println("Monitoing peer for " + ep.getName() + 86 " is " + epm); 87 88 } 89 } 90 } 91 System.out.println("Display names..."); 92 for (Iterator iter = m.values().iterator(); iter.hasNext();) { 93 System.out.println((String )iter.next()); 94 } 95 assert(true); 96 } 97 98 public void testGetWebServiceInfo() { 99 Map <Object ,String > m = null; 100 101 m = getDomainRoot().getWebServiceMgr().getWebServiceEndpointKeys(); 102 103 if ( m == null) { 104 System.out.println("No web services found "); 105 return; 106 } 107 108 System.out.println("Number of web services " + m.keySet().size()); 109 System.out.println("Fully qualified names..."); 110 for( final Object fqn : m.keySet() ) 111 { 112 System.out.println("Info for web service " + fqn); 113 114 final WebServiceEndpointInfo info = 115 getDomainRoot().getWebServiceMgr().getWebServiceEndpointInfo(fqn); 116 117 130 } 131 } 132 133 138 public void testListRegistryLocations (){ 139 String [] list = getDomainRoot().getWebServiceMgr().listRegistryLocations(); 140 if(list == null){ 141 fail("Did not get any registry locations. Please check you have " + 142 "created one with the name foo"); 143 } else{ 144 for (int i = 0; i< list.length; i++){ 145 System.out.println("RegistryLocation = "+list[i]); 146 } 147 assert(true); 149 } 150 } 151 152 public void testAddRegistryConnectionResources (){ 153 String jndiname = "eis/SOAR"; 154 String description = "Duh"; 155 String purl = "http://publishurl"; 156 String qurl = "http://queryurl"; 157 Map <String , String > map = new HashMap <String , String > (); 158 map.put (WebServiceMgr.QUERY_URL_KEY, qurl); 159 map.put (WebServiceMgr.PUBLISH_URL_KEY, purl); 160 161 assertTrue(true); 164 } 165 166 public void testRemoveRegistryConnectionResources (){ 167 String jndiname = "eis/SOAR"; 168 getDomainRoot().getWebServiceMgr().removeRegistryConnectionResources (jndiname); 169 assertTrue(true); 170 } 171 } 172 173 174 | Popular Tags |