Search in sources :

Example 51 with DistributedMember

use of org.apache.geode.distributed.DistributedMember in project geode by apache.

the class CacheManagementDUnitTest method verifyConfigData.

private Map<DistributedMember, DistributionConfig> verifyConfigData() {
    ManagementService service = this.managementTestRule.getManagementService();
    InternalDistributedSystem ids = (InternalDistributedSystem) this.managementTestRule.getCache().getDistributedSystem();
    DistributionConfig config = ids.getConfig();
    MemberMXBean bean = service.getMemberMXBean();
    GemFireProperties data = bean.listGemFireProperties();
    verifyGemFirePropertiesData(config, data);
    Map<DistributedMember, DistributionConfig> configMap = new HashMap<>();
    configMap.put(ids.getDistributedMember(), config);
    return configMap;
}
Also used : DistributionConfig(org.apache.geode.distributed.internal.DistributionConfig) SystemManagementService(org.apache.geode.management.internal.SystemManagementService) HashMap(java.util.HashMap) DistributedMember(org.apache.geode.distributed.DistributedMember) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem)

Example 52 with DistributedMember

use of org.apache.geode.distributed.DistributedMember in project geode by apache.

the class CacheManagementDUnitTest method verifyQueryMBeans.

private void verifyQueryMBeans(final VM managerVM) {
    managerVM.invoke("validateQueryMBeans", () -> {
        ManagementService service = this.managementTestRule.getManagementService();
        Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
        Set<ObjectName> superSet = new HashSet<>();
        for (DistributedMember member : otherMembers) {
            ObjectName memberMBeanName = service.getMemberMBeanName(member);
            awaitMemberMXBeanProxy(member);
            Set<ObjectName> objectNames = service.queryMBeanNames(member);
            superSet.addAll(objectNames);
            assertThat(objectNames.contains(memberMBeanName)).isTrue();
        }
        Set<ObjectName> names = service.queryMBeanNames(this.managementTestRule.getDistributedMember());
        ObjectName[] arrayOfNames = names.toArray(new ObjectName[names.size()]);
        // TODO: what value does this assertion
        assertThat(superSet).doesNotContain(arrayOfNames);
    // have?
    });
}
Also used : SystemManagementService(org.apache.geode.management.internal.SystemManagementService) DistributedMember(org.apache.geode.distributed.DistributedMember) HashSet(java.util.HashSet) ObjectName(javax.management.ObjectName)

Example 53 with DistributedMember

use of org.apache.geode.distributed.DistributedMember in project geode by apache.

the class CacheManagementDUnitTest method testManager.

/**
   * Creates and starts a managerVM. Multiple Managers
   */
@Test
public void testManager() throws Exception {
    this.managementTestRule.createMember(this.memberVMs[0]);
    this.managementTestRule.createMember(this.memberVMs[1]);
    this.managementTestRule.createManager(this.memberVMs[2], false);
    this.managementTestRule.createManager(this.managerVM, false);
    this.memberVMs[2].invoke(() -> startManager());
    // Now start Managing node managerVM. System will have two Managers now which
    // should be OK
    DistributedMember member = this.managementTestRule.getDistributedMember(this.memberVMs[2]);
    this.managementTestRule.startManager(this.managerVM);
    verifyManagerStarted(this.managerVM, member);
    this.managementTestRule.stopManager(this.managerVM);
}
Also used : DistributedMember(org.apache.geode.distributed.DistributedMember) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 54 with DistributedMember

use of org.apache.geode.distributed.DistributedMember in project geode by apache.

the class CacheManagementDUnitTest method verifyConfigDataRemote.

/**
   * This is to check whether the config data has been propagated to the Managing node properly or
   * not.
   */
private void verifyConfigDataRemote(final Map<DistributedMember, DistributionConfig> configMap) {
    Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
    for (DistributedMember member : otherMembers) {
        MemberMXBean memberMXBean = awaitMemberMXBeanProxy(member);
        GemFireProperties data = memberMXBean.listGemFireProperties();
        DistributionConfig config = configMap.get(member);
        verifyGemFirePropertiesData(config, data);
    }
}
Also used : DistributionConfig(org.apache.geode.distributed.internal.DistributionConfig) DistributedMember(org.apache.geode.distributed.DistributedMember)

Example 55 with DistributedMember

use of org.apache.geode.distributed.DistributedMember in project geode by apache.

the class CacheManagementDUnitTest method verifyNotificationsAndRegionSize.

private void verifyNotificationsAndRegionSize(final VM memberVM1, final VM memberVM2, final VM memberVM3, final VM managerVM) {
    DistributedMember member1 = this.managementTestRule.getDistributedMember(memberVM1);
    DistributedMember member2 = this.managementTestRule.getDistributedMember(memberVM2);
    DistributedMember member3 = this.managementTestRule.getDistributedMember(memberVM3);
    String memberId1 = MBeanJMXAdapter.getUniqueIDForMember(member1);
    String memberId2 = MBeanJMXAdapter.getUniqueIDForMember(member2);
    String memberId3 = MBeanJMXAdapter.getUniqueIDForMember(member3);
    memberVM1.invoke("createNotificationRegion", () -> createNotificationRegion(memberId1));
    memberVM2.invoke("createNotificationRegion", () -> createNotificationRegion(memberId2));
    memberVM3.invoke("createNotificationRegion", () -> createNotificationRegion(memberId3));
    managerVM.invoke("verify notifications size", () -> {
        await().until(() -> assertThat(notifications.size()).isEqualTo(45));
        Cache cache = this.managementTestRule.getCache();
        Region region1 = cache.getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId1);
        Region region2 = cache.getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId2);
        Region region3 = cache.getRegion(ManagementConstants.NOTIFICATION_REGION + "_" + memberId3);
        // Even though we got 15 notification only 10 should be there due to
        // eviction attributes set in notification region
        await().until(() -> assertThat(region1).hasSize(10));
        await().until(() -> assertThat(region2).hasSize(10));
        await().until(() -> assertThat(region3).hasSize(10));
    });
}
Also used : DistributedMember(org.apache.geode.distributed.DistributedMember) Region(org.apache.geode.cache.Region) Cache(org.apache.geode.cache.Cache)

Aggregations

DistributedMember (org.apache.geode.distributed.DistributedMember)360 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)120 Test (org.junit.Test)109 HashSet (java.util.HashSet)83 InternalCache (org.apache.geode.internal.cache.InternalCache)83 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)82 ArrayList (java.util.ArrayList)64 VM (org.apache.geode.test.dunit.VM)60 CliCommand (org.springframework.shell.core.annotation.CliCommand)59 CliMetaData (org.apache.geode.management.cli.CliMetaData)57 Result (org.apache.geode.management.cli.Result)56 Set (java.util.Set)49 ResourceOperation (org.apache.geode.management.internal.security.ResourceOperation)49 List (java.util.List)48 Cache (org.apache.geode.cache.Cache)47 Region (org.apache.geode.cache.Region)42 HashMap (java.util.HashMap)39 CliFunctionResult (org.apache.geode.management.internal.cli.functions.CliFunctionResult)39 TabularResultData (org.apache.geode.management.internal.cli.result.TabularResultData)39 FunctionException (org.apache.geode.cache.execute.FunctionException)37