-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-glassfish-common.gradle
124 lines (111 loc) · 6.64 KB
/
build-glassfish-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
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
import org.apache.tools.ant.filters.ReplaceTokens;
String rootDir = "$buildDir/unpack/glassfish"
String binDir = rootDir + "/glassfish/bin"
task deployJars(type: Copy, dependsOn: unpackContainer) {
from configurations.p6spyAll
into rootDir + "/glassfish/domains/domain1/lib/ext"
}
task copyConfig(type: Copy, dependsOn: deployJars) {
from "$buildDir/../src/test/config/spy.properties"
into rootDir + "/glassfish/domains/domain1/config"
filter(ReplaceTokens, tokens: [logDir: buildDir.getAbsolutePath()])
}
task startContainer(type:Exec, dependsOn: copyConfig) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'start-domain', '--debug=true'
}
//
// h2 pools
//
task createH2ConnectionPoolDataSourceS1Pool(type:Exec, dependsOn:startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--datasourceclassname=org.h2.jdbcx.JdbcDataSource', '--restype=javax.sql.ConnectionPoolDataSource', "--property=URL='jdbc:h2:tcp://localhost:9091/${buildDir}/h2/s1/test1':User=sa:Password=''", 'h2ConnectionPoolDataSourceS1Pool'
}
task createH2XADataSourceS1Pool(type:Exec, dependsOn:startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--datasourceclassname=org.h2.jdbcx.JdbcDataSource', '--restype=javax.sql.XADataSource', "--property=URL='jdbc:h2:tcp://localhost:9091/${buildDir}/h2/s1/test2':User=sa:Password=''", 'h2XADataSourceS1Pool'
}
task createH2XADataSourceS2Pool(type:Exec, dependsOn:startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--datasourceclassname=org.h2.jdbcx.JdbcDataSource', '--restype=javax.sql.XADataSource', "--property=URL='jdbc:h2:tcp://localhost:9092/${buildDir}/h2/s2/test1':User=sa:Password=''", 'h2XADataSourceS2Pool'
}
//
// ping h2 pools
//
task pingH2ConnectionPoolDataSourceS1Pool(type:Exec, dependsOn:createH2ConnectionPoolDataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'h2ConnectionPoolDataSourceS1Pool'
}
task pingH2XADataSourceS1Pool(type:Exec, dependsOn:createH2XADataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'h2XADataSourceS1Pool'
}
task pingH2XADataSourceS2Pool(type:Exec, dependsOn:createH2XADataSourceS2Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'h2XADataSourceS2Pool'
}
//
// h2 resources
//
task createH2ConnectionPoolDataSourceS1Resource(type:Exec, dependsOn:pingH2ConnectionPoolDataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', '--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=h2ConnectionPoolDataSourceS1Pool', 'jdbc/h2ConnectionPoolDataSourceS1'
}
task createH2XADataSourceS1Resource(type:Exec, dependsOn:pingH2XADataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin','--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=h2XADataSourceS1Pool', 'jdbc/h2XADataSourceS1'
}
task createH2XADataSourceS2Resource(type:Exec, dependsOn:pingH2XADataSourceS2Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', '--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=h2XADataSourceS2Pool', 'jdbc/h2XADataSourceS2'
}
//
// p6spy pools
//
task createP6SpyDriverS1Pool(type:Exec, dependsOn:startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--driverclassname=com.p6spy.engine.spy.P6SpyDriver', '--restype=java.sql.Driver', "--property=URL='jdbc:p6spy:h2:tcp://localhost:9091/${buildDir}/h2/s1/test3':User=sa:Password=''" /*'--property=URL="jdbc\\:p6spy\\:h2\\:tcp\\://localhost\\:9091/test1":User=sa:Password=""'*/, 'p6spyDriverS1Pool'
}
task createP6SpyConnectionPoolDataSourceS1Pool(type:Exec, dependsOn:createH2ConnectionPoolDataSourceS1Resource) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--datasourceclassname=com.p6spy.engine.spy.P6DataSource', '--restype=javax.sql.ConnectionPoolDataSource', '--property=realDataSource=jdbc/h2ConnectionPoolDataSourceS1:User=sa:Password=""', 'p6spyConnectionPoolDataSourceS1Pool'
}
task createP6SpyXADataSourceS1Pool(type:Exec, dependsOn:createH2XADataSourceS1Resource) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'create-jdbc-connection-pool', '--datasourceclassname=com.p6spy.engine.spy.P6DataSource', '--restype=javax.sql.XADataSource', '--property=realDataSource=jdbc/h2XADataSourceS1:User=sa:Password=""', 'p6spyXADataSourceS1Pool'
}
//
// ping p6spy pools
//
task pingP6SpyDriverS1Pool(type:Exec, dependsOn:createP6SpyDriverS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'p6spyDriverS1Pool'
}
task pingP6SpyDataSourceS1Pool(type:Exec, dependsOn:createP6SpyConnectionPoolDataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'p6spyConnectionPoolDataSourceS1Pool'
}
task pingP6SpyXADataSourceS1Pool(type:Exec, dependsOn:createP6SpyXADataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'ping-connection-pool', 'p6spyXADataSourceS1Pool'
}
//
// p6spy resources
//
task createP6SpyDriverS1Resource(type:Exec, dependsOn:pingP6SpyDriverS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', '--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=p6spyDriverS1Pool', 'jdbc/p6SpyDriverS1'
}
task createP6SpyDataSourceS1Resource(type:Exec, dependsOn:pingP6SpyDataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', '--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=p6spyConnectionPoolDataSourceS1Pool', 'jdbc/p6SpyConnectionPoolDataSourceS1'
}
task createP6SpyXADataSourceS1Resource(type:Exec, dependsOn:pingP6SpyXADataSourceS1Pool) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', '--user=admin', "--passwordfile=../../../../../src/test/config/glassfish_passwordfile.properties", 'create-jdbc-resource', '--connectionpoolid=p6spyXADataSourceS1Pool', 'jdbc/p6SpyXADataSourceS1'
}
task stopContainer(type:Exec, dependsOn: startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'asadmin', 'stop-domain'
}
startContainer.finalizedBy createP6SpyDriverS1Resource, createP6SpyDataSourceS1Resource, createP6SpyXADataSourceS1Resource, createH2XADataSourceS2Resource