Search in sources :

Example 1 with ManagementService

use of org.apache.geode.management.ManagementService in project geode by apache.

the class TestCQDUnitTest method getNumOfCQ.

public static long getNumOfCQ() {
    final WaitCriterion waitCriteria = new WaitCriterion() {

        @Override
        public boolean done() {
            final ManagementService service = getManagementService();
            final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
            if (bean != null) {
                if (bean.getActiveCQCount() > 0) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String description() {
            return "wait for getNumOfCQ to complete and get results";
        }
    };
    Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
    final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
    assertNotNull(bean);
    return bean.getActiveCQCount();
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) ManagementService(org.apache.geode.management.ManagementService)

Example 2 with ManagementService

use of org.apache.geode.management.ManagementService in project geode by apache.

the class TestClientsDUnitTest method getNumOfClients.

public static Integer getNumOfClients() {
    final WaitCriterion waitCriteria = new WaitCriterion() {

        @Override
        public boolean done() {
            final ManagementService service = getManagementService();
            final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
            if (bean != null) {
                if (bean.getNumClients() > 0) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String description() {
            return "wait for getNumOfClients bean to complete and get results";
        }
    };
    Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
    final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
    assertNotNull(bean);
    return Integer.valueOf(bean.getNumClients());
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) ManagementService(org.apache.geode.management.ManagementService)

Example 3 with ManagementService

use of org.apache.geode.management.ManagementService in project geode by apache.

the class TestServerDUnitTest method getNumOfServersFromMBean.

public static int getNumOfServersFromMBean() {
    final WaitCriterion waitCriteria = new WaitCriterion() {

        @Override
        public boolean done() {
            final ManagementService service = getManagementService();
            final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
            if (bean != null) {
                if (bean.listCacheServers().length > 0) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String description() {
            return "wait for getDistributedSystemMXBean to complete and get results";
        }
    };
    Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
    final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
    assertNotNull(bean);
    return bean.listCacheServers().length;
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) ManagementService(org.apache.geode.management.ManagementService)

Example 4 with ManagementService

use of org.apache.geode.management.ManagementService in project geode by apache.

the class MBeanSecurityJUnitTest method testServerSideCalls.

@Test
@ConnectionConfiguration(user = "stranger", password = "1234567")
public void testServerSideCalls() {
    // calls through ManagementService is not going through authorization checks
    ManagementService service = ManagementService.getManagementService(server.getCache());
    MemberMXBean bean = service.getMemberMXBean();
    bean.compactAllDiskStores();
}
Also used : ManagementService(org.apache.geode.management.ManagementService) MemberMXBean(org.apache.geode.management.MemberMXBean) ConnectionConfiguration(org.apache.geode.test.dunit.rules.ConnectionConfiguration) SecurityTest(org.apache.geode.test.junit.categories.SecurityTest) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 5 with ManagementService

use of org.apache.geode.management.ManagementService in project geode by apache.

the class TestLocatorsDUnitTest method getNumOfLocatorFromMBean.

public static int getNumOfLocatorFromMBean() {
    final WaitCriterion waitCriteria = new WaitCriterion() {

        @Override
        public boolean done() {
            final ManagementService service = getManagementService();
            final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
            if (bean != null) {
                if (bean.getLocatorCount() > 0) {
                    return true;
                }
            }
            return false;
        }

        @Override
        public String description() {
            return "wait for getNumOfLocatorFromMBean to complete and get results";
        }
    };
    Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 2000, true);
    final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
    assertNotNull(bean);
    return bean.getLocatorCount();
}
Also used : DistributedSystemMXBean(org.apache.geode.management.DistributedSystemMXBean) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) ManagementService(org.apache.geode.management.ManagementService)

Aggregations

ManagementService (org.apache.geode.management.ManagementService)36 DistributedSystemMXBean (org.apache.geode.management.DistributedSystemMXBean)15 WaitCriterion (org.apache.geode.test.dunit.WaitCriterion)11 Cache (org.apache.geode.cache.Cache)8 InternalCache (org.apache.geode.internal.cache.InternalCache)8 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)8 DistributedRegionMXBean (org.apache.geode.management.DistributedRegionMXBean)7 DistributedMember (org.apache.geode.distributed.DistributedMember)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)4 ObjectName (javax.management.ObjectName)4 CompositeResultData (org.apache.geode.management.internal.cli.result.CompositeResultData)4 SectionResultData (org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData)4 VM (org.apache.geode.test.dunit.VM)4 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)4 HashSet (java.util.HashSet)3 List (java.util.List)3 Entry (java.util.Map.Entry)3 Properties (java.util.Properties)3 MalformedObjectNameException (javax.management.MalformedObjectNameException)3