forked from tkolhar/katello-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
268 lines (237 loc) · 9.91 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
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
group = 'com.redhat.qe'
ext.API_VERSION = '2.0.3'
task release(dependsOn: 'jar') << {
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(release)) {
version = "${API_VERSION}"
} else {
version = "${API_VERSION}-SNAPSHOT"
}
}
allprojects {
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceSets {
main {
java {
srcDirs "src"
}
groovy {
srcDirs "src"
}
resources {
srcDirs "src", "scripts", "resources"
}
}
test {
java {
srcDirs "src"
}
groovy {
srcDirs "src"
}
resources {
srcDirs "resources"
}
}
}
compileGroovy.groovyOptions.fork = false
compileTestGroovy.groovyOptions.fork = false
}
configurations {
testng
compile.exclude module: 'scannotation'
}
eclipse {
classpath {
ext.defaultOutputDir = file('build')
}
project {
ext.defaultOutputDir = file('build')
}
project {
file {
whenMerged { project ->
if ( !project.buildCommands[0].name.contains('PyDev') ) {
project.buildCommands = project.buildCommands.reverse()
}
}
}
natures 'org.python.pydev.pythonNature'
buildCommand 'org.python.pydev.PyDevBuilder'
}
}
repositories {
mavenCentral()
[ 'https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads',
'http://clojars.org/repo',
'http://mirrors.ibiblio.org/pub/mirrors/maven2/',
'http://mvnrepository.com/artifact',
'http://download.java.net/maven/2',
'http://repository.codehaus.org',
'http://snapshots.repository.codehaus.org' ].each { repo ->
maven {
url repo
}
}
}
dependencies {
def resteasyVersion = '2.3.4.Final'
def httpBuilderVersion = '0.5.2'
def slf4jVersion = '1.6.6'
if ( System.properties['httpbuilder.version'] ) {
httpBuilderVersion = System.properties['httpbuilder.version']
}
testCompile 'org.testng:testng:6.8.5','xmlunit:xmlunit:1.0'
testRuntime('org.uncommons:reportng:1.1.3') {
exclude group: 'org.testng', module: 'testng'
}
testRuntime "org.slf4j:slf4j-jdk14:${slf4jVersion}",
'com.redhat.qe:tcms-testng:1.0.1',
'com.redhat.qe:jul.test.records:1.0.1',
'com.redhat.qe:testng-listeners:1.0.0'
compile 'org.testng:testng:6.8.5',
'com.redhat.qe:assertions:1.0.2',
'com.redhat.qe:logging-testscript:1.0.2',
'com.redhat.qe:ssh-tools:1.0.1-SNAPSHOT',
'com.redhat.qe:testng-listeners:1.0.0',
'velocity:velocity-dep:1.4',
'com.trilead:trilead-ssh2:build213-svnkit-1.3-patch',
'com.googlecode.json-simple:json-simple:1.1',
'com.google.inject:guice:3.0',
'com.google.inject.extensions:guice-assistedinject:3.0',
'com.google.inject.extensions:guice-throwingproviders:3.0',
'com.google.inject.extensions:guice-grapher:3.0',
"org.slf4j:slf4j-api:${slf4jVersion}",
'org.apache.httpcomponents:httpclient:4.2.1',
"org.jboss.resteasy:resteasy-jaxrs:${resteasyVersion}",
"org.jboss.resteasy:resteasy-jackson-provider:${resteasyVersion}",
"org.jboss.resteasy:resteasy-multipart-provider:${resteasyVersion}",
'net.oauth.core:oauth:20100527',
'org.ovirt.engine.sdk:ovirt-engine-sdk-java:1.0.0.11-1'
// compile("org.codehaus.groovy.modules.http-builder:http-builder:${httpBuilderVersion}") {
// exclude group: 'org.codehaus.groovy', module: 'groovy'
// }
groovy 'org.codehaus.groovy:groovy:1.8.6'
testng 'org.testng:testng:6.8.5'
}
task printClasspath << {
println configurations.runtime.asPath
}
task printProps << {
println System.properties
}
def TESTNG_KATELLO_DEFAULT_TESTS = "Smoke_Tests,CLI_Tests,E2E_Tests,DC_Tests"
def TESTNG_KATELLO_SUITE = "testng-suites/katello-tests.xml"
def TESTNG_KATELLO_SUITE_PARALLEL = "testng-suites/katello-tests-parallel.xml"
def TESTNG_HEADPIN_SUITE = "testng-suites/headpin-tests.xml"
def TESTNG_KATELLO_EXCLUDE_GROUPS = "openldap,sam-upgrade,cfse-ignore,foreman"
def TESTNG_SAM_EXCLUDE_GROUPS = "openldap"
task runTestng(dependsOn: 'testClasses') << {
// Defaults to $WORKSPACE, or if that's null, cwd
def workspace = System.getProperty("workspace.dir", System.getenv("WORKSPACE") ?: System.properties["user.dir"])
def testngProjectDir = System.getProperty("testng.project.dir", "automatjon/jon")
def automationDir = "${workspace}/${testngProjectDir}"
System.properties["automation.dir"] = automationDir.toString()
def outputDir = System.getProperty("testng.outputdir", "${automationDir}/test-output")
def xmlSuite = System.properties["testng.suites"]
ant.taskdef( resource: 'testngtasks', classpath: configurations.testng.asPath )
ant.testng( classpath: sourceSets.test.runtimeClasspath.asPath, outputdir: outputDir) {
xmlfileset(dir: 'testng-suites', includes: "**/${xmlSuite}")
}
}
tasks.addRule("Pattern: suite<SuiteName>: Runs a test suite via xml in classpath") { String taskName ->
final String prefix = "suite"
if ( taskName.startsWith(prefix) && taskName.length() > prefix.length() ) {
logger.info("SuiteExecution: $taskName matches pattern")
// create a dummy task for the task name specified on the command line
Task dummyTask = task(taskName)
// remove prefix from the specified task name
def suiteName = taskName - prefix
// define an include that supports the specified naming pattern, inc. camel-case notation
def camelCaseTaskName = suiteName[0] + suiteName.substring(1).collect() { it == it.toUpperCase() ? "*$it" : it }.joi
def suiteIncludes = WrapUtil.toSet(String.format("**/%s.xml", camelCaseTaskName))
def suiteFiles = fileTree(dir: 'src', includes: suiteIncludes )
suiteFiles.each { File file ->
logger.info("SuiteExecution: suiteFile: ${file}")
}
// make all Test tasks a dependency of the dummy task and reset the includes
tasks.withType(Test) { Task suiteTask ->
logger.info("SuiteExecution: apply include pattern to Suite task <$suiteTask.name>")
suiteTask.useTestNG()
suiteTask.options.suites(suiteFiles.asType(File[]))
dummyTask.dependsOn suiteTask
}
}
}
task run_katello(dependsOn: 'testClasses') << {
javaexec {
def testnames = System.getProperty("testng.testnames", "${TESTNG_KATELLO_DEFAULT_TESTS}")
def excludegroups = System.getProperty("testng.excludegroups", "${TESTNG_KATELLO_EXCLUDE_GROUPS}")
def workspace = System.getProperty("workspace.dir", System.getenv("WORKSPACE") ?: System.properties["user.dir"])
def outputDir = "${workspace}/test-output"
def groups = System.getProperty("testng.groups", "")
systemProperties = System.properties
workingDir = "${workspace}"
classpath = sourceSets.test.runtimeClasspath
main = 'org.testng.TestNG'
args '-d',"${outputDir}"
args "${TESTNG_KATELLO_SUITE}"
args '-listener','com.redhat.qe.auto.testng.TestNGListener,org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.XMLReporter,com.redhat.qe.katello.base.tngext.TngPriorityInterceptor'
args '-configfailurepolicy','continue'
args '-testnames',"${testnames}"
args '-excludegroups',"${excludegroups}"
args '-groups',"$groups"
}
}
task run_katello_parallel(dependsOn: 'testClasses') << {
javaexec {
def testnames = System.getProperty("testng.testnames", "${TESTNG_KATELLO_DEFAULT_TESTS}")
def excludegroups = System.getProperty("testng.excludegroups", "${TESTNG_KATELLO_EXCLUDE_GROUPS}")
def workspace = System.getProperty("workspace.dir", System.getenv("WORKSPACE") ?: System.properties["user.dir"])
def outputDir = "${workspace}/test-output"
def groups = System.getProperty("testng.groups", "")
systemProperties = System.properties
workingDir = "${workspace}"
classpath = sourceSets.test.runtimeClasspath
main = 'org.testng.TestNG'
args '-d',"${outputDir}"
args "${TESTNG_KATELLO_SUITE_PARALLEL}"
args '-listener','com.redhat.qe.auto.testng.TestNGListener,org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.XMLReporter,com.redhat.qe.katello.base.threading.KatelloCliReporter'
args '-configfailurepolicy','continue'
args '-testnames',"${testnames}"
args '-excludegroups',"${excludegroups}"
args '-groups',"$groups"
args '-threadcount',"2"
args '-parallel',"classes"
}
}
task run_sam(dependsOn: 'testClasses') << {
javaexec {
def testnames = System.getProperty("testng.testnames", "${TESTNG_KATELLO_DEFAULT_TESTS}")
def excludegroups = System.getProperty("testng.excludegroups", "${TESTNG_SAM_EXCLUDE_GROUPS}")
def workspace = System.getProperty("workspace.dir", System.getenv("WORKSPACE") ?: System.properties["user.dir"])
def outputDir = "${workspace}/test-output"
systemProperties = System.properties
workingDir = "${workspace}"
classpath = sourceSets.test.runtimeClasspath
main = 'org.testng.TestNG'
args '-d',"${outputDir}"
args "${TESTNG_HEADPIN_SUITE}"
args '-listener','com.redhat.qe.auto.testng.TestNGListener,org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.XMLReporter'
args '-configfailurepolicy','continue'
args '-testnames',"${testnames}"
args '-excludegroups',"${excludegroups}"
args '-parallel',"classes"
args 'threadcount',"2"
}
}
task writeNewPom << {
pom {
}.writeTo("$buildDir/libs/pom.xml")
}