Skip to content

Commit 3c4aa0e

Browse files
authored
JAVA-3116: update surefire/failsafe to 3.0.0 to fix issue running tests with specified jvm (#1719)
Additionally: - Set --jvm_version=8 when running dse 6.8.19+ with graph workloads (DSP-23501) - Update commons-configuration2 to 2.9.0 + deps in BundleOptions to support java17 - Update felix framework version to 7.0.1 for java17 (FELIX-6287) - Pick up newer bndlib for ArrayIndexOutOfBounds error printed with OsgiGraphIT (bndtools/bnd issue#3405) - Update pax-url-wrap to 2.6.4 (and bring pax-url-reference up to the same version) - Force newer tinybundles version 3.0.0 (default 2.1.1 version required older bndlib)
1 parent acd1cc3 commit 3c4aa0e

File tree

3 files changed

+60
-8
lines changed

3 files changed

+60
-8
lines changed

osgi-tests/src/test/java/com/datastax/oss/driver/internal/osgi/support/BundleOptions.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,10 @@ public static CompositeOption tinkerpopBundles() {
152152
.overwriteManifest(WrappedUrlProvisionOption.OverwriteMode.FULL),
153153
// Note: the versions below are hard-coded because they shouldn't change very often,
154154
// but if the tests fail because of them, we should consider parameterizing them
155-
mavenBundle("com.sun.mail", "mailapi", "1.6.4"),
155+
mavenBundle("com.sun.activation", "jakarta.activation", "2.0.1"),
156+
mavenBundle("com.sun.mail", "mailapi", "2.0.1"),
156157
mavenBundle("org.apache.commons", "commons-text", "1.8"),
157-
mavenBundle("org.apache.commons", "commons-configuration2", "2.7"),
158+
mavenBundle("org.apache.commons", "commons-configuration2", "2.9.0"),
158159
CoreOptions.wrappedBundle(mavenBundle("commons-logging", "commons-logging", "1.1.1"))
159160
.exports("org.apache.commons.logging.*")
160161
.bundleVersion("1.1.1")

pom.xml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@
6868
<junit.version>4.13.2</junit.version>
6969
<logback.version>1.2.3</logback.version>
7070
<osgi.version>6.0.0</osgi.version>
71-
<felix.version>6.0.3</felix.version>
71+
<felix.version>7.0.1</felix.version>
7272
<pax-exam.version>4.13.4</pax-exam.version>
73+
<pax-url.version>2.6.4</pax-url.version>
7374
<simulacron.version>0.11.0</simulacron.version>
7475
<jsr353-api.version>1.1.4</jsr353-api.version>
7576
<jersey.version>2.31</jersey.version>
@@ -79,7 +80,7 @@
7980
<rxjava.version>2.2.2</rxjava.version>
8081
<awaitility.version>4.0.3</awaitility.version>
8182
<apacheds.version>2.0.0-M19</apacheds.version>
82-
<surefire.version>2.22.2</surefire.version>
83+
<surefire.version>3.0.0</surefire.version>
8384
<graalapi.version>22.0.0.2</graalapi.version>
8485
<skipTests>false</skipTests>
8586
<skipUnitTests>${skipTests}</skipUnitTests>
@@ -269,12 +270,17 @@
269270
<dependency>
270271
<groupId>org.ops4j.pax.url</groupId>
271272
<artifactId>pax-url-wrap</artifactId>
272-
<version>2.6.3</version>
273+
<version>${pax-url.version}</version>
273274
</dependency>
274275
<dependency>
275276
<groupId>org.ops4j.pax.url</groupId>
276277
<artifactId>pax-url-reference</artifactId>
277-
<version>2.6.2</version>
278+
<version>${pax-url.version}</version>
279+
</dependency>
280+
<dependency>
281+
<groupId>org.ops4j.pax.tinybundles</groupId>
282+
<artifactId>tinybundles</artifactId>
283+
<version>3.0.0</version>
278284
</dependency>
279285
<dependency>
280286
<groupId>org.glassfish</groupId>

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.apache.commons.exec.Executor;
4545
import org.apache.commons.exec.LogOutputStream;
4646
import org.apache.commons.exec.PumpStreamHandler;
47+
import org.assertj.core.util.Lists;
4748
import org.slf4j.Logger;
4849
import org.slf4j.LoggerFactory;
4950

@@ -267,8 +268,11 @@ public void reloadCore(int node, String keyspace, String table, boolean reindex)
267268

268269
public void start() {
269270
if (started.compareAndSet(false, true)) {
271+
List<String> cmdAndArgs = Lists.newArrayList("start", jvmArgs, "--wait-for-binary-proto");
272+
overrideJvmVersionForDseWorkloads()
273+
.ifPresent(jvmVersion -> cmdAndArgs.add(String.format("--jvm_version=%d", jvmVersion)));
270274
try {
271-
execute("start", jvmArgs, "--wait-for-binary-proto");
275+
execute(cmdAndArgs.toArray(new String[0]));
272276
} catch (RuntimeException re) {
273277
// if something went wrong starting CCM, see if we can also dump the error
274278
executeCheckLogError();
@@ -296,7 +300,10 @@ public void resume(int n) {
296300
}
297301

298302
public void start(int n) {
299-
execute("node" + n, "start");
303+
List<String> cmdAndArgs = Lists.newArrayList("node" + n, "start");
304+
overrideJvmVersionForDseWorkloads()
305+
.ifPresent(jvmVersion -> cmdAndArgs.add(String.format("--jvm_version=%d", jvmVersion)));
306+
execute(cmdAndArgs.toArray(new String[0]));
300307
}
301308

302309
public void stop(int n) {
@@ -416,6 +423,44 @@ private static File createTempStore(String storePath) {
416423
return f;
417424
}
418425

426+
/**
427+
* Get the current JVM major version (1.8.0_372 -> 8, 11.0.19 -> 11)
428+
*
429+
* @return major version of current JVM
430+
*/
431+
private static int getCurrentJvmMajorVersion() {
432+
String version = System.getProperty("java.version");
433+
if (version.startsWith("1.")) {
434+
version = version.substring(2, 3);
435+
} else {
436+
int dot = version.indexOf(".");
437+
if (dot != -1) {
438+
version = version.substring(0, dot);
439+
}
440+
}
441+
return Integer.parseInt(version);
442+
}
443+
444+
private Optional<Integer> overrideJvmVersionForDseWorkloads() {
445+
if (getCurrentJvmMajorVersion() <= 8) {
446+
return Optional.empty();
447+
}
448+
449+
if (!DSE_ENABLEMENT || !getDseVersion().isPresent()) {
450+
return Optional.empty();
451+
}
452+
453+
if (getDseVersion().get().compareTo(Version.parse("6.8.19")) < 0) {
454+
return Optional.empty();
455+
}
456+
457+
if (dseWorkloads.contains("graph")) {
458+
return Optional.of(8);
459+
}
460+
461+
return Optional.empty();
462+
}
463+
419464
public static Builder builder() {
420465
return new Builder();
421466
}

0 commit comments

Comments
 (0)