Search in sources :

Example 21 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class RegionManagementDUnitTest method awaitDistributedRegionMXBean.

private DistributedRegionMXBean awaitDistributedRegionMXBean(final String name, final int memberCount) {
    SystemManagementService service = getSystemManagementService_tmp();
    await().until(() -> assertThat(service.getDistributedRegionMXBean(name)).isNotNull());
    await().until(() -> assertThat(service.getDistributedRegionMXBean(name).getMemberCount()).isEqualTo(memberCount));
    return service.getDistributedRegionMXBean(name);
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService)

Example 22 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getMemberMbeanProxy.

/**
   * Utility Method to obtain MemberMXBean proxy reference for a particular Member
   * 
   * @param member
   * @return a reference to MemberMXBean
   * @throws Exception
   */
public static MemberMXBean getMemberMbeanProxy(DistributedMember member) throws Exception {
    MemberMXBean bean = null;
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName memberMBeanName = service.getMemberMBeanName(member);
    Wait.waitForCriterion(new WaitCriterion() {

        MemberMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            bean = service.getMBeanProxy(memberMBeanName, MemberMXBean.class);
            boolean done = bean != null;
            return done;
        }
    }, MAX_WAIT, 500, true);
    try {
        bean = service.getMBeanProxy(memberMBeanName, MemberMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :MemberMBean Proxy Should Not be Empty for : " + memberMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 23 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getLocatorMbeanProxy.

/**
   * Utility Method to obtain GatewayReceiverMXBean proxy reference for a member
   * 
   * @param member distributed member
   * @return a reference to GatewayReceiverMXBean
   * @throws Exception
   */
public static LocatorMXBean getLocatorMbeanProxy(DistributedMember member) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName locatorMBeanName = service.getLocatorMBeanName(member);
    Wait.waitForCriterion(new WaitCriterion() {

        LocatorMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    LocatorMXBean bean = null;
    try {
        bean = service.getMBeanProxy(locatorMBeanName, LocatorMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :Locator MBean Proxy Should Not be Empty for : " + locatorMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 24 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class MBeanUtil method getGatewayReceiverMbeanProxy.

/**
   * Utility Method to obtain GatewayReceiverMXBean proxy reference for a member
   * 
   * @param member distributed member
   * @return a reference to GatewayReceiverMXBean
   * @throws Exception
   */
public static GatewayReceiverMXBean getGatewayReceiverMbeanProxy(DistributedMember member) throws Exception {
    final SystemManagementService service = (SystemManagementService) ManagementTestBase.getManagementService();
    final ObjectName receiverMBeanName = service.getGatewayReceiverMBeanName(member);
    Wait.waitForCriterion(new WaitCriterion() {

        GatewayReceiverMXBean bean = null;

        public String description() {
            return "Waiting for the proxy to get reflected at managing node";
        }

        public boolean done() {
            GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
            bean = service.getMBeanProxy(receiverMBeanName, GatewayReceiverMXBean.class);
            boolean done = (bean != null);
            return done;
        }
    }, MAX_WAIT, 500, true);
    GatewayReceiverMXBean bean = null;
    try {
        bean = service.getMBeanProxy(receiverMBeanName, GatewayReceiverMXBean.class);
    } catch (ManagementException mgz) {
        if (bean == null) {
            InternalDistributedSystem.getLoggerI18n().fine("Undesired Result :GatewaySender MBean Proxy Should Not be Empty for : " + receiverMBeanName.getCanonicalName());
        }
    }
    return bean;
}
Also used : WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) GemFireCacheImpl(org.apache.geode.internal.cache.GemFireCacheImpl) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

Example 25 with SystemManagementService

use of org.apache.geode.management.internal.SystemManagementService in project geode by apache.

the class RegionManagementDUnitTest method awaitRegionMXBeanProxy.

private RegionMXBean awaitRegionMXBeanProxy(final DistributedMember member, final String name) {
    SystemManagementService service = getSystemManagementService_tmp();
    ObjectName objectName = service.getRegionMBeanName(member, name);
    String alias = "awaiting RegionMXBean proxy for " + member;
    await(alias).until(() -> assertThat(service.getMBeanProxy(objectName, RegionMXBean.class)).isNotNull());
    return service.getMBeanProxy(objectName, RegionMXBean.class);
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService) ObjectName(javax.management.ObjectName)

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