use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class ClientCommandsDUnitTest method setupSystem3.
private void setupSystem3() throws Exception {
disconnectAllFromDS();
setUpJmxManagerOnVm0ThenConnect(getServerProperties());
final VM manager = Host.getHost(0).getVM(0);
final VM server1 = Host.getHost(0).getVM(1);
final VM client1 = Host.getHost(0).getVM(2);
final VM server2 = Host.getHost(0).getVM(3);
port0 = startCacheServer(server1, 0, false, regionName);
port1 = startCacheServer(server2, 0, false, regionName);
startNonDurableClient(client1, server1, port0);
startNonDurableClient(client1, server2, port1);
setupCqsOnVM(client1);
waitForListClientMbean3();
clientId = (String) manager.invoke("get client Id", () -> {
Cache cache = GemFireCacheImpl.getInstance();
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
DistributedMember serverMember = getMember(server1);
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0, serverMember);
CacheServerMXBean bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
return bean.getClientIds()[0];
});
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class CacheServerManagementDUnitTest method testBug46049.
/**
* Intention of this test is to check if a node becomes manager after all the nodes are alive it
* should have all the information of all the members.
* <p>
* Thats why used service.getLocalManager().runManagementTaskAdhoc() to make node ready for
* federation when manager node comes up
*
* @throws Exception
*/
// renable when bug 46138
@Ignore("Bug46049")
@Test
public void testBug46049() throws Exception {
final Host host = Host.getHost(0);
VM locator = host.getVM(0);
VM server = host.getVM(1);
// Step 1:
final int locatorPort = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
locator.invoke("Start Locator", () -> startLocator(locator.getHost(), locatorPort, ""));
String locators = NetworkUtils.getServerHostName(locator.getHost()) + "[" + locatorPort + "]";
// Step 2:
server.invoke("Start BridgeServer", () -> startBridgeServer(null, locators));
// Step 3:
server.invoke("Check Server", () -> {
Cache cache = GemFireCacheImpl.getInstance();
assertNotNull(cache);
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
assertNotNull(service);
assertFalse(service.isManager());
assertNotNull(service.getMemberMXBean());
service.getLocalManager().runManagementTaskAdhoc();
});
// Step 4:
JmxManagerLocatorRequest.send(locator.getHost().getHostName(), locatorPort, CONNECT_LOCATOR_TIMEOUT_MS, Collections.<String, String>emptyMap());
// Step 5:
locator.invoke("Check locator", () -> {
Cache cache = GemFireCacheImpl.getInstance();
assertNotNull(cache);
ManagementService service = ManagementService.getExistingManagementService(cache);
assertNotNull(service);
assertTrue(service.isManager());
LocatorMXBean bean = service.getLocalLocatorMXBean();
assertEquals(locatorPort, bean.getPort());
DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
assertEquals(2, dsBean.listMemberObjectNames().length);
});
helper.closeCache(locator);
helper.closeCache(server);
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class ClientCommandsDUnitTest method setupSystem.
private void setupSystem() throws Exception {
disconnectAllFromDS();
setUpJmxManagerOnVm0ThenConnect(getServerProperties());
final VM manager = Host.getHost(0).getVM(0);
final VM server1 = Host.getHost(0).getVM(1);
final VM client1 = Host.getHost(0).getVM(2);
final VM server2 = Host.getHost(0).getVM(3);
port0 = startCacheServer(server1, 0, false, regionName);
startCacheServer(server2, 0, false, regionName);
startNonDurableClient(client1, server1, port0);
setupCqsOnVM(client1);
waitForMbean();
clientId = (String) manager.invoke("get client Id", () -> {
Cache cache = GemFireCacheImpl.getInstance();
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
DistributedMember serverMember = getMember(server1);
final ObjectName cacheServerMBeanName = service.getCacheServerMBeanName(port0, serverMember);
CacheServerMXBean bean = service.getMBeanProxy(cacheServerMBeanName, CacheServerMXBean.class);
return bean.getClientIds()[0];
});
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class DistributedSystemStatsJUnitTest method testIssue51048.
@Test
public void testIssue51048() throws InterruptedException {
SystemManagementService service = (SystemManagementService) ManagementService.getExistingManagementService(cache);
DistributedSystemMXBean dsmbean = service.getDistributedSystemMXBean();
CachePerfStats cachePerfStats = ((GemFireCacheImpl) cache).getCachePerfStats();
for (int i = 1; i <= 10; i++) {
cachePerfStats.incCreates();
}
sample();
service.getLocalManager().runManagementTaskAdhoc();
assertTrue(dsmbean.getAverageWrites() == 10);
sample();
service.getLocalManager().runManagementTaskAdhoc();
assertTrue(dsmbean.getAverageWrites() == 0);
}
use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.
the class DistributedSystemStatsDUnitTest method awaitMemberMXBeanProxy.
private MemberMXBean awaitMemberMXBeanProxy(final DistributedMember member) {
SystemManagementService service = this.managementTestRule.getSystemManagementService();
ObjectName objectName = service.getMemberMBeanName(member);
String alias = "Awaiting MemberMXBean proxy for " + member;
await(alias).until(() -> assertThat(service.getMBeanProxy(objectName, MemberMXBean.class)).isNotNull());
return service.getMBeanProxy(objectName, MemberMXBean.class);
}
Aggregations