Search in sources :

Example 46 with SystemManagementService

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

the class QueryDataDUnitTest 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)

Example 47 with SystemManagementService

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

the class QueryDataDUnitTest method awaitDistributedRegionMXBean.

private DistributedRegionMXBean awaitDistributedRegionMXBean(final String name) {
    SystemManagementService service = this.managementTestRule.getSystemManagementService();
    await().until(() -> assertThat(service.getDistributedRegionMXBean(name)).isNotNull());
    return service.getDistributedRegionMXBean(name);
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService)

Example 48 with SystemManagementService

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

the class RegionManagementDUnitTest method createLocalRegion_tmp.

private void createLocalRegion_tmp(final VM vm, final String localRegionName) {
    vm.invoke("Create Local region", () -> {
        SystemManagementService service = getSystemManagementService_tmp();
        RegionFactory regionFactory = getCache_tmp().createRegionFactory(RegionShortcut.LOCAL);
        regionFactory.create(localRegionName);
    });
}
Also used : RegionFactory(org.apache.geode.cache.RegionFactory) SystemManagementService(org.apache.geode.management.internal.SystemManagementService)

Example 49 with SystemManagementService

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

the class RegionManagementDUnitTest method addMemberNotificationListener.

private void addMemberNotificationListener(final VM managerVM, final int expectedMembers) {
    managerVM.invoke("addMemberNotificationListener", () -> {
        Set<DistributedMember> otherMemberSet = getOtherNormalMembers_tmp();
        assertThat(otherMemberSet).hasSize(expectedMembers);
        SystemManagementService service = getSystemManagementService_tmp();
        List<Notification> notifications = new ArrayList<>();
        MEMBER_NOTIFICATIONS_REF.set(notifications);
        for (DistributedMember member : otherMemberSet) {
            MemberNotificationListener listener = new MemberNotificationListener(notifications);
            ObjectName objectName = service.getMemberMBeanName(member);
            awaitMemberMXBeanProxy(objectName);
            getPlatformMBeanServer().addNotificationListener(objectName, listener, null, null);
        }
    });
}
Also used : DistributedMember(org.apache.geode.distributed.DistributedMember) ArrayList(java.util.ArrayList) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) Notification(javax.management.Notification) ObjectName(javax.management.ObjectName)

Example 50 with SystemManagementService

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

the class RegionManagementDUnitTest method createFixedPartitionRegion.

/**
   * Invoked in member VMs
   */
private void createFixedPartitionRegion(final List<FixedPartitionAttributes> fixedPartitionAttributesList) {
    SystemManagementService service = getSystemManagementService_tmp();
    PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
    partitionAttributesFactory.setRedundantCopies(2).setTotalNumBuckets(12);
    for (FixedPartitionAttributes fixedPartitionAttributes : fixedPartitionAttributesList) {
        partitionAttributesFactory.addFixedPartitionAttributes(fixedPartitionAttributes);
    }
    partitionAttributesFactory.setPartitionResolver(new SingleHopQuarterPartitionResolver());
    AttributesFactory attributesFactory = new AttributesFactory();
    attributesFactory.setPartitionAttributes(partitionAttributesFactory.create());
    fixedPartitionedRegion = getCache_tmp().createRegion(FIXED_PR_NAME, attributesFactory.create());
    assertThat(fixedPartitionedRegion).isNotNull();
    RegionMXBean regionMXBean = service.getLocalRegionMBean(FIXED_PR_PATH);
    RegionAttributes regionAttributes = fixedPartitionedRegion.getAttributes();
    PartitionAttributesData partitionAttributesData = regionMXBean.listPartitionAttributes();
    verifyPartitionData(regionAttributes, partitionAttributesData);
    FixedPartitionAttributesData[] fixedPartitionAttributesData = regionMXBean.listFixedPartitionAttributes();
    assertThat(fixedPartitionAttributesData).isNotNull();
    assertThat(fixedPartitionAttributesData).hasSize(3);
    for (int i = 0; i < fixedPartitionAttributesData.length; i++) {
    // TODO: add real assertions
    // LogWriterUtils.getLogWriter().info("<ExpectedString> Fixed PR Data is " +
    // fixedPartitionAttributesData[i] + "</ExpectedString> ");
    }
}
Also used : PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) FixedPartitionAttributes(org.apache.geode.cache.FixedPartitionAttributes) AttributesFactory(org.apache.geode.cache.AttributesFactory) PartitionAttributesFactory(org.apache.geode.cache.PartitionAttributesFactory) RegionAttributes(org.apache.geode.cache.RegionAttributes) SingleHopQuarterPartitionResolver(org.apache.geode.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver) SystemManagementService(org.apache.geode.management.internal.SystemManagementService)

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