use of org.apache.geode.distributed.DistributedMember in project geode by apache.
the class LocatorManagementDUnitTest method testPeerLocation.
/**
* When plan is to start Distributed System later so that the system can use this locator
*/
@Test
public void testPeerLocation() throws Exception {
int locPort = AvailablePortHelper.getRandomAvailableTCPPort();
startLocator(locator, locPort);
locatorMBeanExist(locator, locPort);
Host host = Host.getHost(0);
String host0 = getServerHostName(host);
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, host0 + "[" + locPort + "]");
props.setProperty(JMX_MANAGER, "true");
props.setProperty(JMX_MANAGER_START, "false");
props.setProperty(JMX_MANAGER_PORT, "0");
props.setProperty(JMX_MANAGER_HTTP_PORT, "0");
createCache(managingNode, props);
startManagingNode(managingNode);
DistributedMember locatorMember = getMember(locator);
remoteLocatorMBeanExist(managingNode, locatorMember);
}
use of org.apache.geode.distributed.DistributedMember in project geode by apache.
the class DistributedSystemDUnitTest method verifyDistributedSystemMXBean.
/**
* Check aggregate related functions and attributes
*/
private void verifyDistributedSystemMXBean(final VM managerVM) {
managerVM.invoke("verifyDistributedSystemMXBean", () -> {
ManagementService service = this.managementTestRule.getManagementService();
DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
await().until(() -> assertThat(distributedSystemMXBean.getMemberCount()).isEqualTo(5));
Set<DistributedMember> otherMemberSet = this.managementTestRule.getOtherNormalMembers();
for (DistributedMember member : otherMemberSet) {
// TODO: create some assertions (this used to just print JVMMetrics and OSMetrics)
}
});
}
use of org.apache.geode.distributed.DistributedMember in project geode by apache.
the class RegionManagementDUnitTest method verifyRemoteFixedPartitionRegion.
private void verifyRemoteFixedPartitionRegion(final VM managerVM) {
managerVM.invoke("Verify Partition region", () -> {
Set<DistributedMember> otherMemberSet = getOtherNormalMembers_tmp();
for (DistributedMember member : otherMemberSet) {
RegionMXBean bean = awaitRegionMXBeanProxy(member, FIXED_PR_PATH);
PartitionAttributesData data = bean.listPartitionAttributes();
assertThat(data).isNotNull();
FixedPartitionAttributesData[] fixedPrData = bean.listFixedPartitionAttributes();
assertThat(fixedPrData).isNotNull();
assertThat(fixedPrData).hasSize(3);
for (int i = 0; i < fixedPrData.length; i++) {
// TODO: add real assertions
// LogWriterUtils.getLogWriter().info("<ExpectedString> Remote PR Data is " +
// fixedPrData[i] + "</ExpectedString> ");
}
}
});
}
use of org.apache.geode.distributed.DistributedMember in project geode by apache.
the class GfshCommandJUnitTest method testGetMemberWithMatchingMemberId.
@Test
public void testGetMemberWithMatchingMemberId() {
final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
final DistributedSystem mockDistributedSystem = mockContext.mock(DistributedSystem.class, "DistributedSystem");
final DistributedMember mockMemberSelf = createMockMember("S", "Self");
final DistributedMember mockMemberOne = createMockMember("1", "One");
final DistributedMember mockMemberTwo = createMockMember("2", "Two");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getMembers();
will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
oneOf(mockCache).getDistributedSystem();
will(returnValue(mockDistributedSystem));
oneOf(mockDistributedSystem).getDistributedMember();
will(returnValue(mockMemberSelf));
}
});
final GfshCommand commands = createAbstractCommandsSupport(mockCache);
assertSame(mockMemberTwo, commands.getMember(mockCache, "2"));
}
use of org.apache.geode.distributed.DistributedMember in project geode by apache.
the class GfshCommandJUnitTest method createMockMember.
private DistributedMember createMockMember(final String memberId, final String memberName) {
final DistributedMember mockMember = mockContext.mock(DistributedMember.class, "DistributedMember " + memberId);
mockContext.checking(new Expectations() {
{
allowing(mockMember).getName();
will(returnValue(memberName));
allowing(mockMember).getId();
will(returnValue(memberId));
}
});
return mockMember;
}
Aggregations