-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
275 lines (214 loc) · 8.09 KB
/
build.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
buildscript {
ext.kaytee_plugin_version = "0.20.1.0"
ext.kotlin_version = "1.2.61"
ext.junit_platform_version = "1.0.3"
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "uk.q3c.kaytee:kaytee-plugin:$kaytee_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.junit.platform:junit-platform-gradle-plugin:$junit_platform_version"
}
}
class Pause extends DefaultTask {
int delaySecs = 5
@TaskAction
void pause() {
int i = delaySecs
while (i >= 1) {
println "${i} seconds left"
i--
Thread.sleep(1000)
}
}
}
plugins {
id "com.devsoap.plugin.vaadin" version "1.3.1"
id "com.github.johnrengelman.shadow" version "2.0.3"
id "com.chrisgahlert.gradle-dcompose-plugin" version "0.9.3"
id "com.dorongold.task-tree" version "1.3"
}
apply plugin: 'uk.q3c.kaytee'
apply plugin: 'kotlin'
apply from: "gradle/spek.gradle"
apply from: "gradle/vertx.gradle"
description = 'Functional test application for Krail and its additional modules'
group = 'uk.q3c.krail'
ext.krailVersion = "0.16.13.0"
ext.assertjVersion = '3.8.0'
ext.vaadinTestbenchVersion = '5.0.0'
ext.vaadinVersion = '8.4.2'
ext.gsonVersion = '2.3.1'
ext.defaultTestContainer = project.hasProperty("defaultTestContainer") ? project.getProperty("defaultTestContainer") : "tomcat8"
ext.defaultTestContainerPort = project.hasProperty("defaultTestContainerPort") ? project.getProperty("defaultTestContainerPort") : ""
// We have to fix the qualifier because we cannot change the scheme: https://github.com/KrailOrg/q3c-util/issues/17
VersionNumber krailVersionNumber = VersionNumber.parse(krailVersion)
String meta = ""
if (krailVersionNumber.getQualifier().length() >= 3) {
def m = krailVersionNumber.getQualifier().substring(2)
meta = "-$m"
}
kaytee {
version {
number = krailVersionNumber.baseVersion.toString()
qualifier = "0$meta" // increment this for changes to the test app itself, reset to 0 when krailVersion changes
}
release {
mergeToMaster = false
toBintray = false
}
}
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url "http://maven.vaadin.com/vaadin-addons" }
}
// guava 23.0 causes an error
// java.lang.IllegalAccessError: tried to access method com.google.common.util.concurrent.SimpleTimeLimiter
configurations.all {
resolutionStrategy {
force 'com.google.guava:guava:22.0'
// GWT requires an old version of the validation API. Changing to a newer version breaks widgetset compile but throws no errors
force 'javax.validation:validation-api:1.0.0.GA'
dependencySubstitution {
substitute module('commons-beanutils:commons-beanutils-core') with module('commons-beanutils:commons-beanutils:1.9.3')
}
}
}
dependencies {
compile 'org.vaadin.addon:enhanced-window-opener:0.4'
// Kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
//Krail
compile 'uk.q3c.krail:eventbus-mbassador:0.5.0.0' // for Handler / Listener annotations
//assert
compile 'org.assertj:assertj-core:' + assertjVersion
// html parser
compile group: 'org.jsoup', name: 'jsoup', version: '1.10.3'
compile "uk.q3c.krail:krail:$krailVersion"
//Testbench
compileOnly "com.vaadin:vaadin-testbench:$vaadinTestbenchVersion"
compileOnly "com.vaadin:vaadin-testbench-api:$vaadinVersion" // get an out of date API without this
//UI components
compile 'de.steinwedel.vaadin.addon:messagebox:4.0.21'
compile 'org.vaadin.addons:stepper:2.4.0'
compile 'org.vaadin:spinkit:1.0.0'
// Missing from stepper
compile 'org.json:json:20141113'
// compileOnly because sources requiring dependencies are in production sourceSet
// but they are not needed at runtime
compileOnly "org.amshove.kluent:kluent:1.35"
compile "com.nhaarman:mockito-kotlin:1.5.0"
compileOnly 'com.codeborne:selenide:4.9.1'
// Dependencies are needed to compile also code in test sourceSet
testCompile 'com.codeborne:selenide:4.9.1'
compile 'io.jsonwebtoken:jjwt:0.9.0'
// testCompile 'junit:junit:4.12'
// testCompile('uk.q3c.krail:krail-bench:0.14.0.0') {
// exclude group: 'uk.q3c.krail', module: 'krail'
// }
compile 'uk.q3c.util:serialization-tracer:0.7.0.0'
testCompile 'uk.q3c.util:q3c-testutils:0.11.0.4'
testCompile "com.nhaarman:mockito-kotlin:1.5.0"
testCompile "org.amshove.kluent:kluent:1.35"
}
// testCompile project(':krail-orient')
vaadin {
version = vaadinVersion
logToConsole = true
push = true
}
vaadinCompile {
manageWidgetset false
}
ext.warName = (project.name.toLowerCase() + '.war')
war {
exclude 'WEB-INF/lib/*'
archiveName = warName
}
task copyWar(type: Copy) {
dependsOn war
File userHome = new File(System.getProperty('user.home'))
File source = new File(project.buildDir, "libs")
File dest = new File(userHome, "tomcat8.5/webapps")
from source
into dest
}
task pauseForApp(type: Pause) {
delaySecs = 20
dependsOn copyWar
}
dcompose {
tomcat7 {}
tomcat8 {}
}
// Configure docker images following conventions
// Every service must have
// - Dockerfile in src/main/docker named as `Dockerfile.<serviceName>`
dcompose.services.all { service ->
def containerName = service.name
def taskGroup = "Container Tests"
// Configure dcompose
service.baseDir = file("build/docker/${containerName}")
service.dockerFilename = "Dockerfile.${containerName}"
service.repository = "krail/testApp:${kaytee.version.number}-${containerName}"
service.portBindings = ["${project["defaultTestContainerPort"]}:8080"]
// Build a specific task to copy files in container
def copyFilesTaskName = "copyFilesTo${containerName.capitalize()}ContainerBuildDir"
task "${copyFilesTaskName}"(type: Sync, group: taskGroup) {
from war
from('src/main/docker/') {
include service.dockerFilename
}
into service.baseDir
}
project[service.buildImageTaskName].dependsOn "${copyFilesTaskName}"
// Build a task to prepares test environment
def containerTestTask = "ContainerTest${containerName.capitalize()}"
task "pre${containerTestTask}" {
group taskGroup
dependsOn war
dependsOn "${service.startTaskName}"
doLast {
// Pass in the configuration properties to the integration test so they can connect container port
def junitPlatformTestTask = tasks.getByName('junitPlatformTest')
junitPlatformTestTask.systemProperty 'krail.server.httpPort', service.findHostPort(8080)
}
}
// Create a task to clean up environment after integration tests
task "post${containerTestTask}" {
group taskGroup
mustRunAfter "${containerTestTask}"
finalizedBy "${service.removeContainerTaskName}"
doLast {
// Clean up the dynamic system properties in order to not mess up the UP-TO-DATE checks
def junitPlatformTestTask = tasks.getByName('junitPlatformTest')
junitPlatformTestTask.systemProperties.remove 'krail.server.httpPort'
}
}
// Build a task to run tests on the container
task "${containerTestTask.uncapitalize()}" {
group taskGroup
dependsOn "pre${containerTestTask}"
dependsOn test
}
}
// Aliases for default test container
task startDefaultTestContainer(dependsOn: "preContainerTest${ext.defaultTestContainer.capitalize()}")
task stopDefaultTestContainer(dependsOn: dcompose.services[ext.defaultTestContainer].stopTaskName)
task removeDefaultTestContainer(dependsOn: dcompose.services[ext.defaultTestContainer].removeContainerTaskName)
// Run default container before running tests
//test.dependsOn startDefaultTestContainer
//junitPlatformTest.mustRunAfter startDefaultTestContainer
vaadinRun {
serverPort = 8001
server = 'jetty'
debug false
}
// ./gradlew startTomcat8Container -PdefaultTestContainerPort=8080
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}