KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > monitor > WebServiceEndpointMonitorTest


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  
24 /*
25  * $Header: /cvs/glassfish/admin/mbeanapi-impl/tests/com/sun/enterprise/management/monitor/WebServiceEndpointMonitorTest.java,v 1.5 2005/12/25 03:41:55 tcfujii Exp $
26  * $Revision: 1.5 $
27  * $Date: 2005/12/25 03:41:55 $
28  */

29 package com.sun.enterprise.management.monitor;
30
31 import javax.management.ObjectName JavaDoc;
32
33 import java.util.Set JavaDoc;
34 import java.util.Map JavaDoc;
35 import java.util.HashMap JavaDoc;
36 import java.util.Iterator JavaDoc;
37
38 import javax.management.j2ee.statistics.Statistic JavaDoc;
39 import javax.management.j2ee.statistics.Stats JavaDoc;
40 import javax.management.j2ee.statistics.CountStatistic JavaDoc;
41 import javax.management.j2ee.statistics.BoundaryStatistic JavaDoc;
42 import javax.management.j2ee.statistics.RangeStatistic JavaDoc;
43 import javax.management.j2ee.statistics.BoundedRangeStatistic JavaDoc;
44 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
45 import com.sun.appserv.management.j2ee.statistics.NumberStatistic;
46
47             
48 import com.sun.appserv.management.base.AMX;
49 import com.sun.appserv.management.base.XTypes;
50 import com.sun.appserv.management.base.QueryMgr;
51 import com.sun.appserv.management.monitor.WebServiceEndpointMonitor;
52 import com.sun.appserv.management.monitor.statistics.WebServiceEndpointAggregateStats;
53
54 import com.sun.appserv.management.j2ee.statistics.*;
55
56
57 import com.sun.enterprise.management.AMXTestBase;
58 import com.sun.enterprise.management.Capabilities;
59
60
61 public final class WebServiceEndpointMonitorTest
62     extends AMXMonitorTestBase
63 {
64         public
65     WebServiceEndpointMonitorTest()
66     {
67     }
68     
69   
70         public void
71     testStats()
72     {
73         final QueryMgr q = getQueryMgr();
74         
75         final Set JavaDoc wsMonitors = q.queryJ2EETypeSet(
76         XTypes.WEBSERVICE_ENDPOINT_MONITOR );
77         
78         if ( wsMonitors.size() == 0 )
79         {
80             warning( "WebServiceEndpointMonitorTest: no MBeans found to test.");
81         }
82         else
83         {
84             Iterator JavaDoc itr = wsMonitors.iterator();
85             while ( itr.hasNext() )
86             {
87                 WebServiceEndpointMonitor m = (WebServiceEndpointMonitor)
88                 itr.next();
89
90                 final WebServiceEndpointAggregateStats s =
91                     m.getWebServiceEndpointAggregateStats();
92                 
93                 // verify that we can get each Statistic;
94
// there was a problem at one time
95

96                 final CountStatistic JavaDoc r1 = s.getTotalFaults();
97                 assert( r1 != null );
98         
99                 final CountStatistic JavaDoc r2 = s.getTotalNumSuccess() ;
100                 assert( r2 != null );
101         
102                 //final AverageRangeStatistic r3 = s.getResponseTime();
103
//assert( r3 != null );
104

105                 final NumberStatistic c1 = s.getThroughput() ;
106                 assert( c1 != null );
107         
108                 final CountStatistic JavaDoc c2 = s.getTotalAuthFailures();
109                 assert( c2 != null );
110         
111                 final CountStatistic JavaDoc c3 = s.getTotalAuthSuccesses();
112                 assert( c3 != null );
113         
114             }
115         }
116     }
117  
118 }
119
120
121
122
123
124
125
Popular Tags