use of org.apache.geode.management.ManagementService in project geode by apache.
the class ReadOpFileAccessControllerJUnitTest method testReadOnlyOperations.
@Test
public void testReadOnlyOperations() throws IOException, InstanceNotFoundException, ReflectionException, MBeanException {
ManagementService service = ManagementService.getExistingManagementService(GemFireCacheImpl.getInstance());
String accessFileName = createAccessFile();
String passwordFileName = createPasswordFile();
createConnector(accessFileName, passwordFileName);
MBeanServerConnection server = connectToRmiConnector();
DistributedMember member = cache.getMyId();
assertNotNull(server.invoke(service.getMemberMBeanName(member), "listRegions", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "listGemFireProperties", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "listConnectedGatewayReceivers", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "listConnectedGatewaySenders", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "showJVMMetrics", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "showOSMetrics", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "fetchJvmThreads", null, null));
assertNotNull(server.invoke(service.getMemberMBeanName(member), "viewLicense", null, null));
// TODO QueryData : Start Manager fails due to #50280 : Can not start manager inside a loner
try {
server.invoke(service.getMemberMBeanName(member), "compactAllDiskStores", null, null);
fail("Admin operation accessible to readonly user");
} catch (SecurityException e) {
// ok
}
}
Aggregations