-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-tomcat-common.gradle
47 lines (39 loc) · 1.65 KB
/
build-tomcat-common.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import org.apache.tools.ant.filters.ReplaceTokens;
// didn't figure out how to use neither javax.sql.DataSource nor javax.sql.XADataSource => exclude those tests
unitTest.useJUnit {
excludeCategories 'com.p6spy.engine.spy.DataSourceTests', 'com.p6spy.engine.spy.XADataSourceTests'
}
String rootDir = "$buildDir/unpack/apache-tomcat"
String binDir = rootDir + "/bin"
task deployP6SpyJars(type: Copy, dependsOn: unpackContainer) {
from configurations.p6spyAll
into rootDir + "/lib"
}
task copyConfig(type: Copy, dependsOn: unpackContainer) {
from "$buildDir/../src/test/config/spy_with_explicit_drivername.properties"
into rootDir + "/lib"
filter(ReplaceTokens, tokens: [logDir: buildDir.getAbsolutePath()])
doLast {
ant.rename(src: rootDir + '/lib/spy_with_explicit_drivername.properties', dest: rootDir + '/lib/spy.properties')
}
}
task patchContainer(type: Copy, dependsOn: unpackContainer) {
from "$buildDir/../src/test/container/tomcat-common"
into rootDir
filter(ReplaceTokens, tokens: [buildDir: buildDir.getAbsolutePath()])
}
task startContainer(type:Exec, dependsOn: [ deployP6SpyJars, copyConfig, patchContainer]) {
doFirst {
ant.chmod( dir: "$binDir", includes: "*.sh", perm: "+x")
}
workingDir binDir
commandLine 'bash', '-e', 'startup.sh'
// not for tomee
if (!container.startsWith("tomee")) {
environment CATALINA_OPTS: "-Djava.rmi.server.hostname:127.0.0.1 -Dcom.sun.management.jmxremote.port=8050 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
}
}
task stopContainer(type:Exec, dependsOn: startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'shutdown.sh'
}