Search in sources :

Example 6 with SystemManagementService

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];
    });
}
Also used : VM(org.apache.geode.test.dunit.VM) DistributedMember(org.apache.geode.distributed.DistributedMember) CacheServerMXBean(org.apache.geode.management.CacheServerMXBean) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 7 with SystemManagementService

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);
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) Cache(org.apache.geode.cache.Cache) Ignore(org.junit.Ignore) CqQueryDUnitTest(org.apache.geode.cache.query.cq.dunit.CqQueryDUnitTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 8 with SystemManagementService

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];
    });
}
Also used : VM(org.apache.geode.test.dunit.VM) DistributedMember(org.apache.geode.distributed.DistributedMember) CacheServerMXBean(org.apache.geode.management.CacheServerMXBean) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 9 with SystemManagementService

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);
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) CachePerfStats(org.apache.geode.internal.cache.CachePerfStats) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 10 with SystemManagementService

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);
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName) MemberMXBean(org.apache.geode.management.MemberMXBean)

Aggregations

SystemManagementService (org.apache.geode.management.internal.SystemManagementService)83 ObjectName (javax.management.ObjectName)56 DistributedMember (org.apache.geode.distributed.DistributedMember)31 CacheServerMXBean (org.apache.geode.management.CacheServerMXBean)15 InternalCache (org.apache.geode.internal.cache.InternalCache)14 VM (org.apache.geode.test.dunit.VM)14 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)13 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)12 ExecutionException (java.util.concurrent.ExecutionException)11 CliMetaData (org.apache.geode.management.cli.CliMetaData)11 Result (org.apache.geode.management.cli.Result)11 CommandResultException (org.apache.geode.management.internal.cli.result.CommandResultException)11 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)11 CliCommand (org.springframework.shell.core.annotation.CliCommand)11 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)10 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)8 Test (org.junit.Test)8 GatewaySenderMXBean (org.apache.geode.management.GatewaySenderMXBean)7 CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)7 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)7