58
58
import org .gradle .api .tasks .TaskAction ;
59
59
import org .gradle .api .tasks .util .PatternFilterable ;
60
60
import org .gradle .api .tasks .util .PatternSet ;
61
- import org .gradle .internal .Factory ;
61
+ import org .gradle .api . tasks . util . internal .PatternSetFactory ;
62
62
63
63
import java .io .File ;
64
64
import java .io .IOException ;
@@ -98,25 +98,23 @@ public abstract class RestCompatTestTransformTask extends DefaultTask {
98
98
// PatternFilterable -> list of full test names and reasons. Needed for 1 pattern may include many tests and reasons
99
99
private final Map <PatternFilterable , List <Pair <String , String >>> skippedTestByTestNameTransformations = new HashMap <>();
100
100
101
- @ Inject
102
- protected Factory <PatternSet > getPatternSetFactory () {
103
- throw new UnsupportedOperationException ();
104
- }
105
-
106
101
@ Inject
107
102
public RestCompatTestTransformTask (FileSystemOperations fileSystemOperations , ObjectFactory objectFactory ) {
108
103
this .fileSystemOperations = fileSystemOperations ;
109
104
this .compatibleVersion = Version .fromString (VersionProperties .getVersions ().get ("elasticsearch" )).getMajor () - 1 ;
110
105
this .sourceDirectory = objectFactory .directoryProperty ();
111
106
this .outputDirectory = objectFactory .directoryProperty ();
112
- this .testPatternSet = getPatternSetFactory ().create ();
107
+ this .testPatternSet = getPatternSetFactory ().createPatternSet ();
113
108
this .testPatternSet .include ("/*" + "*/*.yml" ); // concat these strings to keep build from thinking this is invalid javadoc
114
109
// always inject compat headers
115
110
headers .put ("Content-Type" , "application/vnd.elasticsearch+json;compatible-with=" + compatibleVersion );
116
111
headers .put ("Accept" , "application/vnd.elasticsearch+json;compatible-with=" + compatibleVersion );
117
112
getTransformations ().add (new InjectHeaders (headers , Sets .newHashSet (RestCompatTestTransformTask ::doesNotHaveCatOperation )));
118
113
}
119
114
115
+ @ Inject
116
+ protected abstract PatternSetFactory getPatternSetFactory ();
117
+
120
118
private static boolean doesNotHaveCatOperation (ObjectNode doNodeValue ) {
121
119
final Iterator <String > fieldNamesIterator = doNodeValue .fieldNames ();
122
120
while (fieldNamesIterator .hasNext ()) {
@@ -144,7 +142,7 @@ public void skipTest(String fullTestName, String reason) {
144
142
);
145
143
}
146
144
147
- PatternSet skippedPatternSet = getPatternSetFactory ().create ();
145
+ PatternSet skippedPatternSet = getPatternSetFactory ().createPatternSet ();
148
146
// create file patterns for all a1/a2/a3/b.yml possibilities.
149
147
for (int i = testParts .length - 1 ; i > 1 ; i --) {
150
148
final String lastPart = testParts [i ];
@@ -158,7 +156,7 @@ public void skipTest(String fullTestName, String reason) {
158
156
}
159
157
160
158
public void skipTestsByFilePattern (String filePattern , String reason ) {
161
- PatternSet skippedPatternSet = getPatternSetFactory ().create ();
159
+ PatternSet skippedPatternSet = getPatternSetFactory ().createPatternSet ();
162
160
skippedPatternSet .include (filePattern );
163
161
skippedTestByFilePatternTransformations .put (skippedPatternSet , reason );
164
162
}
0 commit comments