KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > j2ee > WSMsgTraceTest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.management.j2ee;
24
25 import java.io.IOException JavaDoc;
26 import java.io.Serializable JavaDoc;
27 import java.util.Set JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.Map JavaDoc;
30
31 import javax.management.ObjectName JavaDoc;
32 import javax.management.InstanceNotFoundException JavaDoc;
33
34 import com.sun.appserv.management.base.AMX;
35 import com.sun.appserv.management.base.QueryMgr;
36 import com.sun.appserv.management.base.XTypes;
37 import com.sun.appserv.management.base.Util;
38 import com.sun.appserv.management.j2ee.WebServiceEndpoint;
39 import com.sun.appserv.management.j2ee.J2EETypes;
40 import com.sun.appserv.management.ext.wsmgmt.MessageTrace;
41 import com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl;
42
43
44 import com.sun.enterprise.management.AMXTestBase;
45 import com.sun.enterprise.management.Capabilities;
46
47
48 /**
49  */

50 public final class WSMsgTraceTest extends AMXTestBase
51 {
52         public
53     WSMsgTraceTest( )
54         throws IOException JavaDoc
55     {
56     }
57     
58         public void
59     testMessageTrace()
60         throws ClassNotFoundException JavaDoc
61     {
62         final Set JavaDoc<WebServiceEndpoint> s =
63             getQueryMgr().queryJ2EETypeSet(J2EETypes.WEB_SERVICE_ENDPOINT);
64         
65         for( final WebServiceEndpoint wsp : s )
66         {
67             MessageTrace[] msgs = wsp.getMessagesInHistory();
68             if ( msgs == null) {
69                 System.out.println(" No messages collected " );
70                 return;
71             }
72             System.out.println(" Collected messages " + msgs.length);
73             for ( int idx =0; idx < msgs.length; idx++) {
74                 final MessageTrace msg = msgs[idx];
75
76                 System.out.println(" message id " + msg.getMessageID());
77                 System.out.println(" application id " + msg.getApplicationID());
78                 System.out.println(" endpoint name " + msg.getEndpointName());
79                 System.out.println(" response size " + msg.getResponseSize());
80                 System.out.println(" request size " + msg.getRequestSize());
81                 System.out.println(" transport type is " +
82                     msg.getTransportType());
83                 System.out.println(" request headers are " +
84                     msg.getHTTPRequestHeaders() );
85                 System.out.println(" response headers are " +
86                     msg.getHTTPResponseHeaders() );
87                 System.out.println(" fault code is " + msg.getFaultCode());
88                 System.out.println(" fault string is " + msg.getFaultString());
89                 System.out.println(" fault actor is " + msg.getFaultActor());
90                 System.out.println(" client host is " + msg.getClientHost());
91                 System.out.println(" principal name is " +
92                     msg.getPrincipalName());
93             }
94         }
95     }
96
97
98 }
99
100
101
Popular Tags