Skip to content

Commit 8634b2e

Browse files
committed
revert to use runtimeservicembean
1 parent b960230 commit 8634b2e

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

integration-tests/src/test/resources/sitconfig/configoverrides/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</d:network-access-point>
1616
</d:server>
1717
<d:server-template>
18-
<d:name>DockerCluster-template</d:name>
18+
<d:name>cluster-1-template</d:name>
1919
<d:max-message-size f:combine-mode="add">77777777</d:max-message-size>
2020
</d:server-template>
2121
</d:domain>

integration-tests/src/test/resources/sitconfig/java/SitConfigTests.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@
3737
import weblogic.management.configuration.ServerMBean;
3838
import weblogic.management.configuration.WLDFSystemResourceMBean;
3939
import weblogic.management.jmx.MBeanServerInvocationHandler;
40-
import weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean;
4140
import weblogic.management.mbeanservers.edit.ConfigurationManagerMBean;
42-
import weblogic.management.mbeanservers.edit.EditServiceMBean;
4341
import weblogic.management.mbeanservers.runtime.RuntimeServiceMBean;
4442
import weblogic.management.runtime.ServerRuntimeMBean;
4543

@@ -65,17 +63,15 @@ public class SitConfigTests {
6563

6664
private MBeanServerConnection runtimeMbs;
6765
private MBeanServerConnection editMbs;
68-
private DomainMBean domainMBean = null;
69-
private EditServiceMBean editServiceMBean = null;
7066
private ConfigurationManagerMBean cfgMgr;
7167
private JMXConnector jmxConnector;
7268
private static ObjectName service;
7369
private RuntimeServiceMBean runtimeServiceMBean;
7470
private ServerRuntimeMBean serverRuntime;
7571
private static final String JNDI = "/jndi/";
7672

77-
private final String adminHost;
78-
private final String adminPort;
73+
private String adminHost;
74+
private String adminPort;
7975
private final String adminUser;
8076
private final String adminPassword;
8177
private final String serverName;
@@ -121,6 +117,7 @@ public static void main(String args[]) throws Exception {
121117
if (testName.equals("testCustomSitConfigOverridesForDomainMS")) {
122118
// the values passed to these verify methods are the attribute values overrrideen in the
123119
// config.xml. These are just randomly chosen attributes and values to override
120+
test.connectToManagedServer(serverName);
124121
test.verifyMaxMessageSize(serverName, 77777777);
125122
}
126123

@@ -179,16 +176,6 @@ private void createConnections() throws Exception {
179176
runtimeServiceMBean =
180177
(RuntimeServiceMBean)
181178
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);
192179
}
193180

194181
/**
@@ -378,8 +365,10 @@ protected void verifyT3ChannelPublicPort(String serverName, int expectedValue) {
378365
* @return the ServerMBean reference
379366
*/
380367
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;
383372
}
384373

385374
/**
@@ -612,6 +601,21 @@ protected WLDFSystemResourceMBean getWLDFSystemModule(String resourceName) {
612601
return wldfResource;
613602
}
614603

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+
615619
/**
616620
* Prints message in standard out. Short name method to System.out.println.
617621
*

0 commit comments

Comments
 (0)