Skip to content

Commit 7a0fab3

Browse files
feat: Update and adapt to GraalVM for JDK 23 (#2069)
* build(deps): update dependency com.google.cloud:native-image-shared-config to v1.14.0 * disable testDisconnectShouldNotWaitToReadResponse for JDK >= 23 * fix assumption code * fix assumption ii * Revert "fix assumption ii" This reverts commit 2fbd4cb. * Revert "fix assumption code" This reverts commit d355740. * Revert "disable testDisconnectShouldNotWaitToReadResponse for JDK >= 23" This reverts commit e2c988e. * chore: use JUnit4 in tests this is basically not rely on extending TestCase and using @test annotations * use at least 1 Junit38 test * Revert "use at least 1 Junit38 test" This reverts commit 84f3f4f. * fix net http response tests * annotate tests with @RunWith(JUnit4.class) * initialize static members in static block * use static blocks to initialize test classes * format * set up class initialization * convert google-http-client-test to JUnit4 * use java.nio for tests * run with JUnit 4 explicitly * use static block * Revert "use static block" This reverts commit 73ebee2. * Reapply "use static block" This reverts commit 06acc4a. * initialize IS_WINDOWS at build time * prevent cryptic message when initializing FileDataStoreFactory * fix static initialization in AbstractDatastoreFactory * test no IS_WINDOWS * Revert "test no IS_WINDOWS" This reverts commit 3f6483d. * ruling out logger initialization * add test output * safe initialization of ID_PATTERN * remove provided scope depdendency * convert appengine transport to JUnit 4 * add clirr differences * include appengine classes in runtime this allows native compilation * add native config * add reflect-config for appengine * use JUnit4 in GSON tests * fix clirr * port abstract json parser test to JUnit4 * remove unused imports * update clirr again * add native config to gson module * convert jackson module to JUnit4 * make jackson factory instantiation native friendly * config test-only build-time initialization * adapt protocol buffers module to JUnit 4 * initialize test classes at test time * convert xml module to JUnit4 * add test time initialization entries to xml module * format * restore debug setup * add junit test time initialization flags * add junit to gson deps * add junit test-scoped dependency to jackson2 module * add jackson factory to class initialization this is due to one of the test classes statically initializing this factory. * add app engine feature * try setup time feature registration * Revert "try setup time feature registration" This reverts commit eeb9352. * Revert "add app engine feature" This reverts commit e75875b. * add app engine core lib for testing this allows these classes to be included for native testing * add test-scoped dep in test module * use -Pnative-deps * add conflicting dep in native-deps profile for appengine * include appengine in graalvm tests * restore static blocks in google-http-client * restore static blocks in gson module * restore static blocks in jackson * restore static blocks in protobuf * format * restore static initailization in xml module * restore static block in jackson module * format * remove app engine from test --------- Co-authored-by: Mend Renovate <[email protected]>
1 parent 2285bb1 commit 7a0fab3

File tree

93 files changed

+1562
-411
lines changed

Some content is hidden

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

93 files changed

+1562
-411
lines changed

.kokoro/presubmit/graalvm-native-a.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ env_vars: {
2929
}
3030

3131
container_properties {
32-
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.13.0"
32+
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.14.0"
3333
}

.kokoro/presubmit/graalvm-native-b.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ env_vars: {
2929
}
3030

3131
container_properties {
32-
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.13.0"
32+
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.14.0"
3333
}

google-http-client-appengine/pom.xml

+11
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,15 @@
9090
<scope>test</scope>
9191
</dependency>
9292
</dependencies>
93+
<profiles>
94+
<profile>
95+
<id>native-deps</id>
96+
<dependencies>
97+
<dependency>
98+
<groupId>com.google.appengine</groupId>
99+
<artifactId>appengine-api-1.0-sdk</artifactId>
100+
</dependency>
101+
</dependencies>
102+
</profile>
103+
</profiles>
93104
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[
2+
{
3+
"name": "com.google.apphosting.api.DatastorePb$DeleteRequest",
4+
"methods": [
5+
{
6+
"name": "<init>",
7+
"parameterTypes": []
8+
}
9+
]
10+
},
11+
{
12+
"name": "com.google.apphosting.api.DatastorePb$GetRequest",
13+
"methods": [
14+
{
15+
"name": "<init>",
16+
"parameterTypes": []
17+
}
18+
]
19+
},
20+
{
21+
"name": "com.google.apphosting.api.DatastorePb$NextRequest",
22+
"methods": [
23+
{
24+
"name": "<init>",
25+
"parameterTypes": []
26+
}
27+
]
28+
},
29+
{
30+
"name": "com.google.apphosting.api.DatastorePb$PutRequest",
31+
"methods": [
32+
{
33+
"name": "<init>",
34+
"parameterTypes": []
35+
}
36+
]
37+
},
38+
{
39+
"name": "com.google.apphosting.api.DatastorePb$Query",
40+
"methods": [
41+
{
42+
"name": "<init>",
43+
"parameterTypes": []
44+
}
45+
]
46+
}
47+
]

google-http-client-appengine/src/test/java/com/google/api/client/extensions/appengine/http/UrlFetchTransportTest.java

+5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@
1515
package com.google.api.client.extensions.appengine.http;
1616

1717
import junit.framework.TestCase;
18+
import org.junit.Test;
19+
import org.junit.runner.RunWith;
20+
import org.junit.runners.JUnit4;
1821

1922
/**
2023
* Tests {@link UrlFetchTransport}.
2124
*
2225
* @author Tony Aiuto
2326
*/
27+
@RunWith(JUnit4.class)
2428
public class UrlFetchTransportTest extends TestCase {
2529

30+
@Test
2631
public void test() {
2732
new UrlFetchTransport();
2833
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Args=--initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation \

google-http-client-gson/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,10 @@
7272
<groupId>com.google.code.gson</groupId>
7373
<artifactId>gson</artifactId>
7474
</dependency>
75+
<dependency>
76+
<groupId>junit</groupId>
77+
<artifactId>junit</artifactId>
78+
<scope>test</scope>
79+
</dependency>
7580
</dependencies>
7681
</project>

google-http-client-gson/src/test/java/com/google/api/client/json/gson/GsonFactoryTest.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
package com.google.api.client.json.gson;
1616

17+
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.fail;
20+
1721
import com.google.api.client.json.GenericJson;
1822
import com.google.api.client.json.JsonFactory;
1923
import com.google.api.client.json.JsonObjectParser;
@@ -25,6 +29,7 @@
2529
import java.io.InputStream;
2630
import java.nio.charset.StandardCharsets;
2731
import java.util.ArrayList;
32+
import org.junit.Test;
2833

2934
/**
3035
* Tests {@link GsonFactory}.
@@ -58,21 +63,19 @@ public class GsonFactoryTest extends AbstractJsonFactoryTest {
5863
+ GSON_LINE_SEPARATOR
5964
+ "}";
6065

61-
public GsonFactoryTest(String name) {
62-
super(name);
63-
}
64-
6566
@Override
6667
protected JsonFactory newFactory() {
6768
return new GsonFactory();
6869
}
6970

71+
@Test
7072
public final void testToPrettyString_entry() throws Exception {
7173
Entry entry = new Entry();
7274
entry.title = "foo";
7375
assertEquals(JSON_ENTRY_PRETTY, newFactory().toPrettyString(entry));
7476
}
7577

78+
@Test
7679
public final void testToPrettyString_Feed() throws Exception {
7780
Feed feed = new Feed();
7881
Entry entryFoo = new Entry();
@@ -85,11 +88,13 @@ public final void testToPrettyString_Feed() throws Exception {
8588
assertEquals(JSON_FEED_PRETTY, newFactory().toPrettyString(feed));
8689
}
8790

91+
@Test
8892
public final void testParse_directValue() throws IOException {
8993
JsonParser parser = newFactory().createJsonParser("123");
9094
assertEquals(123, parser.parse(Integer.class, true));
9195
}
9296

97+
@Test
9398
public final void testGetByteValue() throws IOException {
9499
JsonParser parser = newFactory().createJsonParser("123");
95100

@@ -101,6 +106,7 @@ public final void testGetByteValue() throws IOException {
101106
}
102107
}
103108

109+
@Test
104110
public final void testReaderLeniency_lenient() throws IOException {
105111
JsonObjectParser parser =
106112
new JsonObjectParser(GsonFactory.builder().setReadLeniency(true).build());
@@ -113,6 +119,7 @@ public final void testReaderLeniency_lenient() throws IOException {
113119
assertEquals("foo", json.get("title"));
114120
}
115121

122+
@Test
116123
public final void testReaderLeniency_not_lenient_by_default() throws IOException {
117124
JsonObjectParser parser = new JsonObjectParser(GsonFactory.getDefaultInstance());
118125

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Args=--initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation

google-http-client-jackson2/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,10 @@
7171
<groupId>com.fasterxml.jackson.core</groupId>
7272
<artifactId>jackson-core</artifactId>
7373
</dependency>
74+
<dependency>
75+
<groupId>junit</groupId>
76+
<artifactId>junit</artifactId>
77+
<scope>test</scope>
78+
</dependency>
7479
</dependencies>
7580
</project>

google-http-client-jackson2/src/test/java/com/google/api/client/json/jackson2/JacksonFactoryTest.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@
1414

1515
package com.google.api.client.json.jackson2;
1616

17+
import static org.junit.Assert.assertEquals;
18+
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.fail;
20+
1721
import com.google.api.client.json.JsonFactory;
1822
import com.google.api.client.json.JsonParser;
1923
import com.google.api.client.test.json.AbstractJsonFactoryTest;
2024
import com.google.api.client.util.StringUtils;
2125
import java.io.IOException;
2226
import java.util.ArrayList;
27+
import org.junit.Test;
2328

2429
/**
2530
* Tests {@link JacksonFactory}.
@@ -45,21 +50,19 @@ public class JacksonFactoryTest extends AbstractJsonFactoryTest {
4550
+ StringUtils.LINE_SEPARATOR
4651
+ "}";
4752

48-
public JacksonFactoryTest(String name) {
49-
super(name);
50-
}
51-
5253
@Override
5354
protected JsonFactory newFactory() {
5455
return new JacksonFactory();
5556
}
5657

58+
@Test
5759
public final void testToPrettyString_entry() throws Exception {
5860
Entry entry = new Entry();
5961
entry.title = "foo";
6062
assertEquals(JSON_ENTRY_PRETTY, newFactory().toPrettyString(entry));
6163
}
6264

65+
@Test
6366
public final void testToPrettyString_Feed() throws Exception {
6467
Feed feed = new Feed();
6568
Entry entryFoo = new Entry();
@@ -72,11 +75,13 @@ public final void testToPrettyString_Feed() throws Exception {
7275
assertEquals(JSON_FEED_PRETTY, newFactory().toPrettyString(feed));
7376
}
7477

78+
@Test
7579
public final void testParse_directValue() throws Exception {
7680
JsonParser parser = newFactory().createJsonParser("123");
7781
assertEquals(123, parser.parse(Integer.class, true));
7882
}
7983

84+
@Test
8085
public final void testGetByteValue() throws IOException {
8186
JsonParser parser = newFactory().createJsonParser("123");
8287

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
Args=--initialize-at-build-time=com.google.api.client.json.jackson2.JacksonFactoryTest \
22
--initialize-at-build-time=com.google.api.client.json.jackson2.JacksonGeneratorTest \
3-
--initialize-at-build-time=com.fasterxml.jackson.core.io.SerializedString \
4-
--initialize-at-build-time=com.fasterxml.jackson.core.io.CharTypes \
5-
--initialize-at-build-time=com.fasterxml.jackson.core.JsonFactory \
6-
--initialize-at-build-time=com.fasterxml.jackson.core.io.JsonStringEncoder \
7-
--initialize-at-build-time=com.google.api.client.util.StringUtils
3+
--initialize-at-build-time=com.google.api.client.json.jackson2.JacksonFactory \
4+
--initialize-at-build-time=com.google.api.client.util.StringUtils \
5+
--initialize-at-build-time=com.fasterxml.jackson.core \
6+
--initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Args=--initialize-at-build-time=org.junit.runner.RunWith,java.lang.annotation.Annotation

google-http-client-protobuf/src/test/java/com/google/api/client/protobuf/ProtocolBuffersTest.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,22 @@
1414

1515
package com.google.api.client.protobuf;
1616

17+
import static org.junit.Assert.assertEquals;
18+
1719
import java.io.ByteArrayInputStream;
18-
import junit.framework.TestCase;
20+
import org.junit.Test;
21+
import org.junit.runner.RunWith;
22+
import org.junit.runners.JUnit4;
1923

2024
/**
2125
* Tests {@link ProtocolBuffers}.
2226
*
2327
* @author Yaniv Inbar
2428
*/
25-
public class ProtocolBuffersTest extends TestCase {
29+
@RunWith(JUnit4.class)
30+
public class ProtocolBuffersTest {
2631

32+
@Test
2733
public void testParseAndClose() throws Exception {
2834
SimpleProto.TestMessage mockResponse =
2935
SimpleProto.TestMessage.newBuilder()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- see http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html -->
3+
<!--
4+
[ERROR] 4001: com.google.api.client.test.json.AbstractJsonFactoryTest: Removed junit.framework.Test from the set of implemented interfaces
5+
[ERROR] 5001: com.google.api.client.test.json.AbstractJsonFactoryTest: Removed junit.framework.Assert from the list of superclasses
6+
[ERROR] 5001: com.google.api.client.test.json.AbstractJsonFactoryTest: Removed junit.framework.TestCase from the list of superclasses
7+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_EMPTY is no longer a compile-time constant
8+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_EMPTY_OUTPUT is no longer a compile-time constant
9+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_FALSE is no longer a compile-time constant
10+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_NULL is no longer a compile-time constant
11+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_NULL_OUTPUT is no longer a compile-time constant
12+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_TRUE is no longer a compile-time constant
13+
[WARNING] 6002: com.google.api.client.test.json.AbstractJsonFactoryTest: Value of field BOOLEAN_TYPE_WRONG is no longer a compile-time constant
14+
[ERROR] 7004: com.google.api.client.test.json.AbstractJsonFactoryTest: In method 'public AbstractJsonFactoryTest(java.lang.String)' the number of arguments has changed
15+
[ERROR] 4001: com.google.api.client.test.json.AbstractJsonGeneratorTest: Removed junit.framework.Test from the set of implemented interfaces
16+
[ERROR] 5001: com.google.api.client.test.json.AbstractJsonGeneratorTest: Removed junit.framework.Assert from the list of superclasses
17+
[ERROR] 5001: com.google.api.client.test.json.AbstractJsonGeneratorTest: Removed junit.framework.TestCase from the list of superclasses
18+
[ERROR] 4001: com.google.api.client.test.json.AbstractJsonParserTest: Removed junit.framework.Test from the set of implemented interfaces [ERROR] 5001: com.google.api.client.test.json.AbstractJsonParserTest: Removed junit.framework.Assert from the list of superclasses [ERROR] 5001: com.google.api.client.test.json.AbstractJsonParserTest: Removed junit.framework.TestCase from the list of superclasses
19+
-->
20+
<differences>
21+
<difference>
22+
<!-- migration to JUnit 4 -->
23+
<differenceType>4001</differenceType>
24+
<className>com/google/api/client/test/util/store/AbstractDataStoreFactoryTest</className>
25+
<to>junit/framework/Test</to>
26+
</difference>
27+
<difference>
28+
<!-- migration to JUnit 4 -->
29+
<differenceType>4001</differenceType>
30+
<className>com/google/api/client/test/json/AbstractJsonFactoryTest</className>
31+
<to>junit/framework/Test</to>
32+
</difference>
33+
<difference>
34+
<!-- migration to JUnit 4 -->
35+
<differenceType>4001</differenceType>
36+
<className>com/google/api/client/test/json/AbstractJsonGeneratorTest</className>
37+
<to>junit/framework/Test</to>
38+
</difference>
39+
<difference>
40+
<!-- migration to JUnit 4 -->
41+
<differenceType>4001</differenceType>
42+
<className>com/google/api/client/test/json/AbstractJsonParserTest</className>
43+
<to>junit/framework/Test</to>
44+
</difference>
45+
<difference>
46+
<!-- migration to JUnit 4 -->
47+
<differenceType>5001</differenceType>
48+
<className>com/google/api/client/test/util/store/AbstractDataStoreFactoryTest</className>
49+
<to>junit/framework/*</to>
50+
</difference>
51+
<difference>
52+
<!-- migration to JUnit 4 -->
53+
<differenceType>5001</differenceType>
54+
<className>com/google/api/client/test/json/AbstractJsonFactoryTest</className>
55+
<to>junit/framework/*</to>
56+
</difference>
57+
<difference>
58+
<!-- migration to JUnit 4 -->
59+
<differenceType>5001</differenceType>
60+
<className>com/google/api/client/test/json/AbstractJsonGeneratorTest</className>
61+
<to>junit/framework/*</to>
62+
</difference>
63+
<difference>
64+
<!-- migration to JUnit 4 -->
65+
<differenceType>5001</differenceType>
66+
<className>com/google/api/client/test/json/AbstractJsonParserTest</className>
67+
<to>junit/framework/*</to>
68+
</difference>
69+
<difference>
70+
<!-- migration to JUnit 4 -->
71+
<differenceType>7004</differenceType>
72+
<className>com/google/api/client/test/json/AbstractJsonFactoryTest</className>
73+
<method>*</method>
74+
</difference>
75+
</differences>

0 commit comments

Comments
 (0)