use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class WANManagementDUnitTest method checkSenderNavigationAPIS.
@SuppressWarnings("serial")
protected void checkSenderNavigationAPIS(final VM vm, final DistributedMember senderMember) {
SerializableRunnable checkNavigationAPIS = new SerializableRunnable("Check Sender Navigation APIs") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
ObjectName expectedName = service.getGatewaySenderMBeanName(senderMember, "pn");
try {
ObjectName actualName = bean.fetchGatewaySenderObjectName(senderMember.getId(), "pn");
assertEquals(expectedName, actualName);
} catch (Exception e) {
fail("Sender Navigation Failed " + e);
}
assertEquals(2, bean.listGatewaySenderObjectNames().length);
try {
assertEquals(1, bean.listGatewaySenderObjectNames(senderMember.getId()).length);
} catch (Exception e) {
fail("Sender Navigation Failed " + e);
}
}
};
vm.invoke(checkNavigationAPIS);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class TestRemoteClusterDUnitTest method checkReceiverMBean.
/**
* Checks whether a GatewayReceiverMBean is created or not
*
* @param vm reference to VM
*/
@SuppressWarnings("serial")
protected void checkReceiverMBean(final VM vm) {
SerializableRunnable checkMBean = new SerializableRunnable("Check Receiver MBean") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
GatewayReceiverMXBean bean = service.getLocalGatewayReceiverMXBean();
assertNotNull(bean);
}
};
vm.invoke(checkMBean);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class TestRemoteClusterDUnitTest method stopGatewaySender.
/**
* stops a gateway sender
*
* @param vm reference to VM
*/
@SuppressWarnings("serial")
protected void stopGatewaySender(final VM vm) {
SerializableRunnable stopGatewaySender = new SerializableRunnable("Stop Gateway Sender") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
GatewaySenderMXBean bean = service.getLocalGatewaySenderMXBean("pn");
assertNotNull(bean);
bean.stop();
assertFalse(bean.isRunning());
}
};
vm.invoke(stopGatewaySender);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CliUtilDUnitTest method setupMembersWithIdsAndGroups.
@SuppressWarnings("serial")
void setupMembersWithIdsAndGroups() {
final VM vm1 = Host.getHost(0).getVM(0);
final VM vm2 = Host.getHost(0).getVM(1);
final VM vm3 = Host.getHost(0).getVM(2);
final VM vm4 = Host.getHost(0).getVM(3);
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
createCacheWithMemberIdAndGroup(MEMBER_1_GROUP1, GROUP1);
createRegion(REGION_MEMBER1_GROUP1);
createRegion(COMMON_REGION_GROUP1);
createRegion(COMMON_REGION);
}
});
vm2.invoke(new SerializableRunnable() {
@Override
public void run() {
createCacheWithMemberIdAndGroup(MEMBER_2_GROUP1, GROUP1);
createRegion(REGION_MEMBER2_GROUP1);
createRegion(COMMON_REGION_GROUP1);
createRegion(COMMON_REGION);
}
});
vm3.invoke(new SerializableRunnable() {
@Override
public void run() {
createCacheWithMemberIdAndGroup(MEMBER_1_GROUP2, GROUP2);
createRegion(REGION_MEMBER1_GROUP2);
createRegion(COMMON_REGION_GROUP2);
createRegion(COMMON_REGION);
}
});
vm4.invoke(new SerializableRunnable() {
@Override
public void run() {
createCacheWithMemberIdAndGroup(MEMBER_2_GROUP2, GROUP2);
createRegion(REGION_MEMBER2_GROUP2);
createRegion(COMMON_REGION_GROUP2);
createRegion(COMMON_REGION);
}
});
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
startManager();
}
});
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class CliUtilDUnitTest method testCliUtilMethods.
@SuppressWarnings("serial")
@Test
public void testCliUtilMethods() {
setupMembersWithIdsAndGroups();
final VM vm1 = Host.getHost(0).getVM(0);
LogWriterUtils.getLogWriter().info("testFor - findMembersOrThrow");
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
verifyFindAllMatchingMembers();
}
});
final String id = (String) vm1.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
InternalCache cache = getCache();
return cache.getDistributedSystem().getDistributedMember().getId();
}
});
LogWriterUtils.getLogWriter().info("testFor - getDistributedMemberByNameOrId");
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
getDistributedMemberByNameOrId(MEMBER_1_GROUP1, id);
}
});
LogWriterUtils.getLogWriter().info("testFor - executeFunction");
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
verifyExecuteFunction();
}
});
LogWriterUtils.getLogWriter().info("testFor - getRegionAssociatedMembers");
vm1.invoke(new SerializableRunnable() {
@Override
public void run() {
getRegionAssociatedMembers();
}
});
}
Aggregations