-
Notifications
You must be signed in to change notification settings - Fork 4
/
build-jboss61x.gradle
78 lines (65 loc) · 2.43 KB
/
build-jboss61x.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
import org.apache.tools.ant.filters.ReplaceTokens;
configurations {
jboss61xTestRuntime { extendsFrom testRuntime }
}
dependencies {
jboss61xTestRuntime "org.jboss.arquillian.container:arquillian-jbossas-remote-6:$libraryVersions.arquillian_jboss61"
// to prevent ClassNotFoundExceptions
jboss61xTestRuntime ("org.jboss.jbossas:jboss-as-client:$libraryVersions.jboss61x") {
exclude (group: "com.sun.istack", module: "istack-commons-runtime")
exclude (group: "org.hibernate", module: "hibernate-annotations")
exclude (group: "org.jboss.ejb3", module: "jboss-ejb3-jpa-int")
}
}
// 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/jboss"
String binDir = rootDir + "/bin"
task unpackContainer(type: Copy) {
from { zipTree( downloadFile("http://download.jboss.org/jbossas/6.1/jboss-as-distribution-6.1.0.Final.zip"))}
into 'build/unpack'
doLast {
ant.rename(src: 'build/unpack/jboss-6.1.0.Final', dest: 'build/unpack/jboss')
}
}
task deployP6SpyJars(type: Copy, dependsOn: unpackContainer) {
from configurations.p6spyAll
into rootDir + "/server/default/lib"
}
task copyConfig(type: Copy, dependsOn: unpackContainer) {
from "$buildDir/../src/test/config/spy.properties"
into rootDir + "/server/default/conf"
filter(ReplaceTokens, tokens: [logDir: buildDir.getAbsolutePath()])
}
task configureDS(type: Copy, dependsOn: unpackContainer) {
from "$buildDir/../src/test/container/jboss-common"
into rootDir
filter(ReplaceTokens, tokens: [buildDir: buildDir.getAbsolutePath()])
}
task patchContainer(type: Copy, dependsOn: unpackContainer) {
from "$buildDir/../src/test/container/${container}"
into rootDir
}
task startContainer(dependsOn: [ deployP6SpyJars, copyConfig, configureDS, patchContainer] ) {
doLast {
ant.exec(
dir: binDir,
spawn: true,
executable: './run.sh'
)
{
arg(value: "-c")
arg(value: "default")
}
// it takes quite some time till jboss boots, let's make sure we wait for it
ant.waitfor(maxwait: "60", maxwaitunit: "second") {
socket (server: "localhost", port: "8080")
}
}
}
task stopContainer(type:Exec, dependsOn: startContainer) {
workingDir binDir
commandLine 'bash', '-e', 'shutdown.sh', '-S'
}