-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-wls12x.gradle
152 lines (131 loc) · 4.31 KB
/
build-wls12x.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import org.apache.tools.ant.filters.ReplaceTokens;
// didn't figure out yet 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'
}
configurations {
wls12xTestRuntime { extendsFrom testRuntime }
}
dependencies {
wls12xTestRuntime "org.jboss.arquillian.container:arquillian-wls-remote-12.1:$libraryVersions.arquillian_wls"
}
String rootDir = "$buildDir/unpack/wls12"
String domainDir = "$rootDir/user_projects/domains/mydomain"
String serverDir = "$domainDir/servers/myserver"
task downloadServer(type:Exec) {
workingDir "${buildDir}/.."
commandLine "./script/travis/wls12x_download.sh"
}
task unpackContainer(type: Copy, dependsOn: downloadServer) {
from { zipTree(new File("build/wls1213_dev.zip")) }
into 'build/unpack'
doLast {
ant.rename(src: 'build/unpack/wls12130', dest: rootDir)
}
}
task createDomain(dependsOn: unpackContainer) {
doLast {
//
// fix script to prevent input to be requested
//
// patching script to work also in case no ANT_HOME provided
ant.replace(
file: "$rootDir/configure.sh",
token: "# define some constants",
value: "# define some constants\nSCRIPT_DIR=$rootDir"
)
// create domain [y]
ant.replace(
file: "$rootDir/configure.sh",
token: 'read response',
value: "response='y'"
)
// username=weblogic
// password=weblogic123
ant.replace(
file: "$rootDir/configure.sh",
token: '-Dweblogic.management.GenerateDefaultConfig=true',
value: "-Dweblogic.management.GenerateDefaultConfig=true -Dweblogic.management.username=weblogic -Dweblogic.management.password=weblogic123"
)
// start in background
ant.replace(
file: "$rootDir/configure.sh",
token: 'weblogic.Server',
value: "weblogic.Server &"
)
// set executable
ant.chmod(
dir: "$rootDir",
includes: "configure.sh",
perm: "+x"
)
ant.exec(
dir: "$rootDir",
spawn: true,
fork: true,
executable: './configure.sh'
)
// it takes quite some time till wls boots, let's make sure we wait for it
ant.waitfor(maxwait: "10", maxwaitunit: "minute") {
socket (server: "localhost", port: "7001")
}
// stop once domain created + started correctly
ant.exec(
dir: domainDir + '/bin',
executable: './stopWebLogic.sh'
)
}
}
task deployJars(type: Copy, dependsOn: createDomain) {
from configurations.p6spyAll
into domainDir + "/lib"
}
task copyConfig(type: Copy, dependsOn: deployJars) {
from "$buildDir/../src/test/config/spy.properties"
into domainDir
filter(ReplaceTokens, tokens: [logDir: buildDir.getAbsolutePath()])
}
task startContainer(dependsOn: copyConfig ) {
doLast {
ant.exec(
dir: "$domainDir/bin",
spawn: true,
executable: './startWebLogic.sh'
)
// it takes quite some time till wls boots, let's make sure we wait for it
ant.waitfor(maxwait: "2", maxwaitunit: "minute") {
socket (server: "localhost", port: "7001")
}
}
}
task stopContainer(type:Exec, dependsOn: startContainer) {
workingDir domainDir + '/bin'
commandLine 'bash', '-e', './stopWebLogic.sh'
}
task createH2ConnectionPoolDataSourceS1(dependsOn:startContainer) {
doLast {
ant.exec(
dir: "$domainDir/bin",
spawn: false,
executable: '/bin/sh'
)
{
arg(value: "-c")
arg(value: "source $domainDir/bin/setDomainEnv.sh && java weblogic.WLST $rootDir/../../../script/travis/wls12x_ds.py 'h2ConnectionPoolDataSourceS1' 'jdbc/h2ConnectionPoolDataSourceS1' 'org.h2.jdbcx.JdbcDataSource' 'jdbc:h2:tcp://localhost:9091/$buildDir/h2/s1/test1'")
}
}
}
task createP6SpyDriverS1(dependsOn:createH2ConnectionPoolDataSourceS1) {
doLast {
ant.exec(
dir: "$domainDir/bin",
spawn: false,
executable: '/bin/sh'
)
{
arg(value: "-c")
arg(value: "source $domainDir/bin/setDomainEnv.sh && java weblogic.WLST $rootDir/../../../script/travis/wls12x_ds.py 'p6SpyDriverS1' 'jdbc/p6SpyDriverS1' 'com.p6spy.engine.spy.P6SpyDriver' 'jdbc:p6spy:h2:tcp://localhost:9091/$buildDir/h2/s1/test3'")
}
}
}
startContainer.finalizedBy createP6SpyDriverS1