21
21
22
22
import org .elasticsearch .gradle .test .GradleIntegrationTestCase ;
23
23
import org .gradle .testkit .runner .BuildResult ;
24
- import org .gradle .testkit .runner .GradleRunner ;
25
24
26
25
27
26
public class ExportElasticsearchBuildResourcesTaskIT extends GradleIntegrationTestCase {
28
27
29
28
public static final String PROJECT_NAME = "elasticsearch-build-resources" ;
30
29
31
30
public void testUpToDateWithSourcesConfigured () {
32
- GradleRunner .create ()
33
- .withProjectDir (getProjectDir (PROJECT_NAME ))
31
+ getGradleRunner (PROJECT_NAME )
34
32
.withArguments ("clean" , "-s" )
35
- .withPluginClasspath ()
36
33
.build ();
37
34
38
- BuildResult result = GradleRunner .create ()
39
- .withProjectDir (getProjectDir (PROJECT_NAME ))
35
+ BuildResult result = getGradleRunner (PROJECT_NAME )
40
36
.withArguments ("buildResources" , "-s" , "-i" )
41
- .withPluginClasspath ()
42
37
.build ();
43
38
assertTaskSuccessful (result , ":buildResources" );
44
39
assertBuildFileExists (result , PROJECT_NAME , "build-tools-exported/checkstyle.xml" );
45
40
assertBuildFileExists (result , PROJECT_NAME , "build-tools-exported/checkstyle_suppressions.xml" );
46
41
47
- result = GradleRunner .create ()
48
- .withProjectDir (getProjectDir (PROJECT_NAME ))
42
+ result = getGradleRunner (PROJECT_NAME )
49
43
.withArguments ("buildResources" , "-s" , "-i" )
50
- .withPluginClasspath ()
51
44
.build ();
52
45
assertTaskUpToDate (result , ":buildResources" );
53
46
assertBuildFileExists (result , PROJECT_NAME , "build-tools-exported/checkstyle.xml" );
54
47
assertBuildFileExists (result , PROJECT_NAME , "build-tools-exported/checkstyle_suppressions.xml" );
55
48
}
56
49
57
50
public void testImplicitTaskDependencyCopy () {
58
- BuildResult result = GradleRunner .create ()
59
- .withProjectDir (getProjectDir (PROJECT_NAME ))
51
+ BuildResult result = getGradleRunner (PROJECT_NAME )
60
52
.withArguments ("clean" , "sampleCopyAll" , "-s" , "-i" )
61
- .withPluginClasspath ()
62
53
.build ();
63
54
64
55
assertTaskSuccessful (result , ":buildResources" );
@@ -69,10 +60,8 @@ public void testImplicitTaskDependencyCopy() {
69
60
}
70
61
71
62
public void testImplicitTaskDependencyInputFileOfOther () {
72
- BuildResult result = GradleRunner .create ()
73
- .withProjectDir (getProjectDir (PROJECT_NAME ))
63
+ BuildResult result = getGradleRunner (PROJECT_NAME )
74
64
.withArguments ("clean" , "sample" , "-s" , "-i" )
75
- .withPluginClasspath ()
76
65
.build ();
77
66
78
67
assertTaskSuccessful (result , ":sample" );
@@ -81,11 +70,12 @@ public void testImplicitTaskDependencyInputFileOfOther() {
81
70
}
82
71
83
72
public void testIncorrectUsage () {
84
- BuildResult result = GradleRunner .create ()
85
- .withProjectDir (getProjectDir (PROJECT_NAME ))
86
- .withArguments ("noConfigAfterExecution" , "-s" , "-i" )
87
- .withPluginClasspath ()
88
- .buildAndFail ();
89
- assertOutputContains ("buildResources can't be configured after the task ran" );
73
+ assertOutputContains (
74
+ getGradleRunner (PROJECT_NAME )
75
+ .withArguments ("noConfigAfterExecution" , "-s" , "-i" )
76
+ .buildAndFail ()
77
+ .getOutput (),
78
+ "buildResources can't be configured after the task ran"
79
+ );
90
80
}
91
81
}
0 commit comments