Skip to content

Commit 2d71a06

Browse files
authored
GH-5643 Move to Java 25 for develop (#5745)
2 parents f23bccb + 4cde184 commit 2d71a06

260 files changed

Lines changed: 3788 additions & 2715 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Set up JDK
1919
uses: actions/setup-java@v4
2020
with:
21-
java-version: 21
21+
java-version: 25
2222
distribution: 'temurin'
2323
cache: maven
2424

.github/workflows/dash-license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Set up JDK
1717
uses: actions/setup-java@v4
1818
with:
19-
java-version: 21
19+
java-version: 25
2020
distribution: 'temurin'
2121
cache: maven
2222
- name: Clean install

.github/workflows/develop-status.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
jdk: [ 21, 25 ]
14+
jdk: [ 25 ]
1515

1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Register JVM thread dump on cancel
1919
uses: ./.github/actions/thread-dump-post
2020
- name: Set up JDK
21-
uses: actions/setup-java@v1
21+
uses: actions/setup-java@v4
2222
with:
2323
java-version: ${{ matrix.jdk }}
24+
distribution: 'temurin'
2425
- name: Cache local Maven repository
2526
uses: actions/cache@v4
2627
with:

.github/workflows/main-status.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
jdk: [ 21, 25 ]
14+
jdk: [ 25 ]
1515

1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Register JVM thread dump on cancel
1919
uses: ./.github/actions/thread-dump-post
2020
- name: Set up JDK
21-
uses: actions/setup-java@v1
21+
uses: actions/setup-java@v4
2222
with:
2323
java-version: ${{ matrix.jdk }}
24+
distribution: 'temurin'
2425
- name: Cache local Maven repository
2526
uses: actions/cache@v4
2627
with:

.github/workflows/pr-verify.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set up JDK
2222
uses: actions/setup-java@v4
2323
with:
24-
java-version: 21
24+
java-version: 25
2525
distribution: 'temurin'
2626
cache: maven
2727
- name: Check formatting
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up JDK
4242
uses: actions/setup-java@v4
4343
with:
44-
java-version: 21
44+
java-version: 25
4545
distribution: 'temurin'
4646
cache: maven
4747
- name: Compile (mvn clean install)
@@ -54,7 +54,7 @@ jobs:
5454
strategy:
5555
fail-fast: true
5656
matrix:
57-
jdk: [ 21, 25 ]
57+
jdk: [ 25 ]
5858
steps:
5959
- uses: actions/checkout@v4
6060
- name: Register JVM thread dump on cancel
@@ -86,7 +86,7 @@ jobs:
8686
- name: Set up JDK
8787
uses: actions/setup-java@v4
8888
with:
89-
java-version: 21
89+
java-version: 25
9090
distribution: 'temurin'
9191
cache: maven
9292
- name: Build
@@ -109,7 +109,7 @@ jobs:
109109
- name: Set up JDK
110110
uses: actions/setup-java@v4
111111
with:
112-
java-version: 21
112+
java-version: 25
113113
distribution: 'temurin'
114114
cache: maven
115115
- name: Build
@@ -132,7 +132,7 @@ jobs:
132132
- name: Set up JDK
133133
uses: actions/setup-java@v4
134134
with:
135-
java-version: 21
135+
java-version: 25
136136
distribution: 'temurin'
137137
cache: maven
138138
- name: Run install
@@ -151,7 +151,7 @@ jobs:
151151
- name: Set up JDK
152152
uses: actions/setup-java@v4
153153
with:
154-
java-version: 21
154+
java-version: 25
155155
distribution: 'temurin'
156156
cache: maven
157157
- name: Install dependencies

compliance/elasticsearch/pom.xml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
<dependency>
5757
<groupId>org.hamcrest</groupId>
5858
<artifactId>hamcrest-library</artifactId>
59-
<version>2.1</version>
6059
<scope>test</scope>
6160
</dependency>
6261
<dependency>
@@ -82,24 +81,9 @@
8281
<scope>test</scope>
8382
</dependency>
8483
<dependency>
85-
<groupId>org.elasticsearch.client</groupId>
86-
<artifactId>transport</artifactId>
87-
<version>${elasticsearch.version}</version>
84+
<groupId>co.elastic.clients</groupId>
85+
<artifactId>elasticsearch-java</artifactId>
8886
<scope>test</scope>
89-
<exclusions>
90-
<exclusion>
91-
<groupId>commons-logging</groupId>
92-
<artifactId>commons-logging</artifactId>
93-
</exclusion>
94-
<exclusion>
95-
<groupId>com.vividsolutions</groupId>
96-
<artifactId>jts</artifactId>
97-
</exclusion>
98-
<exclusion>
99-
<groupId>org.elasticsearch</groupId>
100-
<artifactId>jna</artifactId>
101-
</exclusion>
102-
</exclusions>
10387
</dependency>
10488
<dependency>
10589
<groupId>org.testcontainers</groupId>

compliance/elasticsearch/src/test/java/org/eclipse/rdf4j/sail/elasticsearch/AbstractElasticsearchTest.java

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,9 @@
1111
// Some portions generated by Codex
1212
package org.eclipse.rdf4j.sail.elasticsearch;
1313

14-
import java.net.InetAddress;
1514
import java.util.concurrent.TimeUnit;
1615

17-
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
18-
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
19-
import org.elasticsearch.client.Client;
20-
import org.elasticsearch.client.transport.TransportClient;
21-
import org.elasticsearch.common.settings.Settings;
22-
import org.elasticsearch.common.transport.TransportAddress;
23-
import org.elasticsearch.core.TimeValue;
24-
import org.elasticsearch.transport.client.PreBuiltTransportClient;
16+
import org.apache.hc.core5.http.HttpHost;
2517
import org.junit.jupiter.api.AfterAll;
2618
import org.junit.jupiter.api.Assumptions;
2719
import org.junit.jupiter.api.BeforeAll;
@@ -30,6 +22,14 @@
3022
import org.testcontainers.junit.jupiter.Testcontainers;
3123
import org.testcontainers.utility.DockerImageName;
3224

25+
import co.elastic.clients.elasticsearch.ElasticsearchClient;
26+
import co.elastic.clients.elasticsearch._types.HealthStatus;
27+
import co.elastic.clients.elasticsearch.cluster.HealthResponse;
28+
import co.elastic.clients.json.jackson.JacksonJsonpMapper;
29+
import co.elastic.clients.transport.ElasticsearchTransport;
30+
import co.elastic.clients.transport.rest5_client.Rest5ClientTransport;
31+
import co.elastic.clients.transport.rest5_client.low_level.Rest5Client;
32+
3333
@Testcontainers(disabledWithoutDocker = true)
3434
public abstract class AbstractElasticsearchTest {
3535

@@ -39,6 +39,7 @@ public abstract class AbstractElasticsearchTest {
3939
public static final GenericContainer<?> elasticsearch = new GenericContainer<>(dockerImageName())
4040
.withEnv("discovery.type", "single-node")
4141
.withEnv("cluster.name", CLUSTER_NAME)
42+
.withEnv("xpack.security.enabled", "false")
4243
.withEnv("ES_JAVA_OPTS",
4344
"-Djdk.disableLastUsageTracking=true -XX:-UseContainerSupport -Xms512m -Xmx512m")
4445
.withEnv("JDK_JAVA_OPTIONS",
@@ -47,7 +48,11 @@ public abstract class AbstractElasticsearchTest {
4748
"-Djdk.disableLastUsageTracking=true -XX:-UseContainerSupport -Xms512m -Xmx512m")
4849
.withExposedPorts(9200, 9300);
4950

50-
protected static TransportClient client;
51+
protected static Rest5Client lowLevelClient;
52+
protected static ElasticsearchTransport transport;
53+
protected static ElasticsearchClient client;
54+
protected static String host;
55+
protected static int httpPort;
5156

5257
@BeforeAll
5358
public static void setUpCluster() throws Exception {
@@ -59,37 +64,40 @@ public static void setUpCluster() throws Exception {
5964
Assumptions.assumeTrue(elasticsearch.isRunning(),
6065
"Elasticsearch test container failed to start:\n" + safeLogs());
6166

62-
Settings settings = Settings.builder().put("cluster.name", CLUSTER_NAME).build();
63-
64-
String host = elasticsearch.getHost();
65-
int transportPort = elasticsearch.getMappedPort(9300);
67+
host = elasticsearch.getHost();
68+
httpPort = elasticsearch.getMappedPort(9200);
6669

67-
TransportClient transportClient = new PreBuiltTransportClient(settings)
68-
.addTransportAddress(new TransportAddress(InetAddress.getByName(host), transportPort));
70+
lowLevelClient = Rest5Client.builder(new HttpHost("http", host, httpPort)).build();
71+
transport = new Rest5ClientTransport(lowLevelClient, new JacksonJsonpMapper());
72+
client = new ElasticsearchClient(transport);
6973

70-
waitForClusterReady(transportClient);
71-
72-
client = transportClient;
74+
waitForClusterReady(client);
7375
}
7476

7577
@AfterAll
7678
public static void tearDownCluster() {
7779
if (client != null) {
78-
client.close();
80+
try {
81+
lowLevelClient.close();
82+
} catch (Exception e) {
83+
// ignore during shutdown
84+
}
7985
client = null;
86+
transport = null;
87+
lowLevelClient = null;
8088
}
8189
}
8290

8391
private static DockerImageName dockerImageName() {
8492
String esVersion = System.getProperty("elasticsearch.docker.version",
85-
System.getProperty("elasticsearch.version", "7.15.2"));
93+
System.getProperty("elasticsearch.version", "9.2.4"));
8694

8795
return DockerImageName
8896
.parse("docker.elastic.co/elasticsearch/elasticsearch:" + esVersion)
8997
.asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch");
9098
}
9199

92-
private static void waitForClusterReady(Client client) {
100+
private static void waitForClusterReady(ElasticsearchClient client) {
93101
if (!elasticsearch.isRunning()) {
94102
throw new IllegalStateException("Elasticsearch test container stopped before health check:\n" + safeLogs());
95103
}
@@ -103,12 +111,9 @@ private static void waitForClusterReady(Client client) {
103111
"Elasticsearch test container stopped during health check:\n" + safeLogs());
104112
}
105113
try {
106-
ClusterHealthRequest request = new ClusterHealthRequest()
107-
.waitForYellowStatus()
108-
.timeout(TimeValue.timeValueSeconds(1));
109-
110-
ClusterHealthResponse response = client.admin().cluster().health(request).actionGet();
111-
if (!response.isTimedOut()) {
114+
HealthResponse response = client.cluster()
115+
.health(h -> h.waitForStatus(HealthStatus.Yellow).timeout(t -> t.time("100ms")));
116+
if (!response.timedOut()) {
112117
return;
113118
}
114119
lastFailure = new IllegalStateException("Cluster health timed out waiting for YELLOW status");
@@ -117,7 +122,7 @@ private static void waitForClusterReady(Client client) {
117122
}
118123

119124
try {
120-
Thread.sleep(100);
125+
Thread.sleep(10);
121126
} catch (InterruptedException ie) {
122127
Thread.currentThread().interrupt();
123128
throw new IllegalStateException("Interrupted while waiting for Elasticsearch test cluster", ie);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Eclipse RDF4J contributors.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Distribution License v1.0
6+
* which accompanies this distribution, and is available at
7+
* http://www.eclipse.org/org/documents/edl-v10.php.
8+
*
9+
* SPDX-License-Identifier: BSD-3-Clause
10+
*******************************************************************************/
11+
// Some portions generated by Codex
12+
package org.eclipse.rdf4j.sail.elasticsearch;
13+
14+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
15+
16+
import java.util.Properties;
17+
18+
import org.eclipse.rdf4j.model.IRI;
19+
import org.eclipse.rdf4j.model.ValueFactory;
20+
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
21+
import org.junit.jupiter.api.Test;
22+
23+
public class ElasticsearchIndexHttpTest extends AbstractElasticsearchTest {
24+
25+
private static final ValueFactory VF = SimpleValueFactory.getInstance();
26+
27+
@Test
28+
public void initializeAndIndexOverHttpEndpoint() {
29+
Properties props = new Properties();
30+
props.put(ElasticsearchIndex.TRANSPORT_KEY,
31+
elasticsearch.getHost() + ":" + elasticsearch.getMappedPort(9200));
32+
props.put(ElasticsearchIndex.ELASTICSEARCH_KEY_PREFIX + "cluster.name", CLUSTER_NAME);
33+
props.put(ElasticsearchIndex.INDEX_NAME_KEY, ElasticsearchTestUtils.getNextTestIndexName());
34+
props.put(ElasticsearchIndex.WAIT_FOR_STATUS_KEY, "yellow");
35+
36+
IRI subject = VF.createIRI("urn:subj-http");
37+
IRI predicate = VF.createIRI("urn:pred-http");
38+
39+
ElasticsearchIndex index = new ElasticsearchIndex();
40+
41+
assertDoesNotThrow(() -> {
42+
index.initialize(props);
43+
try {
44+
index.begin();
45+
index.addStatement(VF.createStatement(subject, predicate, VF.createLiteral("value")));
46+
index.commit();
47+
} finally {
48+
index.shutDown();
49+
}
50+
});
51+
}
52+
}

0 commit comments

Comments
 (0)