Refactor all samples to use the build.GemFireServerPlugin Gradle Plugin.

This commit is contained in:
John Blum
2019-05-29 16:25:58 -07:00
parent b10ee66483
commit acd4d5b1a9
16 changed files with 46 additions and 152 deletions

View File

@@ -1,29 +1,28 @@
apply plugin: 'io.spring.convention.spring-sample-boot'
apply plugin: "gemfire-server"
apply plugin: "application"
apply from: IDE_GRADLE
repositories {
mavenCentral()
}
dependencies {
compile project(':spring-session-data-geode')
compile("org.springframework.boot:spring-boot-starter-thymeleaf") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j"
}
compile("org.springframework.boot:spring-boot-starter-web") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j"
}
compile "org.springframework.data:spring-data-geode-test"
compile "org.webjars:bootstrap"
compile "org.webjars:webjars-locator"
runtime "org.springframework.shell:spring-shell"
testCompile("org.springframework.boot:spring-boot-starter-test") {
exclude group: "org.springframework.boot", module: "spring-boot-starter-logging"
exclude group: "org.apache.logging.log4j", module: "log4j-to-slf4j"
}
testCompile seleniumDependencies
integrationTestCompile seleniumDependencies
@@ -42,59 +41,3 @@ run {
mainClassName = 'sample.server.GemFireServer'
}
}
task runGemFireServer() {
doLast {
ext.port = reservePort()
println "Starting Apache Geode Server on port [$port] ..."
def out = new StringBuilder()
def err = new StringBuilder()
String classpath = project.sourceSets.main.runtimeClasspath.collect { it }.join(File.pathSeparator)
String[] commandLine = [
'java', '-server', '-ea', '-classpath', classpath,
//"-Dgemfire.log-file=gemfire-server.log",
//"-Dgemfire.log-level=config",
"-Dspring.session.data.geode.cache.server.port=$port",
'sample.server.GemFireServer'
]
//println commandLine
ext.process = commandLine.execute()
//ext.process = new ProcessBuilder().command(commandLine).redirectErrorStream(true).start();
ext.process.consumeProcessOutput(out, err)
//println 'OUT: ' + out
//println 'ERR: ' + err
}
}
integrationTest {
dependsOn runGemFireServer
doFirst {
def port = reservePort()
systemProperties['management.port'] = 0
systemProperties['server.port'] = port
//systemProperties['gemfire.log-file'] = "gemfire-client.log"
//systemProperties['gemfire.log-level'] = "config"
systemProperties['spring.session.data.geode.cache.server.port'] = runGemFireServer.port
}
doLast {
println 'Stopping Apache Geode Server...'
runGemFireServer.process?.destroyForcibly()
}
}
def reservePort() {
def socket = new ServerSocket(0)
def result = socket.localPort
socket.close()
result
}

View File

@@ -88,7 +88,7 @@ public class Application {
@Bean
ClientCacheConfigurer clientCacheServerPortConfigurer(
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <5>
@Value("${spring.data.gemfire.cache.server.port:40404}") int port) { // <5>
return (beanName, clientCacheFactoryBean) ->
clientCacheFactoryBean.setServers(Collections.singletonList(

View File

@@ -56,7 +56,7 @@ public class IntegrationTestConfiguration {
@Bean
BeanPostProcessor clientServerReadyBeanPostProcessor(
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <5>
@Value("${spring.data.gemfire.cache.server.port:40404}") int port) { // <5>
return new BeanPostProcessor() {

View File

@@ -53,7 +53,7 @@ public class GemFireServer {
@Bean
CacheServerConfigurer cacheServerPortConfigurer(
@Value("${spring.session.data.geode.cache.server.port:40404}") int port) { // <5>
@Value("${spring.data.gemfire.cache.server.port:40404}") int port) { // <5>
return (beanName, cacheServerFactoryBean) ->
cacheServerFactoryBean.setPort(port);