use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class WANManagementDUnitTest method checkProxySender.
/**
* Checks Proxy GatewaySender
*
* @param vm reference to VM
*/
@SuppressWarnings("serial")
protected void checkProxySender(final VM vm, final DistributedMember senderMember) {
SerializableRunnable checkProxySender = new SerializableRunnable("Check Proxy Sender") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
GatewaySenderMXBean bean = null;
try {
bean = MBeanUtil.getGatewaySenderMbeanProxy(senderMember, "pn");
} catch (Exception e) {
fail("Could not obtain Sender Proxy in desired time " + e);
}
assertNotNull(bean);
final ObjectName senderMBeanName = service.getGatewaySenderMBeanName(senderMember, "pn");
try {
MBeanUtil.printBeanDetails(senderMBeanName);
} catch (Exception e) {
fail("Error while Printing Bean Details " + e);
}
if (service.isManager()) {
DistributedSystemMXBean dsBean = service.getDistributedSystemMXBean();
Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> {
Map<String, Boolean> dsMap = dsBean.viewRemoteClusterStatus();
dsMap.entrySet().stream().forEach(entry -> assertTrue("Should be true " + entry.getKey(), entry.getValue()));
});
}
}
};
vm.invoke(checkProxySender);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class WANManagementDUnitTest method checkProxyReceiver.
/**
* Checks Proxy GatewayReceiver
*
* @param vm reference to VM
*/
@SuppressWarnings("serial")
protected void checkProxyReceiver(final VM vm, final DistributedMember senderMember) {
SerializableRunnable checkProxySender = new SerializableRunnable("Check Proxy Receiver") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
GatewayReceiverMXBean bean = null;
try {
bean = MBeanUtil.getGatewayReceiverMbeanProxy(senderMember);
} catch (Exception e) {
fail("Could not obtain Sender Proxy in desired time " + e);
}
assertNotNull(bean);
final ObjectName receiverMBeanName = service.getGatewayReceiverMBeanName(senderMember);
try {
MBeanUtil.printBeanDetails(receiverMBeanName);
} catch (Exception e) {
fail("Error while Printing Bean Details " + e);
}
}
};
vm.invoke(checkProxySender);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class WANManagementDUnitTest 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 WANManagementDUnitTest method checkAsyncQueueMBean.
/**
* Checks whether a Async Queue MBean is created or not
*
* @param vm reference to VM
*/
@SuppressWarnings("serial")
protected void checkAsyncQueueMBean(final VM vm, final boolean shouldExist) {
SerializableRunnable checkAsyncQueueMBean = new SerializableRunnable("Check Async Queue MBean") {
public void run() {
Cache cache = GemFireCacheImpl.getInstance();
ManagementService service = ManagementService.getManagementService(cache);
AsyncEventQueueMXBean bean = service.getLocalAsyncEventQueueMXBean("pn");
if (shouldExist) {
assertNotNull(bean);
} else {
assertNull(bean);
}
}
};
vm.invoke(checkAsyncQueueMBean);
}
use of org.apache.geode.test.dunit.SerializableRunnable in project geode by apache.
the class DataCommandsOverHttpDistributedTest method setupTestRebalanceForEntireDS.
void setupTestRebalanceForEntireDS() {
final VM vm1 = Host.getHost(0).getVM(1);
final VM vm2 = Host.getHost(0).getVM(2);
setUpJmxManagerOnVm0ThenConnect(null);
vm1.invoke(new SerializableRunnable() {
public void run() {
// no need to close cache as it will be closed as part of teardown2
Cache cache = getCache();
RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
for (int i = 0; i < 10; i++) {
region.put("key" + (i + 200), "value" + (i + 200));
}
region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another1");
for (int i = 0; i < 100; i++) {
region.put("key" + (i + 200), "value" + (i + 200));
}
}
});
vm2.invoke(new SerializableRunnable() {
public void run() {
// no need to close cache as it will be closed as part of teardown2
Cache cache = getCache();
RegionFactory<Integer, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION);
Region region = dataRegionFactory.create(REBALANCE_REGION_NAME);
for (int i = 0; i < 100; i++) {
region.put("key" + (i + 400), "value" + (i + 400));
}
region = dataRegionFactory.create(REBALANCE_REGION_NAME + "Another2");
for (int i = 0; i < 10; i++) {
region.put("key" + (i + 200), "value" + (i + 200));
}
}
});
}
Aggregations