Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions instrumentation/apache-shenyu-2.4/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,38 @@ dependencies {
exclude("org.codehaus.groovy", "groovy")
}

// the latest version of apache shenyu uses spring-boot 2.7
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:2.7.+") // related dependency
// the latest version of apache shenyu uses spring-boot 3.3
latestDepTestLibrary("org.springframework.boot:spring-boot-starter-test:3.3.+") // related dependency

testInstrumentation(project(":instrumentation:netty:netty-4.1:javaagent"))
}

val latestDepTest = findProperty("testLatestDeps") as Boolean

// spring 6 (spring boot 3) requires java 17
if (latestDepTest) {
otelJava {
minJavaVersionSupported.set(JavaVersion.VERSION_17)
}
}

tasks.withType<Test>().configureEach {
jvmArgs("-Dotel.instrumentation.apache-shenyu.experimental-span-attributes=true")

// required on jdk17
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
jvmArgs("-XX:+IgnoreUnrecognizedVMOptions")

systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)
systemProperty("testLatestDeps", latestDepTest)
}

configurations.testRuntimeClasspath {
resolutionStrategy {
// requires old logback (and therefore also old slf4j)
force("ch.qos.logback:logback-classic:1.2.11")
force("org.slf4j:slf4j-api:1.7.36")
// spring 6 (spring boot 3) uses slf4j 2.0
if (!latestDepTest) {
configurations.testRuntimeClasspath {
resolutionStrategy {
// requires old logback (and therefore also old slf4j)
force("ch.qos.logback:logback-classic:1.2.11")
force("org.slf4j:slf4j-api:1.7.36")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void beforeAll()
InvocationTargetException,
IllegalAccessException {

Class<?> metaDataCache = null;
Class<?> metaDataCache;
try {
metaDataCache = Class.forName("org.apache.shenyu.plugin.global.cache.MetaDataCache");
} catch (ClassNotFoundException e) {
Expand All @@ -87,17 +87,18 @@ static void beforeAll()

cacheMethod.invoke(
cacheInst,
new MetaData(
"123",
"test-shenyu",
"/",
"/a/b/c",
"http",
"shenyu-service",
"hello",
"string",
"test-ext",
true));
MetaData.builder()
.id("123")
.appName("test-shenyu")
.contextPath("/")
.path("/a/b/c")
.rpcType("http")
.serviceName("shenyu-service")
.methodName("hello")
.parameterTypes("string")
.rpcExt("test-ext")
.enabled(true)
.build());
}

@Test
Expand Down
Loading