KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > config > HTTPServiceConfigTest


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.config;
24
25 import java.io.IOException JavaDoc;
26 import java.util.Set JavaDoc;
27 import java.util.Map JavaDoc;
28 import java.util.Collections JavaDoc;
29
30 import com.sun.appserv.management.config.HTTPServiceConfig;
31 import com.sun.appserv.management.config.RequestProcessingConfig;
32 import com.sun.appserv.management.config.KeepAliveConfig;
33 import com.sun.appserv.management.config.HTTPFileCacheConfig;
34 import com.sun.appserv.management.config.HTTPProtocolConfig;
35 import com.sun.appserv.management.config.AccessLogConfig;
36 import com.sun.appserv.management.config.ConnectionPoolConfig;
37
38
39 import com.sun.enterprise.management.AMXTestBase;
40 import com.sun.enterprise.management.Capabilities;
41
42 /**
43  */

44 public final class HTTPServiceConfigTest extends AMXTestBase
45 {
46         public HTTPServiceConfigTest ()
47     {
48     }
49
50         synchronized final HTTPServiceConfig
51     proxy() throws IOException JavaDoc
52     {
53         return getConfigConfig().getHTTPServiceConfig();
54     }
55
56     static final Map JavaDoc<String JavaDoc,String JavaDoc> EMPTY_MAP = Collections.emptyMap();
57
58         public void
59     testRequestProcessing()
60         throws Exception JavaDoc
61     {
62         if ( ! checkNotOffline( "testRequestProcessing" ) )
63         {
64             return;
65         }
66         
67         RequestProcessingConfig on = proxy().getRequestProcessingConfig();
68         boolean exists = (on != null);
69         if (!exists)
70         {
71             on = proxy().createRequestProcessingConfig(EMPTY_MAP);
72             assert on == proxy().getRequestProcessingConfig();
73         }
74         RequestProcessingConfig rp = proxy().getRequestProcessingConfig();
75         assert rp != null;
76         if (!exists) { proxy().removeRequestProcessingConfig(); }
77     }
78
79         public void
80     testKeepAlive()
81         throws Exception JavaDoc
82     {
83         if ( ! checkNotOffline( "testKeepAlive" ) )
84         {
85             return;
86         }
87         
88         KeepAliveConfig on = proxy().getKeepAliveConfig();
89         boolean exists = (on != null);
90         if (!exists)
91         {
92             on = proxy().createKeepAliveConfig(EMPTY_MAP);
93             assert on == proxy().getKeepAliveConfig();
94         }
95         KeepAliveConfig rp = proxy().getKeepAliveConfig();
96         assert rp != null;
97         if (!exists) { proxy().removeKeepAliveConfig(); }
98     }
99
100         public void
101     testAccessLog()
102         throws Exception JavaDoc
103     {
104         if ( ! checkNotOffline( "testAccessLog" ) )
105         {
106             return;
107         }
108         
109         AccessLogConfig on = proxy().getAccessLogConfig();
110         boolean exists = (on != null);
111         if (!exists)
112         {
113             on = proxy().createAccessLogConfig(EMPTY_MAP);
114             assert on == proxy().getAccessLogConfig();
115         }
116         AccessLogConfig rp = proxy().getAccessLogConfig();
117         assert rp != null;
118         if (!exists) { proxy().removeAccessLogConfig(); }
119     }
120
121         public void
122     testHTTPFileCache()
123         throws Exception JavaDoc
124     {
125         if ( ! checkNotOffline( "testHTTPFileCache" ) )
126         {
127             return;
128         }
129         
130         HTTPFileCacheConfig on = proxy().getHTTPFileCacheConfig();
131         boolean exists = (on != null);
132         if (!exists)
133         {
134             on = proxy().createHTTPFileCacheConfig(EMPTY_MAP);
135             assert on == proxy().getHTTPFileCacheConfig();
136         }
137         HTTPFileCacheConfig rp = proxy().getHTTPFileCacheConfig();
138         assert rp != null;
139         if (!exists) { proxy().removeHTTPFileCacheConfig(); }
140     }
141
142         public void
143     testConnectionPool()
144         throws Exception JavaDoc
145     {
146         if ( ! checkNotOffline( "testConnectionPool" ) )
147         {
148             return;
149         }
150         
151         ConnectionPoolConfig on = proxy().getConnectionPoolConfig();
152         boolean exists = (on != null);
153         if (!exists)
154         {
155             on = proxy().createConnectionPoolConfig(EMPTY_MAP);
156             assert on == proxy().getConnectionPoolConfig();
157         }
158         ConnectionPoolConfig rp = proxy().getConnectionPoolConfig();
159         assert rp != null;
160         if (!exists) { proxy().removeConnectionPoolConfig(); }
161     }
162
163         public void
164     testHTTPProtocol()
165         throws Exception JavaDoc
166     {
167         if ( ! checkNotOffline( "testHTTPProtocol" ) )
168         {
169             return;
170         }
171         
172         HTTPProtocolConfig on = proxy().getHTTPProtocolConfig();
173         boolean exists = (on != null);
174         if (!exists)
175         {
176             on = proxy().createHTTPProtocolConfig(EMPTY_MAP);
177             assert on == proxy().getHTTPProtocolConfig();
178         }
179         HTTPProtocolConfig rp = proxy().getHTTPProtocolConfig();
180         assert rp != null;
181         if (!exists) { proxy().removeHTTPProtocolConfig(); }
182     }
183 }
184
185
186
Popular Tags