Fixes GemFire client/server integratione tests issue when setting JAVA_TOOL_OPTIONS env var

Fixes gh-727
This commit is contained in:
John Blum
2017-01-18 00:42:41 +01:00
committed by Vedran Pavic
parent ecf0a80d7d
commit 736b341ba3
10 changed files with 268 additions and 59 deletions

View File

@@ -1,7 +1,7 @@
apply from: JAVA_GRADLE
apply from: SAMPLE_GRADLE
apply from: TOMCAT_7_GRADLE
apply plugin: "application"
apply from: SAMPLE_GRADLE
dependencies {
compile project(':spring-session-data-gemfire'),
@@ -38,27 +38,34 @@ task availablePort() {
task runGemFireServer(dependsOn: availablePort) {
doLast {
println 'STARTING GEMFIRE SERVER...'
println "Starting GemFire Server on port [$port]..."
def out = new StringBuilder()
def err = new StringBuilder()
String classpath = sourceSets.main.runtimeClasspath.collect { it }.join(File.pathSeparator)
String gemfireLogLevel = System.getProperty('sample.httpsession.gemfire.log-level', 'config')
String[] commandLine = ['java', '-server', '-ea',
"-Dspring.session.data.gemfire.port=$port",
"-Dsample.httpsession.gemfire.log-level="
+ System.getProperty('sample.httpsession.gemfire.log-level', 'warning'),
'-classpath', classpath, 'sample.ServerConfig']
String[] commandLine = [
'java', '-server', '-ea', '-classpath', classpath,
"-Dspring.session.data.gemfire.port=$port",
"-Dsample.httpsession.gemfire.log-level=" + gemfireLogLevel,
'sample.ServerConfig'
]
//println commandLine
process = commandLine.execute()
process.in.close()
process.out.close()
process.err.close()
process.consumeProcessOutput(out, err)
//println 'OUT: ' + out
//println 'ERR: ' + err
}
}
integrationTest.doLast {
println 'STOPPING GEMFIRE SERVER...'
println 'Stopping GemFire Server...'
process?.destroyForcibly()
}

View File

@@ -44,7 +44,9 @@ public class ClientConfig {
static final CountDownLatch LATCH = new CountDownLatch(1);
static final String DEFAULT_GEMFIRE_LOG_LEVEL = "warning";
static final String DEFAULT_GEMFIRE_LOG_LEVEL = "config";
static final String PROXY_HOST = "dummy.example.com";
static final String PROXY_PORT = "3128";
@Bean
static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
@@ -54,6 +56,7 @@ public class ClientConfig {
Properties gemfireProperties() { // <2>
Properties gemfireProperties = new Properties();
gemfireProperties.setProperty("name", applicationName());
// gemfireProperties.setProperty("log-file", "gemfire-client.log");
gemfireProperties.setProperty("log-level", logLevel());
return gemfireProperties;
}

View File

@@ -36,13 +36,12 @@ public class ServerConfig {
static final int SERVER_PORT = 12480;
static final String DEFAULT_GEMFIRE_LOG_LEVEL = "warning";
static final String DEFAULT_GEMFIRE_LOG_LEVEL = "config";
static final String SERVER_HOST = "localhost";
@SuppressWarnings("resource")
public static void main(String[] args) throws IOException { // <5>
new AnnotationConfigApplicationContext(ServerConfig.class)
.registerShutdownHook();
new AnnotationConfigApplicationContext(ServerConfig.class).registerShutdownHook();
}
@Bean
@@ -55,21 +54,20 @@ public class ServerConfig {
gemfireProperties.setProperty("name", applicationName());
gemfireProperties.setProperty("mcast-port", "0");
// gemfireProperties.setProperty("log-file", "gemfire-server.log");
gemfireProperties.setProperty("log-level", logLevel());
gemfireProperties.setProperty("jmx-manager", "true");
gemfireProperties.setProperty("jmx-manager-start", "true");
// gemfireProperties.setProperty("jmx-manager", "true");
// gemfireProperties.setProperty("jmx-manager-start", "true");
return gemfireProperties;
}
String applicationName() {
return "samples:httpsession-gemfire-clientserver:"
.concat(getClass().getSimpleName());
return "samples:httpsession-gemfire-clientserver:".concat(getClass().getSimpleName());
}
String logLevel() {
return System.getProperty("sample.httpsession.gemfire.log-level",
DEFAULT_GEMFIRE_LOG_LEVEL);
return System.getProperty("sample.httpsession.gemfire.log-level", DEFAULT_GEMFIRE_LOG_LEVEL);
}
@Bean