KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > ext > logging > StatefulLoggingHelperTest


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 package com.sun.enterprise.management.ext.logging;
25
26 import java.util.Set JavaDoc;
27
28 import com.sun.appserv.management.base.XTypes;
29
30 import com.sun.appserv.management.helper.StatefulLoggingHelper;
31
32 import com.sun.appserv.management.ext.logging.Logging;
33 import static com.sun.appserv.management.ext.logging.Logging.*;
34 import com.sun.appserv.management.ext.logging.LogQueryResult;
35
36
37 import com.sun.enterprise.management.AMXTestBase;
38 import com.sun.enterprise.management.Capabilities;
39
40
41 /**
42     Test the StatefulLoggingHelper.
43  */

44 public final class StatefulLoggingHelperTest extends AMXTestBase
45 {
46         public
47     StatefulLoggingHelperTest( )
48     {
49     }
50     
51         final Set JavaDoc<Logging>
52     getAllLogging()
53     {
54         return getQueryMgr().queryJ2EETypeSet( XTypes.LOGGING );
55     }
56     
57         public StatefulLoggingHelper
58     createHelper( final Logging logging )
59     {
60         return new StatefulLoggingHelper( logging );
61     }
62     
63         public void
64     testCreate()
65     {
66         final Set JavaDoc<Logging> loggings = getAllLogging();
67         
68         for( final Logging logging : loggings )
69         {
70             assert( createHelper(logging) != null );
71         }
72     }
73     
74         private void
75     validateResult( final LogQueryResult result )
76     {
77         assert( result != null );
78         assert( result.getFieldNames() != null );
79         assert( result.getEntries() != null );
80     }
81     
82     
83         public void
84     testQuery()
85     {
86         final long start = now();
87         
88         final Set JavaDoc<Logging> loggings = getAllLogging();
89         
90         for( final Logging logging : loggings )
91         {
92             assert( logging != null );
93             final StatefulLoggingHelper helper = createHelper(logging);
94             
95             final LogQueryResult result = helper.query();
96             validateResult( result );
97         }
98         
99         printElapsed( "testQuery", start);
100     }
101     
102 }
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Popular Tags