use of org.apache.geode.distributed.ConfigurationProperties.LOG_FILE_SIZE_LIMIT in project geode by apache.
the class ClusterConfig method verifyServer.
public void verifyServer(MemberVM<Server> serverVM) {
// verify files exist in filesystem
Set<String> expectedJarNames = this.getJarNames().stream().collect(toSet());
String[] actualJarFiles = serverVM.getWorkingDir().list((dir, filename) -> filename.contains(".jar"));
Set<String> actualJarNames = Stream.of(actualJarFiles).map(jar -> jar.replaceAll("\\.v\\d+\\.jar", ".jar")).collect(toSet());
// We will end up with extra jars on disk if they are deployed and then undeployed
assertThat(expectedJarNames).isSubsetOf(actualJarNames);
// verify config exists in memory
serverVM.invoke(() -> {
Cache cache = GemFireCacheImpl.getInstance();
// TODO: set compare to fail if there are extra regions
for (String region : this.getRegions()) {
assertThat(cache.getRegion(region)).isNotNull();
}
if (StringUtils.isNotBlank(this.getMaxLogFileSize())) {
Properties props = cache.getDistributedSystem().getProperties();
assertThat(props.getProperty(LOG_FILE_SIZE_LIMIT)).isEqualTo(this.getMaxLogFileSize());
}
for (String jar : this.getJarNames()) {
DeployedJar deployedJar = ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jar);
assertThat(deployedJar).isNotNull();
assertThat(Class.forName(nameOfClassContainedInJar(jar), true, new URLClassLoader(new URL[] { deployedJar.getFileURL() }))).isNotNull();
}
// If we have extra jars on disk left over from undeploy, make sure they aren't used
Set<String> undeployedJarNames = new HashSet<>(actualJarNames);
undeployedJarNames.removeAll(expectedJarNames);
for (String jar : undeployedJarNames) {
System.out.println("Verifying undeployed jar: " + jar);
DeployedJar undeployedJar = ClassPathLoader.getLatest().getJarDeployer().findDeployedJar(jar);
assertThat(undeployedJar).isNull();
}
});
}
Aggregations