use of org.apache.geode.cache.Cache in project geode by apache.
the class RebalanceDUnitTest method putEntryInEachBucket.
// Duplicated for now, try to abstract this out...
protected void putEntryInEachBucket() {
accessor.invoke(() -> {
final Cache cache = getCache();
Region<Object, Object> region = cache.getRegion(REGION_NAME);
IntStream.range(0, NUM_BUCKETS).forEach(i -> region.put(i, new TestObject("hello world")));
});
}
use of org.apache.geode.cache.Cache 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.cache.Cache 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.cache.Cache 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.cache.Cache 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);
}
Aggregations