KickJava   Java API By Example, From Geeks To Geeks.

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


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.ext.logging;
24
25 import java.util.Map JavaDoc;
26 import java.util.Date JavaDoc;
27 import java.util.logging.Level JavaDoc;
28
29 import javax.management.openmbean.CompositeData JavaDoc;
30 import javax.management.openmbean.OpenDataException JavaDoc;
31
32 import com.sun.appserv.management.ext.logging.LogQueryEntry;
33 import com.sun.appserv.management.ext.logging.LogQueryEntryImpl;
34
35
36 import com.sun.enterprise.management.Capabilities;
37
38 /**
39  */

40 public final class LogQueryEntryImplTest extends junit.framework.TestCase
41 {
42         public
43     LogQueryEntryImplTest( )
44     {
45     }
46     
47     
48     private static final String JavaDoc N1 = "foo";
49     private static final String JavaDoc V1 = "foo-value";
50     private static final String JavaDoc N2 = LogQueryEntry.THREAD_ID_KEY;
51     private static final String JavaDoc V2 = "13347";
52     
53         private static String JavaDoc
54     nvp( final String JavaDoc name, final String JavaDoc value )
55     {
56         return( name + "=" + value );
57     }
58     
59         public static LogQueryEntryImpl
60     createDummy()
61     {
62         return new LogQueryEntryImpl(
63             0,
64             new Date JavaDoc(),
65             Level.OFF.toString(),
66             "Sun Appserver whatever",
67             "hello world",
68             "MSG01",
69             "module",
70             nvp(N1,V1) + ";" + nvp(N2,V2) );
71     }
72     
73         public void
74     testCreate()
75     {
76         createDummy();
77     }
78     
79         public void
80     testEquals()
81     {
82         final LogQueryEntryImpl d = createDummy();
83         
84         assertEquals( d, d );
85         
86         final LogQueryEntryImpl dCopy = new LogQueryEntryImpl(
87             d.getRecordNumber(),
88             d.getDate(),
89             d.getLevel(),
90             d.getProductName(),
91             d.getMessage(),
92             d.getMessageID(),
93             d.getModule(),
94             d.getNameValuePairs() );
95         
96         assertEquals( d, dCopy );
97         assertEquals( dCopy, d );
98     }
99     
100     
101         public void
102     testGetNameValuePairsMap()
103     {
104         final LogQueryEntryImpl d = createDummy();
105         
106         final Map JavaDoc<String JavaDoc,String JavaDoc> m = d.getNameValuePairsMap();
107         assertEquals( V1, m.get( N1 ) );
108         assertEquals( V2, m.get( N2 ) );
109     }
110     
111         public void
112     testGetters()
113         throws OpenDataException JavaDoc
114     {
115         final LogQueryEntryImpl d = createDummy();
116         
117         d.getRecordNumber();
118         d.getDate();
119         d.getLevel();
120         d.getMessage();
121         d.getMessageID();
122         d.getModule();
123         d.getMessage();
124         d.getNameValuePairs();
125         d.getNameValuePairsMap();
126     }
127     
128     /*
129         public void
130     testAsMap()
131     {
132         final LogQueryEntryImpl dummy = createDummy();
133         
134         final Mapxxx m = dummy.asMap();
135         
136         final LogQueryEntryImpl copy = new LogQueryEntryImpl( m );
137         assertEquals( dummy, copy );
138     }
139     
140         public void
141     testAsCompositeData()
142         throws OpenDataException
143     {
144         final LogQueryEntryImpl dummy = createDummy();
145         
146         final CompositeData d = dummy.asCompositeData();
147         
148         final LogQueryEntryImpl copy = new LogQueryEntryImpl( d );
149         assertEquals( dummy, copy );
150         
151         assert( copy.toString().equals( dummy.toString() ) );
152     }
153     */

154 }
155
156
157
158
159
160
161
162
163
164
Popular Tags