feat: find oldest supported spark, update version, make tests run
MODIFY
dd-java-agent/instrumentation/jetty-8/jetty-8.gradle
dd-java-agent/instrumentation/jetty-8/jetty-8.gradle
@@ -3,7 +3,7 @@ apply plugin: 'version-scan'
versionScan {
group = "org.eclipse.jetty.server"
module = 'org.eclipse.jetty.server-Handler'
- versions = "[3.0,)"
+ versions = "[8.0.0.v20110901,)"
verifyPresent = [
"javax.servlet.AsyncEvent" : null,
"javax.servlet.AsyncListener": null,

RENAME
dd-java-agent/instrumentation/sparkjava-2.5/sparkjava-2.5.gradle
dd-java-agent/instrumentation/sparkjava-2.3/sparkjava-2.3.gradle
@@ -2,8 +2,8 @@ apply plugin: 'version-scan'
versionScan {
group = "spark"
- module = 'spark.routes-Routes'
- versions = "[3.0,)"
+ module = 'spark'
+ versions = "[2.3,)"
verifyPresent = [
"spark.embeddedserver.jetty.EmbeddedJettyServer" : null
]
@@ -18,6 +18,9 @@ if (JavaVersion.current().isJava8Compatible()) {
// Sparkjava is not compatible with < Java 8
exclude '**/SparkJavaBasedTest.groovy'
}
+ java {
+ exclude '**/TestSparkJavaApplication.java'
+ }
}
}
}
@@ -28,7 +31,7 @@ dependencies {
compile deps.bytebuddy
compile deps.opentracing
compile deps.autoservice
- compile group: 'com.sparkjava', name: 'spark-core', version: '2.5'
+ compile group: 'com.sparkjava', name: 'spark-core', version: '2.3'
testCompile project(':dd-java-agent:instrumentation:jetty-8')
testCompile project(':dd-java-agent:testing')

RENAME
dd-java-agent/instrumentation/sparkjava-2.5/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
dd-java-agent/instrumentation/sparkjava-2.3/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
@@ -16,7 +16,7 @@ import spark.routematch.RouteMatch;
public class RoutesInstrumentation extends Instrumenter.Configurable {
public RoutesInstrumentation() {
- super("sparkjava", "sparkjava-2");
+ super("sparkjava", "sparkjava-2.3");
}
@Override

RENAME
dd-java-agent/instrumentation/sparkjava-2.5/src/test/groovy/SparkJavaBasedTest.groovy
dd-java-agent/instrumentation/sparkjava-2.3/src/test/groovy/SparkJavaBasedTest.groovy
ADD
dd-java-agent/instrumentation/sparkjava-2.3/src/test/java/TestSparkJavaApplication.java
+import spark.Spark;
+
+public class TestSparkJavaApplication {
+
+ public static void main(final String[] args) {
+
+ Spark.get("/", (req, res) -> "Hello World");
+
+ Spark.get("/param/:param", (req, res) -> "Hello " + req.params("param"));
+
+ Spark.get(
+ "/exception/:param",
+ (req, res) -> {
+ throw new RuntimeException(req.params("param"));
+ });
+ }
+}

DELETE
dd-java-agent/instrumentation/sparkjava-2.5/src/test/java/TestSparkJavaApplication.java
-import spark.Request;
-import spark.Response;
-import spark.Route;
-import spark.Spark;
-
-public class TestSparkJavaApplication {
-
- public static void main(final String[] args) {
-
- Spark.get(
- "/",
- new Route() {
- @Override
- public Object handle(Request request, Response response) throws Exception {
- return "Hello World";
- }
- });
-
- Spark.get(
- "/param/:param",
- new Route() {
- @Override
- public Object handle(Request request, Response response) throws Exception {
- return "Hello " + request.params("param");
- }
- });
-
- Spark.get(
- "/exception/:param",
- new Route() {
- @Override
- public Object handle(Request request, Response response) throws Exception {
- throw new RuntimeException(request.params("param"));
- }
- });
- }
-}

MODIFY
settings.gradle
settings.gradle
@@ -35,7 +35,7 @@ include ':dd-java-agent:instrumentation:play-2.4:play-2.6-testing'
include ':dd-java-agent:instrumentation:ratpack-1.4'
include ':dd-java-agent:instrumentation:servlet-2'
include ':dd-java-agent:instrumentation:servlet-3'
-include ':dd-java-agent:instrumentation:sparkjava-2.5'
+include ':dd-java-agent:instrumentation:sparkjava-2.3'
include ':dd-java-agent:instrumentation:spring-web'
include ':dd-java-agent:instrumentation:trace-annotation'

feat: find oldest supported spark, update version, make tests run