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 .domainruntime .DomainRuntimeServiceMBean ;
41
40
import weblogic .management .mbeanservers .edit .ConfigurationManagerMBean ;
42
- import weblogic .management .mbeanservers .edit .EditServiceMBean ;
43
41
import weblogic .management .mbeanservers .runtime .RuntimeServiceMBean ;
44
42
import weblogic .management .runtime .ServerRuntimeMBean ;
45
43
@@ -65,17 +63,15 @@ public class SitConfigTests {
65
63
66
64
private MBeanServerConnection runtimeMbs ;
67
65
private MBeanServerConnection editMbs ;
68
- private DomainMBean domainMBean = null ;
69
- private EditServiceMBean editServiceMBean = null ;
70
66
private ConfigurationManagerMBean cfgMgr ;
71
67
private JMXConnector jmxConnector ;
72
68
private static ObjectName service ;
73
69
private RuntimeServiceMBean runtimeServiceMBean ;
74
70
private ServerRuntimeMBean serverRuntime ;
75
71
private static final String JNDI = "/jndi/" ;
76
72
77
- private final String adminHost ;
78
- private final String adminPort ;
73
+ private String adminHost ;
74
+ private String adminPort ;
79
75
private final String adminUser ;
80
76
private final String adminPassword ;
81
77
private final String serverName ;
@@ -121,6 +117,7 @@ public static void main(String args[]) throws Exception {
121
117
if (testName .equals ("testCustomSitConfigOverridesForDomainMS" )) {
122
118
// the values passed to these verify methods are the attribute values overrrideen in the
123
119
// config.xml. These are just randomly chosen attributes and values to override
120
+ test .connectToManagedServer (serverName );
124
121
test .verifyMaxMessageSize (serverName , 77777777 );
125
122
}
126
123
@@ -179,16 +176,6 @@ private void createConnections() throws Exception {
179
176
runtimeServiceMBean =
180
177
(RuntimeServiceMBean )
181
178
MBeanServerInvocationHandler .newProxyInstance (runtimeMbs , runtimeserviceObjectName );
182
- ObjectName domainServiceObjectName = new ObjectName (DomainRuntimeServiceMBean .OBJECT_NAME );
183
- editMbs =
184
- lookupMBeanServerConnection (
185
- adminHost , adminPort , adminUser , adminPassword , EditServiceMBean .MBEANSERVER_JNDI_NAME );
186
- ObjectName serviceObjectName = new ObjectName (EditServiceMBean .OBJECT_NAME );
187
- editServiceMBean =
188
- (EditServiceMBean )
189
- MBeanServerInvocationHandler .newProxyInstance (editMbs , serviceObjectName );
190
- cfgMgr = editServiceMBean .getConfigurationManager ();
191
- cfgMgr .startEdit (-1 , -1 );
192
179
}
193
180
194
181
/**
@@ -378,8 +365,10 @@ protected void verifyT3ChannelPublicPort(String serverName, int expectedValue) {
378
365
* @return the ServerMBean reference
379
366
*/
380
367
private ServerMBean getServerMBean (String serverName ) {
381
- DomainMBean editDomainMBean = editServiceMBean .getDomainConfiguration ();
382
- return editDomainMBean .lookupServer (serverName );
368
+ ServerMBean serverMBean = runtimeServiceMBean .getServerConfiguration ();
369
+ println ("ServerMBean: " + serverMBean );
370
+
371
+ return serverMBean ;
383
372
}
384
373
385
374
/**
@@ -612,6 +601,21 @@ protected WLDFSystemResourceMBean getWLDFSystemModule(String resourceName) {
612
601
return wldfResource ;
613
602
}
614
603
604
+ private void connectToManagedServer (String serverName ) throws Exception {
605
+ ServerMBean [] servers = runtimeServiceMBean .getDomainConfiguration ().getServers ();
606
+ try {
607
+ for (ServerMBean server : servers ) {
608
+ if (server .getName ().equals (serverName )) {
609
+ adminHost = server .getListenAddress ();
610
+ adminPort = String .valueOf (server .getListenPort ());
611
+ }
612
+ }
613
+ } finally {
614
+ jmxConnector .close ();
615
+ createConnections ();
616
+ }
617
+ }
618
+
615
619
/**
616
620
* Prints message in standard out. Short name method to System.out.println.
617
621
*
0 commit comments