use of org.apache.geode.management.ManagementService in project geode by apache.
the class GemfireDataCommandsDUnitTest method doTestSelectProjectionProcessCommand.
public void doTestSelectProjectionProcessCommand() {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(new SerializableRunnable() {
@Override
public void run() {
Random random = new Random(System.nanoTime());
int randomInteger = random.nextInt(COUNT);
String query = "query --query=\"select ID , status , createTime , pk, floatMinValue from " + DATA_PAR_REGION_NAME_PATH + " where ID <= " + randomInteger + "\" --interactive=false";
ManagementService service = ManagementService.getExistingManagementService(getCache());
MemberMXBean member = service.getMemberMXBean();
String cmdResult = member.processCommand(query);
assertNotNull(cmdResult);
getLogWriter().info("Text Command Output : " + cmdResult);
}
});
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class GemfireDataCommandsDUnitTest method waitForListClientMbean.
public void waitForListClientMbean(final String regionName) {
final VM manager = Host.getHost(0).getVM(0);
manager.invoke(new SerializableRunnable() {
@Override
public void run() {
Cache cache = getCache();
final ManagementService service = ManagementService.getManagementService(cache);
final WaitCriterion waitForMaangerMBean = new WaitCriterion() {
@Override
public boolean done() {
ManagerMXBean bean1 = service.getManagerMXBean();
DistributedRegionMXBean bean2 = service.getDistributedRegionMXBean(regionName);
if (bean1 == null) {
getLogWriter().info("waitForListClientMbean Still probing for ManagerMBean");
return false;
} else {
getLogWriter().info("waitForListClientMbean Still probing for DistributedRegionMXBean=" + bean2);
if (bean2 == null) {
bean2 = service.getDistributedRegionMXBean(Region.SEPARATOR + regionName);
}
if (bean2 == null) {
getLogWriter().info("waitForListClientMbean Still probing for DistributedRegionMXBean with separator = " + bean2);
return false;
} else {
getLogWriter().info("waitForListClientMbean Still probing for DistributedRegionMXBean with separator Not null " + bean2.getMembers().length);
return bean2.getMembers().length > 1;
}
}
}
@Override
public String description() {
return "waitForListClientMbean Probing for ManagerMBean";
}
};
waitForCriterion(waitForMaangerMBean, 30000, 2000, true);
DistributedRegionMXBean bean = service.getDistributedRegionMXBean(regionName);
if (bean == null) {
bean = service.getDistributedRegionMXBean(Region.SEPARATOR + regionName);
}
assertNotNull(bean);
}
});
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class SecurityManagerCallbacksDistributedTest method verifyCallbacksRegardlessOfManager.
private void verifyCallbacksRegardlessOfManager(final boolean isManager) {
ManagementService ms = getExistingManagementService(getCache());
assertThat(ms).isNotNull();
assertThat(ms.isManager()).isEqualTo(isManager);
verifyInitAndCloseInvoked();
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class TestCQDUnitTest method getNumOfCQ.
public static long getNumOfCQ() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.getActiveCQCount() > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getNumOfCQ to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return bean.getActiveCQCount();
}
use of org.apache.geode.management.ManagementService in project geode by apache.
the class TestClientsDUnitTest method getNumOfClients.
public static Integer getNumOfClients() {
final WaitCriterion waitCriteria = new WaitCriterion() {
@Override
public boolean done() {
final ManagementService service = getManagementService();
final DistributedSystemMXBean bean = service.getDistributedSystemMXBean();
if (bean != null) {
if (bean.getNumClients() > 0) {
return true;
}
}
return false;
}
@Override
public String description() {
return "wait for getNumOfClients bean to complete and get results";
}
};
Wait.waitForCriterion(waitCriteria, 2 * 60 * 1000, 3000, true);
final DistributedSystemMXBean bean = getManagementService().getDistributedSystemMXBean();
assertNotNull(bean);
return Integer.valueOf(bean.getNumClients());
}
Aggregations