Consider Simulacron and Commons Exec as optional dependencies
This commit changes these dependencies to optional. This allows
the OSGi bundle to declare such dependencies as optional package
imports, thus limiting the number of bundles that need to be
provisioned for it.
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index c39b5fc..6dc3126 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -187,6 +187,16 @@
<artifactId>wiremock</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.datastax.oss.simulacron</groupId>
+ <artifactId>simulacron-native-server</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-exec</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/test-infra/pom.xml b/test-infra/pom.xml
index 6ec58ab..8def9e2 100644
--- a/test-infra/pom.xml
+++ b/test-infra/pom.xml
@@ -56,13 +56,17 @@
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
+ <!-- only required for Simulacron tests -->
<dependency>
<groupId>com.datastax.oss.simulacron</groupId>
<artifactId>simulacron-native-server</artifactId>
+ <optional>true</optional>
</dependency>
+ <!-- only required for CCM tests -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
diff --git a/test-infra/revapi.json b/test-infra/revapi.json
index 7e56d05..dd6af30 100644
--- a/test-infra/revapi.json
+++ b/test-infra/revapi.json
@@ -100,6 +100,36 @@
"old": "field com.datastax.oss.driver.api.testinfra.ccm.CcmBridge.DEFAULT_SERVER_TRUSTSTORE_PASSWORD",
"new": "field com.datastax.oss.driver.api.testinfra.ccm.CcmBridge.DEFAULT_SERVER_TRUSTSTORE_PASSWORD",
"justification": "JAVA-2620: Use clearly dummy passwords in tests"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.common.cluster.ClusterSpec",
+ "justification":"Dependency was made optional"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.common.cluster.ClusterSpec.Builder",
+ "justification":"Dependency was made optional"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.common.cluster.QueryLog",
+ "justification":"Dependency was made optional"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.server.BoundCluster",
+ "justification":"Dependency was made optional"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.server.BoundTopic",
+ "justification":"Dependency was made optional"
+ },
+ {
+ "code": "java.missing.newClass",
+ "new": "missing-class com.datastax.oss.simulacron.server.Server",
+ "justification":"Dependency was made optional"
}
]
}
diff --git a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
index 8e37612..df5f1af 100644
--- a/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
+++ b/test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/ccm/CcmBridge.java
@@ -15,8 +15,6 @@
*/
package com.datastax.oss.driver.api.testinfra.ccm;
-import static io.netty.util.internal.PlatformDependent.isWindows;
-
import com.datastax.oss.driver.api.core.Version;
import com.datastax.oss.driver.shaded.guava.common.base.Joiner;
import com.datastax.oss.driver.shaded.guava.common.io.Resources;
@@ -32,6 +30,7 @@
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
@@ -167,6 +166,11 @@
this.dseWorkloads = dseWorkloads;
}
+ // Copied from Netty's PlatformDependent to avoid the dependency on Netty
+ private static boolean isWindows() {
+ return System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win");
+ }
+
public Optional<Version> getDseVersion() {
return DSE_ENABLEMENT ? Optional.of(VERSION) : Optional.empty();
}