Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ public void apply(Project project) {
Provider<BwcTaskThrottle> bwcTaskThrottleProvider = project.getGradle()
.getSharedServices()
.registerIfAbsent(BWC_TASK_THROTTLE_SERVICE, BwcTaskThrottle.class, spec -> spec.getMaxParallelUsages().set(1));
BuildParams.getBwcVersions()
.forPreviousUnreleased(
(BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath), unreleasedVersion, bwcTaskThrottleProvider);
}
);
BuildParams.getBwcVersions().forPreviousUnreleased((BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
configureBwcProject(project.project(unreleasedVersion.gradleProjectPath), unreleasedVersion, bwcTaskThrottleProvider);
});
}

private void configureBwcProject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ public void apply(Project project) {

Provider<DockerSupportService> dockerSupportServiceProvider = project.getGradle()
.getSharedServices()
.registerIfAbsent(
DOCKER_SUPPORT_SERVICE_NAME,
DockerSupportService.class,
spec -> spec.parameters(
params -> { params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE)); }
)
);
.registerIfAbsent(DOCKER_SUPPORT_SERVICE_NAME, DockerSupportService.class, spec -> spec.parameters(params -> {
params.setExclusionsFile(new File(project.getRootDir(), DOCKER_ON_LINUX_EXCLUSIONS_FILE));
}));

// Ensure that if we are trying to run any DockerBuildTask tasks, we assert an available Docker installation exists
project.getGradle().getTaskGraph().whenReady(graph -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public class LicenseAnalyzer {
+ "NONINFRINGEMENT\\. IN NO EVENT SHALL THE AUTHORS OR "
+ "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR "
+ "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n")
.replaceAll("\\s+", "\\\\s*"),
.replaceAll("\\s+", "\\\\s*"),
Pattern.DOTALL
)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,9 @@ static Optional<CompilationUnit> addVersionConstant(CompilationUnit versionJava,
.stream()
.map(f -> Map.entry(f, parseVersionField(f.getVariable(0).getNameAsString())))
.filter(e -> e.getValue().isPresent())
.collect(
Collectors.toMap(
e -> e.getValue().get(),
Map.Entry::getKey,
(v1, v2) -> { throw new IllegalArgumentException("Duplicate version constants " + v1); },
TreeMap::new
)
);
.collect(Collectors.toMap(e -> e.getValue().get(), Map.Entry::getKey, (v1, v2) -> {
throw new IllegalArgumentException("Duplicate version constants " + v1);
}, TreeMap::new));

// find the version this should be inserted after
var previousVersion = versions.lowerEntry(version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,9 @@ public void apply(Project project) {

// windows boxes get windows distributions, and linux boxes get linux distributions
if (isWindows(vmProject)) {
configureVMWrapperTasks(
vmProject,
windowsTestTasks,
depsTasks,
wrapperTask -> { vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask)); },
vmDependencies
);
configureVMWrapperTasks(vmProject, windowsTestTasks, depsTasks, wrapperTask -> {
vmLifecyleTasks.get(ARCHIVE).configure(t -> t.dependsOn(wrapperTask));
}, vmDependencies);
} else {
for (var entry : linuxTestTasks.entrySet()) {
ElasticsearchDistributionType type = entry.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public class MainResponse {
private static final ConstructingObjectParser<MainResponse, Void> PARSER = new ConstructingObjectParser<>(
MainResponse.class.getName(),
true,
args -> { return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]); }
args -> {
return new MainResponse((String) args[0], (Version) args[1], (String) args[2], (String) args[3], (String) args[4]);
}
);

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ public static final class FieldStatistics {
private static final ConstructingObjectParser<FieldStatistics, Void> PARSER = new ConstructingObjectParser<>(
"field_statistics",
true,
args -> { return new FieldStatistics((long) args[0], (int) args[1], (long) args[2]); }
args -> {
return new FieldStatistics((long) args[0], (int) args[1], (long) args[2]);
}
);

static {
Expand Down Expand Up @@ -411,11 +413,9 @@ public int hashCode() {

public static final class Token {

private static final ConstructingObjectParser<Token, Void> PARSER = new ConstructingObjectParser<>(
"token",
true,
args -> { return new Token((Integer) args[0], (Integer) args[1], (Integer) args[2], (String) args[3]); }
);
private static final ConstructingObjectParser<Token, Void> PARSER = new ConstructingObjectParser<>("token", true, args -> {
return new Token((Integer) args[0], (Integer) args[1], (Integer) args[2], (String) args[3]);
});
static {
PARSER.declareInt(optionalConstructorArg(), new ParseField("start_offset"));
PARSER.declareInt(optionalConstructorArg(), new ParseField("end_offset"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ public class LifecyclePolicy implements ToXContentObject {
private static Map<String, Set<String>> ALLOWED_ACTIONS = new HashMap<>();

static {
PARSER.declareNamedObjects(
ConstructingObjectParser.constructorArg(),
(p, c, n) -> Phase.parse(p, n),
v -> { throw new IllegalArgumentException("ordered " + PHASES_FIELD.getPreferredName() + " are not supported"); },
PHASES_FIELD
);
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(), (p, c, n) -> Phase.parse(p, n), v -> {
throw new IllegalArgumentException("ordered " + PHASES_FIELD.getPreferredName() + " are not supported");
}, PHASES_FIELD);

ALLOWED_ACTIONS.put(
"hot",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public class Phase implements ToXContentObject {
PARSER.declareNamedObjects(
ConstructingObjectParser.constructorArg(),
(p, c, n) -> p.namedObject(LifecycleAction.class, n, null),
v -> { throw new IllegalArgumentException("ordered " + ACTIONS_FIELD.getPreferredName() + " are not supported"); },
v -> {
throw new IllegalArgumentException("ordered " + ACTIONS_FIELD.getPreferredName() + " are not supported");
},
ACTIONS_FIELD
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public boolean equals(Object obj) {
}

@SuppressWarnings("unchecked")
static final ConstructingObjectParser<GetApiKeyResponse, Void> PARSER = new ConstructingObjectParser<>(
"get_api_key_response",
args -> { return (args[0] == null) ? GetApiKeyResponse.emptyResponse() : new GetApiKeyResponse((List<ApiKey>) args[0]); }
);
static final ConstructingObjectParser<GetApiKeyResponse, Void> PARSER = new ConstructingObjectParser<>("get_api_key_response", args -> {
return (args[0] == null) ? GetApiKeyResponse.emptyResponse() : new GetApiKeyResponse((List<ApiKey>) args[0]);
});
static {
PARSER.declareObjectArray(optionalConstructorArg(), (p, c) -> ApiKey.fromXContent(p), new ParseField("api_keys"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ private static <T> Map<String, T> checkMap(Object argument, int depth) {
if (argument instanceof Map) {
Map<String, T> map = (Map<String, T>) argument;
if (depth == 0) {
map.values()
.stream()
.filter(val -> (val instanceof Boolean) == false)
.forEach(val -> { throw new IllegalArgumentException("Map value [" + val + "] in [" + map + "] is not a Boolean"); });
map.values().stream().filter(val -> (val instanceof Boolean) == false).forEach(val -> {
throw new IllegalArgumentException("Map value [" + val + "] in [" + map + "] is not a Boolean");
});
} else {
map.values().stream().forEach(val -> checkMap(val, depth - 1));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,9 @@ public void testIndex() throws IOException {
assertEquals("_doc", indexResponse.getType());
assertEquals("with_create_op_type", indexResponse.getId());

ElasticsearchStatusException exception = expectThrows(
ElasticsearchStatusException.class,
() -> { execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync); }
);
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () -> {
execute(indexRequest, highLevelClient()::index, highLevelClient()::indexAsync);
});

assertEquals(RestStatus.CONFLICT, exception.status());
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ public void testReindex() throws IOException {
reindexRequest.setRefresh(true);
reindexRequest.setRequireAlias(true);

ElasticsearchStatusException exception = expectThrows(
ElasticsearchStatusException.class,
() -> { execute(reindexRequest, highLevelClient()::reindex, highLevelClient()::reindexAsync); }
);
ElasticsearchStatusException exception = expectThrows(ElasticsearchStatusException.class, () -> {
execute(reindexRequest, highLevelClient()::reindex, highLevelClient()::reindexAsync);
});

assertEquals(RestStatus.NOT_FOUND, exception.status());
assertEquals(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,9 @@ public void testPerformRequestOnSuccess() throws IOException {
{
IOException ioe = expectThrows(
IOException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.emptySet()
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.emptySet())
);
assertEquals(
"Unable to parse response body for Response{requestLine=GET / http/1.1, host=http://localhost:9200, "
Expand Down Expand Up @@ -660,13 +656,9 @@ public void testPerformRequestOnResponseExceptionWithIgnoresErrorNoBody() throws
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
ElasticsearchException elasticsearchException = expectThrows(
ElasticsearchException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.singleton(404)
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.singleton(404))
);
assertEquals(RestStatus.NOT_FOUND, elasticsearchException.status());
assertSame(responseException, elasticsearchException.getCause());
Expand All @@ -683,13 +675,9 @@ public void testPerformRequestOnResponseExceptionWithIgnoresErrorValidBody() thr
when(restClient.performRequest(any(Request.class))).thenThrow(responseException);
ElasticsearchException elasticsearchException = expectThrows(
ElasticsearchException.class,
() -> restHighLevelClient.performRequest(
mainRequest,
requestConverter,
RequestOptions.DEFAULT,
response -> { throw new IllegalStateException(); },
Collections.singleton(404)
)
() -> restHighLevelClient.performRequest(mainRequest, requestConverter, RequestOptions.DEFAULT, response -> {
throw new IllegalStateException();
}, Collections.singleton(404))
);
assertEquals(RestStatus.NOT_FOUND, elasticsearchException.status());
assertSame(responseException, elasticsearchException.getSuppressed()[0]);
Expand Down Expand Up @@ -1163,7 +1151,7 @@ public void testApiNamingConventions() throws Exception {
&&
// IndicesClientIT.getIndexTemplate should be renamed "getTemplate" in version 8.0 when we
// can get rid of 7.0's deprecated "getTemplate"
apiName.equals("indices.get_index_template") == false
apiName.equals("indices.get_index_template") == false
&& org.elasticsearch.core.List.of(
"indices.data_streams_stats",
"indices.delete_data_stream",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,12 @@ public void testEqualsHashCode() {
final Instant expiration = Instant.ofEpochMilli(10000);
CreateApiKeyResponse createApiKeyResponse = new CreateApiKeyResponse(name, id, apiKey, expiration);

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
createApiKeyResponse,
(original) -> {
return new CreateApiKeyResponse(original.getName(), original.getId(), original.getKey(), original.getExpiration());
}
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(
createApiKeyResponse,
(original) -> {
return new CreateApiKeyResponse(original.getName(), original.getId(), original.getKey(), original.getExpiration());
},
CreateApiKeyResponseTests::mutateTestItem
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(createApiKeyResponse, (original) -> {
return new CreateApiKeyResponse(original.getName(), original.getId(), original.getKey(), original.getExpiration());
});
EqualsHashCodeTestUtils.checkEqualsAndHashCode(createApiKeyResponse, (original) -> {
return new CreateApiKeyResponse(original.getName(), original.getId(), original.getKey(), original.getExpiration());
}, CreateApiKeyResponseTests::mutateTestItem);
}

private static CreateApiKeyResponse mutateTestItem(CreateApiKeyResponse original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ public class DelegatePkiAuthenticationRequestTests extends AbstractRequestTestCa
org.elasticsearch.xpack.core.security.action.DelegatePkiAuthenticationRequest> {

public void testEmptyOrNullCertificateChain() throws Exception {
IllegalArgumentException e = expectThrows(
IllegalArgumentException.class,
() -> { new DelegatePkiAuthenticationRequest((List<X509Certificate>) null); }
);
IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> {
new DelegatePkiAuthenticationRequest((List<X509Certificate>) null);
});
assertThat(e.getMessage(), is("certificate chain must not be empty or null"));
e = expectThrows(IllegalArgumentException.class, () -> { new DelegatePkiAuthenticationRequest(Collections.emptyList()); });
assertThat(e.getMessage(), is("certificate chain must not be empty or null"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ public void testEqualsHashCode() {
final DeleteRoleMappingRequest deleteRoleMappingRequest = new DeleteRoleMappingRequest(name, refreshPolicy);
assertNotNull(deleteRoleMappingRequest);

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteRoleMappingRequest,
(original) -> { return new DeleteRoleMappingRequest(original.getName(), original.getRefreshPolicy()); }
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteRoleMappingRequest, (original) -> {
return new DeleteRoleMappingRequest(original.getName(), original.getRefreshPolicy());
});

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteRoleMappingRequest,
(original) -> { return new DeleteRoleMappingRequest(original.getName(), original.getRefreshPolicy()); },
DeleteRoleMappingRequestTests::mutateTestItem
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteRoleMappingRequest, (original) -> {
return new DeleteRoleMappingRequest(original.getName(), original.getRefreshPolicy());
}, DeleteRoleMappingRequestTests::mutateTestItem);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@ public void testEqualsHashCode() {
final boolean found = randomBoolean();
final DeleteRoleMappingResponse deleteRoleMappingResponse = new DeleteRoleMappingResponse(found);

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteRoleMappingResponse,
(original) -> { return new DeleteRoleMappingResponse(original.isFound()); }
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteRoleMappingResponse, (original) -> {
return new DeleteRoleMappingResponse(original.isFound());
});

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteRoleMappingResponse,
(original) -> { return new DeleteRoleMappingResponse(original.isFound()); },
DeleteRoleMappingResponseTests::mutateTestItem
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteRoleMappingResponse, (original) -> {
return new DeleteRoleMappingResponse(original.isFound());
}, DeleteRoleMappingResponseTests::mutateTestItem);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ public void testEqualsHashCode() {
final DeleteUserRequest deleteUserRequest = new DeleteUserRequest(name, refreshPolicy);
assertNotNull(deleteUserRequest);

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteUserRequest,
(original) -> { return new DeleteUserRequest(original.getName(), original.getRefreshPolicy()); }
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteUserRequest, (original) -> {
return new DeleteUserRequest(original.getName(), original.getRefreshPolicy());
});

EqualsHashCodeTestUtils.checkEqualsAndHashCode(
deleteUserRequest,
(original) -> { return new DeleteUserRequest(original.getName(), original.getRefreshPolicy()); },
DeleteUserRequestTests::mutateTestItem
);
EqualsHashCodeTestUtils.checkEqualsAndHashCode(deleteUserRequest, (original) -> {
return new DeleteUserRequest(original.getName(), original.getRefreshPolicy());
}, DeleteUserRequestTests::mutateTestItem);

}

Expand Down
Loading
Loading