]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /* |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | ||
20 | // Following Gradle best practices to keep build logic organized | |
21 | ||
22 | // Bundle the test classes in a JAR for other Ant based builds | |
23 | task testJar(type: Jar, group: 'Build') { | |
24 | description = 'Assembles a jar archive containing the test classes.' | |
25 | project.test.dependsOn it | |
26 | ||
27 | classifier 'test' | |
28 | from sourceSets.test.output | |
29 | } | |
30 | ||
31 | // ---------------------------------------------------------------------------- | |
32 | // Unit test tasks and configurations | |
33 | ||
34 | // Help the up to date algorithm to make these tests done | |
35 | ext.markTaskDone = { task -> | |
36 | def buildFile = file("$buildDir/${task.name}.flag") | |
37 | task.inputs.files task.classpath | |
38 | task.outputs.file buildFile | |
39 | task.doLast { | |
40 | buildFile.text = 'Passed!' | |
41 | } | |
42 | } | |
43 | ||
44 | task deprecatedEqualityTest(type: JavaExec, group: 'Verification') { | |
45 | description = 'Run the non-JUnit test suite ' | |
46 | classpath = sourceSets.test.runtimeClasspath | |
47 | main 'org.apache.thrift.test.EqualityTest' | |
48 | markTaskDone(it) | |
49 | } | |
50 | ||
51 | task deprecatedJavaBeansTest(type: JavaExec, group: 'Verification') { | |
52 | description = 'Run the non-JUnit test suite ' | |
53 | classpath = sourceSets.test.runtimeClasspath | |
54 | main 'org.apache.thrift.test.JavaBeansTest' | |
55 | markTaskDone(it) | |
56 | } | |
57 | ||
58 | // Main Unit Test task configuration | |
59 | test { | |
60 | description="Run the full test suite" | |
61 | dependsOn deprecatedEqualityTest, deprecatedJavaBeansTest | |
62 | ||
63 | // Allow repeating tests even after successful execution | |
64 | if (project.hasProperty('rerunTests')) { | |
65 | outputs.upToDateWhen { false } | |
66 | } | |
67 | ||
68 | include '**/Test*.class' | |
69 | exclude '**/Test*\$*.class' | |
70 | ||
71 | maxHeapSize = '512m' | |
72 | forkEvery = 1 | |
73 | ||
74 | systemProperties = [ | |
75 | 'build.test': "${compileTestJava.destinationDir}", | |
76 | 'test.port': "${testPort}", | |
77 | 'javax.net.ssl.trustStore': "${projectDir}/test/.truststore", | |
78 | 'javax.net.ssl.trustStorePassword': 'thrift', | |
79 | 'javax.net.ssl.keyStore': "${projectDir}/test/.keystore", | |
80 | 'javax.net.ssl.keyStorePassword': 'thrift' | |
81 | ] | |
82 | } |