37
37
import weblogic .management .configuration .ServerMBean ;
38
38
import weblogic .management .configuration .WLDFSystemResourceMBean ;
39
39
import weblogic .management .jmx .MBeanServerInvocationHandler ;
40
- import weblogic .management .mbeanservers .edit . ConfigurationManagerMBean ;
40
+ import weblogic .management .mbeanservers .domainruntime . DomainRuntimeServiceMBean ;
41
41
import weblogic .management .mbeanservers .runtime .RuntimeServiceMBean ;
42
42
import weblogic .management .runtime .ServerRuntimeMBean ;
43
43
62
62
public class SitConfigTests {
63
63
64
64
private MBeanServerConnection runtimeMbs ;
65
- private MBeanServerConnection editMbs ;
66
- private ConfigurationManagerMBean cfgMgr ;
67
65
private JMXConnector jmxConnector ;
68
66
private static ObjectName service ;
69
67
private RuntimeServiceMBean runtimeServiceMBean ;
@@ -74,7 +72,6 @@ public class SitConfigTests {
74
72
private String adminPort ;
75
73
private final String adminUser ;
76
74
private final String adminPassword ;
77
- private final String serverName ;
78
75
79
76
/**
80
77
* Main method to create the SitConfigTests object and run the configuration override tests. To
@@ -92,37 +89,36 @@ public static void main(String args[]) throws Exception {
92
89
String adminHost = args [0 ];
93
90
String adminPort = args [1 ];
94
91
String adminUser = args [2 ];
95
- String adminPassword = args [3 ];
96
- String serverName = args [4 ];
97
- String testName = args [5 ];
92
+ String adminPassword = args [3 ];
93
+ String testName = args [4 ];
98
94
99
- SitConfigTests test =
100
- new SitConfigTests (adminHost , adminPort , adminUser , adminPassword , serverName );
95
+ SitConfigTests test = new SitConfigTests (adminHost , adminPort , adminUser , adminPassword );
101
96
102
97
ServerRuntimeMBean runtimeMBean = test .runtimeServiceMBean .getServerRuntime ();
103
98
println ("Sitconfig State:" + runtimeMBean .isInSitConfigState ());
104
99
105
100
if (testName .equals ("testCustomSitConfigOverridesForDomain" )) {
106
101
// the values passed to these verify methods are the attribute values overrrideen in the
107
102
// config.xml. These are just randomly chosen attributes and values to override
108
- test .verifyDebugFlagJMXCore (serverName , true );
109
- test .verifyDebugFlagServerLifeCycle (serverName , true );
110
- test .verifyMaxMessageSize (serverName , 78787878 );
111
- test .verifyConnectTimeout (serverName , 120 );
112
- test .verifyRestartMax (serverName , 5 );
113
- test .verifyT3ChannelPublicAddress (serverName , adminHost );
114
- test .verifyT3ChannelPublicPort (serverName , 30091 );
103
+ test .verifyDebugFlagJMXCore (true );
104
+ test .verifyDebugFlagServerLifeCycle (true );
105
+ test .verifyMaxMessageSize (78787878 );
106
+ test .verifyConnectTimeout (120 );
107
+ test .verifyRestartMax (5 );
108
+ test .verifyT3ChannelPublicAddress (adminHost );
109
+ test .verifyT3ChannelPublicPort (30091 );
115
110
}
116
-
111
+
117
112
if (testName .equals ("testCustomSitConfigOverridesForDomainMS" )) {
118
113
// the values passed to these verify methods are the attribute values overrrideen in the
119
114
// config.xml. These are just randomly chosen attributes and values to override
115
+ String serverName = args [5 ];
120
116
test .connectToManagedServer (serverName );
121
- test .verifyMaxMessageSize (serverName , 77777777 );
117
+ test .verifyMaxMessageSize (77777777 );
122
118
}
123
119
124
120
if (testName .equals ("testCustomSitConfigOverridesForJdbc" )) {
125
- String JDBC_URL = args [6 ];
121
+ String JDBC_URL = args [5 ];
126
122
test .testSystemResourcesJDBCAttributeChange ("JdbcTestDataSource-0" , JDBC_URL );
127
123
}
128
124
@@ -141,19 +137,16 @@ public static void main(String args[]) throws Exception {
141
137
* @param adminHost - administration server t3 public address
142
138
* @param adminPort - administration server t3 public port
143
139
* @param adminUser - administration server user name
144
- * @param adminPassword - administration server password
145
- * @param serverName - name of the server for which the configuration values to be checked
140
+ * @param adminPassword - - administration server password
146
141
* @throws Exception when connection cannot be created for reasons like incorrect administration
147
142
* server name, port , user name , password or administration server not running
148
143
*/
149
- public SitConfigTests (
150
- String adminHost , String adminPort , String adminUser , String adminPassword , String serverName )
144
+ public SitConfigTests (String adminHost , String adminPort , String adminUser , String adminPassword )
151
145
throws Exception {
152
146
this .adminHost = adminHost ;
153
147
this .adminPort = adminPort ;
154
148
this .adminUser = adminUser ;
155
149
this .adminPassword = adminPassword ;
156
- this .serverName = serverName ;
157
150
createConnections ();
158
151
}
159
152
@@ -176,6 +169,7 @@ private void createConnections() throws Exception {
176
169
runtimeServiceMBean =
177
170
(RuntimeServiceMBean )
178
171
MBeanServerInvocationHandler .newProxyInstance (runtimeMbs , runtimeserviceObjectName );
172
+ ObjectName domainServiceObjectName = new ObjectName (DomainRuntimeServiceMBean .OBJECT_NAME );
179
173
}
180
174
181
175
/**
@@ -224,6 +218,7 @@ private MBeanServerConnection lookupMBeanServerConnection(
224
218
if (mBeanServerConnection == null ) {
225
219
throw new Exception ("MBean server connection is null" );
226
220
}
221
+
227
222
return mBeanServerConnection ;
228
223
}
229
224
@@ -234,11 +229,9 @@ private MBeanServerConnection lookupMBeanServerConnection(
234
229
*
235
230
* @param expectedValue - boolean value to be checked in the debug-jmx-core attribute in
236
231
* ServerMBean in ServerConfig tree.
237
- * @param serverName - name of the weblogic server instance for which the debug flag to be checked
238
- * as a String
239
232
*/
240
- protected void verifyDebugFlagJMXCore (String serverName , boolean expectedValue ) {
241
- ServerMBean serverMBean = getServerMBean (serverName );
233
+ protected void verifyDebugFlagJMXCore (boolean expectedValue ) {
234
+ ServerMBean serverMBean = getServerMBean ();
242
235
ServerDebugMBean serverDebugMBean = serverMBean .getServerDebug ();
243
236
boolean debugFlag = serverDebugMBean .getDebugJMXCore ();
244
237
assert expectedValue == debugFlag
@@ -250,14 +243,11 @@ protected void verifyDebugFlagJMXCore(String serverName, boolean expectedValue)
250
243
* with the expected value, a boolean value set in the configuration override file config.xml.Uses
251
244
* Java assertions to verify if both the values match.
252
245
*
253
- * @param serverName name of the weblogic server instance for which the debug flag to be checked
254
- * as a String
255
246
* @param expectedValue - boolean value to be checked in the debug-server-life-cycle attribute in
256
- * ServerMBean in ServerConfig MBean tree * @param serverName - name of the weblogic server
257
- * instance for which the debug flag to be checked as a String
247
+ * ServerMBean in ServerConfig MBean tree
258
248
*/
259
- protected void verifyDebugFlagServerLifeCycle (String serverName , boolean expectedValue ) {
260
- ServerMBean serverMBean = getServerMBean (serverName );
249
+ protected void verifyDebugFlagServerLifeCycle (boolean expectedValue ) {
250
+ ServerMBean serverMBean = getServerMBean ();
261
251
ServerDebugMBean serverDebugMBean = serverMBean .getServerDebug ();
262
252
boolean debugFlag = serverDebugMBean .getDebugServerLifeCycle ();
263
253
assert expectedValue == debugFlag
@@ -271,11 +261,9 @@ protected void verifyDebugFlagServerLifeCycle(String serverName, boolean expecte
271
261
*
272
262
* @param expectedValue - integer value to be checked in the connect-timeout attribute in
273
263
* ServerMBean in ServerConfig tree.
274
- * @param serverName - name of the weblogic server instance for which the connect timeout to be
275
- * checked as a String
276
264
*/
277
- protected void verifyConnectTimeout (String serverName , int expectedValue ) {
278
- ServerMBean serverMBean = getServerMBean (serverName );
265
+ protected void verifyConnectTimeout (int expectedValue ) {
266
+ ServerMBean serverMBean = getServerMBean ();
279
267
int got = serverMBean .getConnectTimeout ();
280
268
assert expectedValue == got
281
269
: "Didn't get the expected value " + expectedValue + " for ConnectTimeout" ;
@@ -288,11 +276,9 @@ protected void verifyConnectTimeout(String serverName, int expectedValue) {
288
276
*
289
277
* @param expectedValue - integer value to be checked in the restart-max attribute in ServerMBean
290
278
* in ServerConfig tree.
291
- * @param serverName - name of the weblogic server instance for which the restart max to be
292
- * checked as a String
293
279
*/
294
- protected void verifyRestartMax (String serverName , int expectedValue ) {
295
- ServerMBean serverMBean = getServerMBean (serverName );
280
+ protected void verifyRestartMax (int expectedValue ) {
281
+ ServerMBean serverMBean = getServerMBean ();
296
282
int got = serverMBean .getRestartMax ();
297
283
assert expectedValue == got
298
284
: "Didn't get the expected value " + expectedValue + " for RestartMax" ;
@@ -305,11 +291,9 @@ protected void verifyRestartMax(String serverName, int expectedValue) {
305
291
*
306
292
* @param expectedValue - integer value to be checked in the max-message-size attribute in
307
293
* ServerMBean in ServerConfig tree
308
- * @param serverName - name of the weblogic server instance for which the max message size to be
309
- * checked as a String
310
294
*/
311
- protected void verifyMaxMessageSize (String serverName , int expectedValue ) {
312
- ServerMBean serverMBean = getServerMBean (serverName );
295
+ protected void verifyMaxMessageSize (int expectedValue ) {
296
+ ServerMBean serverMBean = getServerMBean ();
313
297
int got = serverMBean .getMaxMessageSize ();
314
298
assert expectedValue == got
315
299
: "Didn't get the expected value " + expectedValue + " for MaxMessageSize" ;
@@ -320,15 +304,14 @@ protected void verifyMaxMessageSize(String serverName, int expectedValue) {
320
304
* matches with the expected value, a string value set in the configuration override file
321
305
* config.xml. Uses Java assertions to verify if both the values match.
322
306
*
323
- * @param serverName name of the weblogic server instance for which the t3 public address to be
324
- * checked as a String
325
307
* @param expectedValue - string value to be checked in the public-address attribute in
326
308
* ServerMBean in ServerConfig tree.
327
309
*/
328
- protected void verifyT3ChannelPublicAddress (String serverName , String expectedValue ) {
310
+ protected void verifyT3ChannelPublicAddress (String expectedValue ) {
329
311
boolean got = false ;
330
- ServerMBean serverMBean = getServerMBean (serverName );
312
+ ServerMBean serverMBean = getServerMBean ();
331
313
NetworkAccessPointMBean [] networkAccessPoints = serverMBean .getNetworkAccessPoints ();
314
+
332
315
for (NetworkAccessPointMBean networkAccessPoint : networkAccessPoints ) {
333
316
if (networkAccessPoint .getName ().equals ("T3Channel" )) {
334
317
assert expectedValue .equals (networkAccessPoint .getPublicAddress ())
@@ -343,13 +326,12 @@ protected void verifyT3ChannelPublicAddress(String serverName, String expectedVa
343
326
*
344
327
* @param expectedValue - integer value to be checked in the public-port attribute in ServerMBean
345
328
* in ServerConfig tree
346
- * @param serverName - name of the weblogic server instance for which the t3 port to be checked as
347
- * a String
348
329
*/
349
- protected void verifyT3ChannelPublicPort (String serverName , int expectedValue ) {
330
+ protected void verifyT3ChannelPublicPort (int expectedValue ) {
350
331
boolean got = false ;
351
- ServerMBean serverMBean = getServerMBean (serverName );
332
+ ServerMBean serverMBean = getServerMBean ();
352
333
NetworkAccessPointMBean [] networkAccessPoints = serverMBean .getNetworkAccessPoints ();
334
+
353
335
for (NetworkAccessPointMBean networkAccessPoint : networkAccessPoints ) {
354
336
if (networkAccessPoint .getName ().equals ("T3Channel" )) {
355
337
assert expectedValue == networkAccessPoint .getPublicPort ()
@@ -361,10 +343,9 @@ protected void verifyT3ChannelPublicPort(String serverName, int expectedValue) {
361
343
/**
362
344
* Looks up the ServerMBean from RuntimeServiceMBean.
363
345
*
364
- * @param the name weblogic server instance for which to lookup the ServerMBean
365
346
* @return the ServerMBean reference
366
347
*/
367
- private ServerMBean getServerMBean (String serverName ) {
348
+ private ServerMBean getServerMBean () {
368
349
ServerMBean serverMBean = runtimeServiceMBean .getServerConfiguration ();
369
350
println ("ServerMBean: " + serverMBean );
370
351
@@ -601,7 +582,7 @@ protected WLDFSystemResourceMBean getWLDFSystemModule(String resourceName) {
601
582
return wldfResource ;
602
583
}
603
584
604
- private void connectToManagedServer (String serverName ) throws Exception {
585
+ private void connectToManagedServer (String serverName ) throws Exception {
605
586
ServerMBean [] servers = runtimeServiceMBean .getDomainConfiguration ().getServers ();
606
587
try {
607
588
for (ServerMBean server : servers ) {
0 commit comments