use of org.apache.geode.management.ManagementService in project geode by apache.
the class TestServerDUnitTest method getNumOfServersFromMBean.
public static int getNumOfServersFromMBean() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.listCacheServers().length > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getDistributedSystemMXBean to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return bean.listCacheServers().length;
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class MBeanSecurityJUnitTest method testServerSideCalls.
@Test
@ConnectionConfiguration(user = "stranger", password = "1234567")
public void testServerSideCalls() {
// calls through ManagementService is not going through authorization checks
ManagementService service = ManagementService.getManagementService(server.getCache());
MemberMXBean bean = service.getMemberMXBean();
bean.compactAllDiskStores();
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class TestLocatorsDUnitTest method getNumOfLocatorFromMBean.
public static int getNumOfLocatorFromMBean() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.getLocatorCount() > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getNumOfLocatorFromMBean to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 2000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return bean.getLocatorCount();
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class TestSubscriptionsDUnitTest method verifyNumSubscriptions.
private void verifyNumSubscriptions(final VM vm) {
vm.invoke("TestSubscriptionsDUnitTest Verify Cache Server Remote", () -> {
final GemFireCacheImpl cache = GemFireCacheImpl.getInstance();
waitForCriterion(new WaitCriterion() {
@Override
public boolean done() {
ManagementService service = ManagementService.getExistingManagementService(cache);
DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
return distributedSystemMXBean != null & distributedSystemMXBean.getNumSubscriptions() > 1;
}
@Override
public String description() {
return "TestSubscriptionsDUnitTest wait for getDistributedSystemMXBean to complete and get results";
}
}, 2 * 60 * 1000, 3000, true);
DistributedSystemMXBean distributedSystemMXBean = ManagementService.getExistingManagementService(cache).getDistributedSystemMXBean();
assertNotNull(distributedSystemMXBean);
assertEquals(2, distributedSystemMXBean.getNumSubscriptions());
});
}
use of org.apache.geode.management.ManagementService 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);
}
Aggregations