use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class CacheManagementDUnitTest method verifyConfigData.
private Map<DistributedMember, DistributionConfig> verifyConfigData() {
ManagementService service = this.managementTestRule.getManagementService();
InternalDistributedSystem ids = (InternalDistributedSystem) this.managementTestRule.getCache().getDistributedSystem();
DistributionConfig config = ids.getConfig();
MemberMXBean bean = service.getMemberMXBean();
GemFireProperties data = bean.listGemFireProperties();
verifyGemFirePropertiesData(config, data);
Map<DistributedMember, DistributionConfig> configMap = new HashMap<>();
configMap.put(ids.getDistributedMember(), config);
return configMap;
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class CacheManagementDUnitTest method verifyConfigDataRemote.
/**
* This is to check whether the config data has been propagated to the Managing node properly or
* not.
*/
private void verifyConfigDataRemote(final Map<DistributedMember, DistributionConfig> configMap) {
Set<DistributedMember> otherMembers = this.managementTestRule.getOtherNormalMembers();
for (DistributedMember member : otherMembers) {
MemberMXBean memberMXBean = awaitMemberMXBeanProxy(member);
GemFireProperties data = memberMXBean.listGemFireProperties();
DistributionConfig config = configMap.get(member);
verifyGemFirePropertiesData(config, data);
}
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class CacheManagementDUnitTest method testGemFireConfigData.
@Test
public void testGemFireConfigData() throws Exception {
this.managementTestRule.createMembers();
this.managementTestRule.createManagers();
Map<DistributedMember, DistributionConfig> configMap = new HashMap<>();
for (VM memberVM : this.memberVMs) {
Map<DistributedMember, DistributionConfig> configMapMember = memberVM.invoke(() -> verifyConfigData());
configMap.putAll(configMapMember);
}
this.managerVM.invoke(() -> verifyConfigDataRemote(configMap));
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class ConfigCommandsDUnitTest method testAlterRuntimeConfigOnAllMembers.
@Test
public void testAlterRuntimeConfigOnAllMembers() throws Exception {
final String member1 = "VM1";
final String controller = "controller";
String controllerDirectory = this.temporaryFolder.newFolder(controller).getAbsolutePath();
String controllerStatFilePath = new File(controllerDirectory, "stat.gfs").getAbsolutePath();
setUpJmxManagerOnVm0ThenConnect(null);
Properties localProps = new Properties();
localProps.setProperty(NAME, controller);
localProps.setProperty(LOG_LEVEL, "error");
getSystem(localProps);
final GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
final DistributionConfig config = cache.getSystem().getConfig();
Host.getHost(0).getVM(1).invoke(new SerializableRunnable() {
public void run() {
Properties localProps = new Properties();
localProps.setProperty(NAME, member1);
getSystem(localProps);
Cache cache = getCache();
}
});
CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__LEVEL, "info");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__FILE__SIZE__LIMIT, "50");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__DISK__SPACE__LIMIT, "32");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__ARCHIVE__FILE__SIZE__LIMIT, "49");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLE__RATE, "2000");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__ARCHIVE__FILE, controllerStatFilePath);
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__STATISTIC__SAMPLING__ENABLED, "true");
csb.addOption(CliStrings.ALTER_RUNTIME_CONFIG__LOG__DISK__SPACE__LIMIT, "10");
CommandResult cmdResult = executeCommand(csb.getCommandString());
String resultString = commandResultToString(cmdResult);
getLogWriter().info("#SB Result\n");
getLogWriter().info(resultString);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
assertEquals(LogWriterImpl.INFO_LEVEL, config.getLogLevel());
assertEquals(50, config.getLogFileSizeLimit());
assertEquals(49, config.getArchiveFileSizeLimit());
assertEquals(32, config.getArchiveDiskSpaceLimit());
assertEquals(2000, config.getStatisticSampleRate());
assertEquals("stat.gfs", config.getStatisticArchiveFile().getName());
assertEquals(true, config.getStatisticSamplingEnabled());
assertEquals(10, config.getLogDiskSpaceLimit());
// Validate the changes in the vm1
Host.getHost(0).getVM(1).invoke(new SerializableRunnable() {
public void run() {
GemFireCacheImpl cacheVM1 = (GemFireCacheImpl) getCache();
DistributionConfig configVM1 = cacheVM1.getSystem().getConfig();
assertEquals(LogWriterImpl.INFO_LEVEL, configVM1.getLogLevel());
assertEquals(50, configVM1.getLogFileSizeLimit());
assertEquals(49, configVM1.getArchiveFileSizeLimit());
assertEquals(32, configVM1.getArchiveDiskSpaceLimit());
assertEquals(2000, configVM1.getStatisticSampleRate());
assertEquals("stat.gfs", configVM1.getStatisticArchiveFile().getName());
assertEquals(true, configVM1.getStatisticSamplingEnabled());
assertEquals(10, configVM1.getLogDiskSpaceLimit());
}
});
}
use of org.apache.geode.distributed.internal.DistributionConfig in project geode by apache.
the class ConfigCommandsDUnitTest method testDescribeConfig.
@Test
public void testDescribeConfig() throws Exception {
setUpJmxManagerOnVm0ThenConnect(null);
final String controllerName = "Member2";
/*
* Create properties for the controller VM
*/
final Properties localProps = new Properties();
localProps.setProperty(MCAST_PORT, "0");
localProps.setProperty(LOG_LEVEL, "info");
localProps.setProperty(STATISTIC_SAMPLING_ENABLED, "true");
localProps.setProperty(ENABLE_TIME_STATISTICS, "true");
localProps.setProperty(NAME, controllerName);
localProps.setProperty(GROUPS, "G1");
getSystem(localProps);
Cache cache = getCache();
int[] ports = getRandomAvailableTCPPorts(1);
CacheServer cs = getCache().addCacheServer();
cs.setPort(ports[0]);
cs.setMaxThreads(10);
cs.setMaxConnections(9);
cs.start();
try {
RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();
List<String> jvmArgs = runtimeBean.getInputArguments();
getLogWriter().info("#SB Actual JVM Args : ");
for (String jvmArg : jvmArgs) {
getLogWriter().info("#SB JVM " + jvmArg);
}
InternalDistributedSystem system = (InternalDistributedSystem) cache.getDistributedSystem();
DistributionConfig config = system.getConfig();
config.setArchiveFileSizeLimit(1000);
String command = CliStrings.DESCRIBE_CONFIG + " --member=" + controllerName;
CommandProcessor cmdProcessor = new CommandProcessor();
cmdProcessor.createCommandStatement(command, Collections.EMPTY_MAP).process();
CommandResult cmdResult = executeCommand(command);
String resultStr = commandResultToString(cmdResult);
getLogWriter().info("#SB Hiding the defaults\n" + resultStr);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
assertEquals(true, resultStr.contains("G1"));
assertEquals(true, resultStr.contains(controllerName));
assertEquals(true, resultStr.contains(ARCHIVE_FILE_SIZE_LIMIT));
assertEquals(true, !resultStr.contains("copy-on-read"));
cmdResult = executeCommand(command + " --" + CliStrings.DESCRIBE_CONFIG__HIDE__DEFAULTS + "=false");
resultStr = commandResultToString(cmdResult);
getLogWriter().info("#SB No hiding of defaults\n" + resultStr);
assertEquals(true, cmdResult.getStatus().equals(Status.OK));
assertEquals(true, resultStr.contains("is-server"));
assertEquals(true, resultStr.contains(controllerName));
assertEquals(true, resultStr.contains("copy-on-read"));
} finally {
cs.stop();
}
}
Aggregations