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 @@ -52,6 +52,23 @@ public void apply(Project project) {
// Spotless resolves required dependencies from project repositories, so we need maven central
project.getRepositories().mavenCentral();

// we cannot update to a newer spotless plugin version yet but we want to use the latest eclipse formatter to be compatible
// with latest java versions
project.getConfigurations().matching(it -> it.getName().startsWith("spotless")).configureEach(conf -> {
project.getDependencies().constraints(constraints -> {
constraints.add(conf.getName(), "org.eclipse.jdt:org.eclipse.jdt.core:3.42.0", dependencyConstraint -> {
dependencyConstraint.because(
"We want to use a recent version of the Eclipse formatter libraries to support latest Java"
);
});
constraints.add(conf.getName(), "org.eclipse.jdt:ecj:3.42.0", dependencyConstraint -> {
dependencyConstraint.because(
"We want to use a recent version of the Eclipse formatter libraries to support latest Java"
);
});
});
});

project.getExtensions().getByType(SpotlessExtension.class).java(java -> {
File elasticsearchWorkspace = Util.locateElasticsearchWorkspace(project.getGradle());
String importOrderPath = "build-conventions/elastic.importorder";
Expand All @@ -74,7 +91,7 @@ public void apply(Project project) {
// When running build benchmarks we alter the source in some scenarios.
// The gradle-profiler unfortunately does not generate compliant formatted
// sources so we ignore that altered file when running build benchmarks
if(Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
if (Boolean.getBoolean("BUILD_PERFORMANCE_TEST") && project.getPath().equals(":server")) {
java.targetExclude("src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java");
}
});
Expand Down
31 changes: 13 additions & 18 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3873,16 +3873,21 @@
<sha256 value="97c566b120009c203a2fc8b291f4a9adbc171cf1ccb70f06f6b4e1828c00ce8e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jdt" name="org.eclipse.jdt.core" version="3.35.0">
<artifact name="org.eclipse.jdt.core-3.35.0.jar">
<sha256 value="8f5bcb00355b271638b9d82a8cccd0e733225cb74c4a3f0f55a7b75d43ee442a" origin="Generated by Gradle"/>
<component group="org.eclipse.jdt" name="ecj" version="3.42.0">
<artifact name="ecj-3.42.0.jar">
<sha256 value="29f6d3918ee02db4400c103bc25dd90a22491c3a395867d9393070cb96a7dd29" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jdt" name="org.eclipse.jdt.core" version="3.38.0">
<artifact name="org.eclipse.jdt.core-3.38.0.jar">
<sha256 value="f0387e80ed4327d39f1f63da8773ee460af4edd78f7c2efecb4ba9bc0628bf60" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jdt" name="org.eclipse.jdt.core" version="3.42.0">
<artifact name="org.eclipse.jdt.core-3.42.0.jar">
<sha256 value="cac5d217e6df38900c1654f937d6af27ef9b433f59e8a9254b8c693e811517e3" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.eclipse.jetty" name="jetty-annotations" version="9.4.40.v20210413">
<artifact name="jetty-annotations-9.4.40.v20210413.jar">
<sha256 value="faccdc2113daf5ace9157cacd98751a41280fec94f584fd571b7fc26ff84742d" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -4388,11 +4393,6 @@
<sha256 value="e5894b710094b4caafc6280b8829a439fb764901ea0ae18d06ed80388b309b7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-commons" version="1.9.0">
<artifact name="junit-platform-commons-1.9.0.jar">
<sha256 value="e5894b710094b4caafc6280b8829a439fb764901ea0ae18d06ed80388b309b7a" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-engine" version="1.12.1">
<artifact name="junit-platform-engine-1.12.1.jar">
<sha256 value="7fedff93fd92aec7d29fc60dc01fa027246b36b8088423a5efc4949e5f6affa4" origin="Generated by Gradle"/>
Expand All @@ -4403,11 +4403,6 @@
<sha256 value="aaec735f7444a9fc055e206598de3d829c24e9c7a8eea6efdeeb1962087fe811" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-engine" version="1.9.0">
<artifact name="junit-platform-engine-1.9.0.jar">
<sha256 value="aaec735f7444a9fc055e206598de3d829c24e9c7a8eea6efdeeb1962087fe811" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.junit.platform" name="junit-platform-launcher" version="1.12.1">
<artifact name="junit-platform-launcher-1.12.1.jar">
<sha256 value="ebbb14e7b29f60730eaede862ed69d7de0d581ea0c038fa6a202955c7541f525" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -4918,6 +4913,11 @@
<sha256 value="18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.slf4j" name="slf4j-api" version="1.7.32">
<artifact name="slf4j-api-1.7.32.jar">
<sha256 value="3624f8474c1af46d75f98bc097d7864a323c81b3808aa43689a6e1c601c027be" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.slf4j" name="slf4j-api" version="2.0.17">
<artifact name="slf4j-api-2.0.17.jar">
<sha256 value="7b751d952061954d5abfed7181c1f645d336091b679891591d63329c622eb832" origin="Generated by Gradle"/>
Expand Down Expand Up @@ -4983,11 +4983,6 @@
<sha256 value="fea4b91afb5eb68a80007c9d88c8c189b5cd791d39d601d75c92e6f6bb587735" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.spockframework" name="spock-junit4" version="2.3-groovy-4.0">
<artifact name="spock-junit4-2.3-groovy-4.0.jar">
<sha256 value="fea4b91afb5eb68a80007c9d88c8c189b5cd791d39d601d75c92e6f6bb587735" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.subethamail" name="subethasmtp" version="3.1.7">
<artifact name="subethasmtp-3.1.7.jar">
<sha256 value="5196a0da2c5a33d1a04e88fc7a9cc109501bc265b5bac8edd9984a1885070ad4" origin="Generated by Gradle"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ private record IngestPipelinesExecutionResult(
null,
IndexDocFailureStoreStatus.NOT_APPLICABLE_OR_UNKNOWN
);

private static IngestPipelinesExecutionResult failAndStoreFor(String index, Exception e) {
return new IngestPipelinesExecutionResult(false, true, e, index, IndexDocFailureStoreStatus.USED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ record RerankResultEntry(Float relevanceScore, Integer index, @Nullable ObjectPa
PARSER.declareInt(constructorArg(), new ParseField("index"));
PARSER.declareObject(optionalConstructorArg(), ObjectParser.PARSER::apply, new ParseField("document"));
}

public RankedDocsResults.RankedDoc toRankedDoc() {
return new RankedDocsResults.RankedDoc(index, relevanceScore, document == null ? null : document.text);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ private void assertMissingFieldThrowsIllegalArgumentException(String responseJso
assertThat(thrownException.getMessage(), is("Required [" + missingField + "]"));
}

private void assertTopNLimit(
Integer topN, String responseJson, List<RankedDocsResultsTests.RerankExpectation> expectation) throws IOException {
private void assertTopNLimit(Integer topN, String responseJson, List<RankedDocsResultsTests.RerankExpectation> expectation)
throws IOException {
when(REQUEST_MOCK.getTopN()).thenReturn(topN);

RankedDocsResults parsedResults = HuggingFaceRerankResponseEntity.fromResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -907,19 +907,18 @@ public void testSetJobState_withHandler_onResponse_triggersHandlerNull() throws

public void testSetJobState_withHandler_onFailure_triggersHandlerException() throws IOException {
// Verifies that when updatePersistentTaskState reports a failure, the handler receives that exception
when(threadPool.schedule(any(Runnable.class), any(TimeValue.class), any(Executor.class)))
.thenAnswer(invocation -> {
Runnable r = invocation.getArgument(0);
r.run();
return mock(ThreadPool.Cancellable.class);
});
when(threadPool.schedule(any(Runnable.class), any(TimeValue.class), any(Executor.class))).thenAnswer(invocation -> {
Runnable r = invocation.getArgument(0);
r.run();
return mock(ThreadPool.Cancellable.class);
});
AutodetectProcessManager manager = createSpyManager();
JobTask jobTask = mock(JobTask.class);
ResourceNotFoundException boom = new ResourceNotFoundException("boom");
doAnswer(invocation -> {
@SuppressWarnings("unchecked")
ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener =
(ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>>) invocation.getArguments()[1];
ActionListener<PersistentTasksCustomMetadata.PersistentTask<?>> listener = (ActionListener<
PersistentTasksCustomMetadata.PersistentTask<?>>) invocation.getArguments()[1];
listener.onFailure(boom);
return null;
}).when(jobTask).updatePersistentTaskState(any(), any());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ public static WritableIndexExpander create(boolean stateIndexWritable) {
}

private static void mockWhenIndicesAreNotWritable(WritableIndexExpander writableIndexExpander) {
when(writableIndexExpander.getWritableIndices(anyString()))
.thenReturn(new ArrayList<>());
when(writableIndexExpander.getWritableIndices(ArgumentMatchers.<Collection<String>>any()))
.thenReturn(new ArrayList<>());
when(writableIndexExpander.getWritableIndices(anyString())).thenReturn(new ArrayList<>());
when(writableIndexExpander.getWritableIndices(ArgumentMatchers.<Collection<String>>any())).thenReturn(new ArrayList<>());
}

private static void mockWhenIndicesAreWritable(WritableIndexExpander writableIndexExpander) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public enum BinaryStringNumericOperation implements BiFunction<String, Number, S
if (i <= 0) {
return null;
}
checkResultLength(s.length() * c.longValue()); // mul is safe: c's checked by doProcess() to be within Integer's range
checkResultLength(s.length() * c.longValue());// mul is safe: c's checked by doProcess() to be within Integer's range
return s.repeat(i);
});

Expand Down