1 23 package com.sun.enterprise.management.config; 24 25 import java.io.IOException ; 26 import java.util.Set ; 27 import java.util.Map ; 28 import java.util.Collections ; 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 44 public final class HTTPServiceConfigTest extends AMXTestBase 45 { 46 public HTTPServiceConfigTest () 47 { 48 } 49 50 synchronized final HTTPServiceConfig 51 proxy() throws IOException 52 { 53 return getConfigConfig().getHTTPServiceConfig(); 54 } 55 56 static final Map <String ,String > EMPTY_MAP = Collections.emptyMap(); 57 58 public void 59 testRequestProcessing() 60 throws Exception 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 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 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 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 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 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 |