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 import java.io.Serializable ; 31 32 33 import javax.management.ObjectName ; 34 import javax.management.AttributeList ; 35 import javax.management.MBeanServerConnection ; 36 import javax.management.NotCompliantMBeanException ; 37 38 import com.sun.appserv.management.j2ee.J2EEDomain; 39 40 41 import com.sun.appserv.management.util.jmx.MBeanServerConnectionConnectionSource; 42 43 import com.sun.enterprise.management.support.AMXNonConfigImplBase; 44 import com.sun.enterprise.management.support.QueryMgrImpl; 45 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr; 46 import com.sun.appserv.management.util.misc.ExceptionUtil; 47 import com.sun.appserv.management.util.misc.TypeCast; 48 49 import com.sun.appserv.management.j2ee.WebServiceEndpoint; 50 import com.sun.appserv.management.config.WebServiceEndpointConfig; 51 import com.sun.appserv.management.ext.wsmgmt.MessageTrace; 52 import com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl; 53 import com.sun.appserv.management.base.XTypes; 54 import com.sun.appserv.management.j2ee.J2EETypes; 55 import com.sun.appserv.management.base.Util; 56 57 import com.sun.enterprise.management.AMXTestBase; 58 import com.sun.enterprise.management.Capabilities; 59 60 62 public final class WebServiceRuntimeTest extends AMXTestBase 63 { 64 65 public WebServiceRuntimeTest() throws IOException { 66 } 67 68 public static Capabilities 69 getCapabilities() 70 { 71 return getOfflineCapableCapabilities( false ); 72 } 73 74 public void testRuntimeMBeans() { 75 assert (getDomainRoot().getWebServiceMgr() != null); 76 77 final Set <WebServiceEndpoint> s = 78 getDomainRoot().getQueryMgr().queryJ2EETypeSet( J2EETypes.WEB_SERVICE_ENDPOINT); 79 80 for( final WebServiceEndpoint wsp : s ) 81 { 82 wsp.resetStats(); 83 84 long ts = wsp.getLastResetTime(); 85 System.out.println("Web Service endpoint name is " + wsp.getName()); 86 System.out.println("Last reset time is " + ts); 87 88 try { 89 Thread.currentThread().sleep(1); 90 } catch (Exception e) { 91 } 92 93 wsp.resetStats(); 94 long ts2 = wsp.getLastResetTime(); 95 System.out.println("Last reset time is " + ts2); 96 if (( ts == 0 ) && ( ts2 == 0)) { 97 assert(true); 98 } else { 99 assert( ts != ts2); 100 } 101 } 102 } 103 104 public void testMessageTrace() { 105 assert (getDomainRoot().getWebServiceMgr() != null); 106 107 final Set <WebServiceEndpoint> s = 108 getDomainRoot().getQueryMgr().queryJ2EETypeSet(J2EETypes.WEB_SERVICE_ENDPOINT); 109 110 for( final WebServiceEndpoint wsp : s ) 111 { 112 final MessageTrace[] msgs = wsp.getMessagesInHistory(); 113 if ( msgs == null) 114 { 115 System.out.println(" No messages found"); 116 continue; 117 } 118 119 System.out.println(" Collected messages " + msgs.length); 120 for ( int idx =0; idx < msgs.length; idx++) 121 { 122 final MessageTrace msg = msgs[idx]; 123 124 System.out.println(" message id " + msg.getMessageID()); 125 System.out.println(" application id " + msg.getApplicationID()); 126 System.out.println(" endpoint name " + msg.getEndpointName()); 127 System.out.println(" response size " + msg.getResponseSize()); 128 System.out.println(" request size " + msg.getRequestSize()); 129 System.out.println(" transport type is " + 130 msg.getTransportType()); 131 System.out.println(" request headers are " + 132 msg.getHTTPRequestHeaders() ); 133 System.out.println(" response headers are " + 134 msg.getHTTPResponseHeaders() ); 135 System.out.println(" fault code is " + msg.getFaultCode()); 136 System.out.println(" fault string is " + msg.getFaultString()); 137 System.out.println(" fault actor is " + msg.getFaultActor()); 138 System.out.println(" client host is " + msg.getClientHost()); 139 System.out.println(" principal name is " + 140 msg.getPrincipalName()); 141 System.out.println(" request content is " + 142 msg.getRequestContent()); 143 System.out.println(" response content is " + 144 msg.getResponseContent()); 145 System.out.println(" call flow enabled " + 146 msg.isCallFlowEnabled()); 147 } 148 } 149 } 150 } 151 152 153 | Popular Tags |