diff --git a/.github/workflows/plugins-jdk14-test.0.yaml b/.github/workflows/plugins-jdk14-test.0.yaml
index 9c5bb1448..88d693c34 100644
--- a/.github/workflows/plugins-jdk14-test.0.yaml
+++ b/.github/workflows/plugins-jdk14-test.0.yaml
@@ -62,8 +62,9 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: adopt
java-version: 14
- name: Run Test
uses: ./.github/actions/run
diff --git a/.github/workflows/plugins-jdk17-test.0.yaml b/.github/workflows/plugins-jdk17-test.0.yaml
new file mode 100644
index 000000000..0d025dce6
--- /dev/null
+++ b/.github/workflows/plugins-jdk17-test.0.yaml
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: Test
+
+on:
+ pull_request:
+ paths:
+ - '.github/workflows/plugins-*.yaml'
+ - 'apm-application-toolkit/**'
+ - 'apm-commons/**'
+ - 'apm-protocol/**'
+ - 'apm-sniffer/**'
+ - 'test/plugin/**'
+ - '**/pom.xml'
+ - '!**.md'
+ push:
+ branches:
+ - test/ci/*
+
+concurrency:
+ group: plugins-jdk17-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - name: Build
+ uses: ./.github/actions/build
+ with:
+ java_version: jdk17
+
+ test:
+ needs: [ build ]
+ name: ${{ matrix.case }}
+ runs-on: ubuntu-latest
+ timeout-minutes: 90
+ strategy:
+ matrix:
+ case:
+ - jdk17-with-gson-scenario
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - uses: actions/setup-java@v2
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Run Test
+ uses: ./.github/actions/run
+ with:
+ test_case: ${{ matrix.case }}
+ java_version: jdk17
diff --git a/.github/workflows/plugins-test.0.yaml b/.github/workflows/plugins-test.0.yaml
index a6692a2b9..3c2b3553f 100644
--- a/.github/workflows/plugins-test.0.yaml
+++ b/.github/workflows/plugins-test.0.yaml
@@ -90,8 +90,9 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: adopt
java-version: 8
- name: Run Plugin Test
uses: ./.github/actions/run
diff --git a/.github/workflows/plugins-test.1.yaml b/.github/workflows/plugins-test.1.yaml
index 4dc1b6cbc..0674b0b28 100644
--- a/.github/workflows/plugins-test.1.yaml
+++ b/.github/workflows/plugins-test.1.yaml
@@ -81,8 +81,9 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: adopt
java-version: 8
- name: Run Plugin Test
uses: ./.github/actions/run
diff --git a/.github/workflows/plugins-test.2.yaml b/.github/workflows/plugins-test.2.yaml
index 44489ee91..a67c2a2b9 100644
--- a/.github/workflows/plugins-test.2.yaml
+++ b/.github/workflows/plugins-test.2.yaml
@@ -83,8 +83,9 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: adopt
java-version: 8
- name: Run Plugin Test
uses: ./.github/actions/run
diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml
index da18a1243..dae3a5131 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -96,8 +96,9 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- - uses: actions/setup-java@v1
+ - uses: actions/setup-java@v2
with:
+ distribution: adopt
java-version: 8
- name: Install Oracle Libs
if: matrix.case == 'oracle-scenario'
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-test.md b/docs/en/setup/service-agent/java-agent/Plugin-test.md
index 218001a7c..84769ba2a 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-test.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-test.md
@@ -20,17 +20,18 @@ The test framework provides `JVM-container` and `Tomcat-container` base images i
### JVM-container Image Introduction
-[JVM-container](../../../../../test/plugin/containers/jvm-container) uses `openjdk:8` as the base image. `JVM-container` supports JDK14, which inherits `openjdk:14`.
+[JVM-container](../../../../../test/plugin/containers/jvm-container) uses `adoptopenjdk/openjdk8:alpine-jre` as the base image. `JVM-container` supports JDK14 and JDK17 as well, which inherits `adoptopenjdk/openjdk8:alpine-jre` and `eclipse-temurin:17-alpine`.
The test case project must be packaged as `project-name.zip`, including `startup.sh` and uber jar, by using `mvn clean package`.
Take the following test projects as examples:
* [sofarpc-scenario](../../../../../test/plugin/scenarios/sofarpc-scenario) is a single project case.
* [webflux-scenario](../../../../../test/plugin/scenarios/webflux-scenario) is a case including multiple projects.
* [jdk14-with-gson-scenario](../../../../../test/plugin/scenarios/jdk14-with-gson-scenario) is a single project case with JDK14.
+* [jdk17-with-gson-scenario](../../../../../test/plugin/scenarios/jdk17-with-gson-scenario) is a single project case with JDK17.
### Tomcat-container Image Introduction
-[Tomcat-container](../../../../../test/plugin/containers/tomcat-container) uses `tomcat:8.5.57-jdk8-openjdk` or `tomcat:8.5.57-jdk14-openjdk` as the base image.
+[Tomcat-container](../../../../../test/plugin/containers/tomcat-container) uses `tomcat:8.5-jdk8-openjdk`, `tomcat:8.5-jdk14-openjdk` or `tomcat:8.5-jdk17-openjdk` as the base image.
The test case project must be packaged as `project-name.war` by using `mvn package`.
Take the following test project as an example
diff --git a/test/plugin/containers/jvm-container/pom.xml b/test/plugin/containers/jvm-container/pom.xml
index ecf5463d1..cc1297eaa 100644
--- a/test/plugin/containers/jvm-container/pom.xml
+++ b/test/plugin/containers/jvm-container/pom.xml
@@ -31,6 +31,46 @@
jvm-containerSkyWalking JVM Runner Image
+
+
+
+ io.fabric8
+ docker-maven-plugin
+ 0.33.0
+
+
+
+ skywalking/agent-test-jvm:${java.version}-${project.version}
+
+ ${base.image.java}
+ /usr/local/skywalking/scenario
+
+ dir
+ /usr/local/skywalking
+ assembly.xml
+
+
+ chmod +x /usr/local/skywalking/run.sh
+ tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
+ apk add --no-cache bash curl
+
+ ["/usr/local/skywalking/run.sh"]
+
+
+
+
+
+
+ build
+ package
+
+ build
+
+
+
+
+
+
@@ -38,88 +78,24 @@
true
-
-
-
- io.fabric8
- docker-maven-plugin
- 0.33.0
-
-
-
- skywalking/agent-test-jvm:jdk8-${project.version}
-
- openjdk:8u102
- /usr/local/skywalking/scenario
-
- dir
- /usr/local/skywalking
- assembly.xml
-
-
- chmod +x /usr/local/skywalking/run.sh
- tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
-
- ["/usr/local/skywalking/run.sh"]
-
-
-
-
-
-
- build
- package
-
- build
-
-
-
-
-
-
+
+ adoptopenjdk/openjdk8:alpine
+ jdk8
+
-
jdk14
-
-
-
- io.fabric8
- docker-maven-plugin
- 0.33.0
-
-
-
- skywalking/agent-test-jvm:jdk14-${project.version}
-
- openjdk:14-buster
- /usr/local/skywalking/scenario
-
- dir
- /usr/local/skywalking
- assembly.xml
-
-
- chmod +x /usr/local/skywalking/run.sh
- tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
-
- ["/usr/local/skywalking/run.sh"]
-
-
-
-
-
-
- build
- package
-
- build
-
-
-
-
-
-
+
+ adoptopenjdk/openjdk14:alpine
+ jdk14
+
+
+
+ jdk17
+
+ eclipse-temurin:17-alpine
+ jdk17
+
diff --git a/test/plugin/containers/jvm-container/src/main/docker/run.sh b/test/plugin/containers/jvm-container/src/main/docker/run.sh
index 03426b797..4f968dfed 100644
--- a/test/plugin/containers/jvm-container/src/main/docker/run.sh
+++ b/test/plugin/containers/jvm-container/src/main/docker/run.sh
@@ -16,15 +16,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-set -ex
[[ -n $DEBUG_MODE ]] && export
-function exitOnError() {
+exitOnError() {
echo -e "\033[31m[ERROR] $1\033[0m">&2
exitAndClean 1
}
-function exitAndClean() {
+exitAndClean() {
[[ -n $DEBUG_MODE ]] && exit $1;
[[ -f ${SCENARIO_HOME}/data/actualData.yaml ]] && rm -rf ${SCENARIO_HOME}/data/actualData.yaml
@@ -32,21 +31,23 @@ function exitAndClean() {
exit $1
}
-function healthCheck() {
+healthCheck() {
HEALTH_CHECK_URL=$1
- STATUS_CODE="-1"
+ STATUS=""
TIMES=${TIMES:-150}
- for ((i=1; i<=${TIMES}; i++));
+ i=1
+ while [[ $i -lt ${TIMES} ]];
do
- STATUS_CODE="$(curl --max-time 3 -Is ${HEALTH_CHECK_URL} | head -n 1)"
- if [[ $STATUS_CODE == *"200"* ]]; then
- echo "${HEALTH_CHECK_URL}: ${STATUS_CODE}"
+ STATUS=$(curl --max-time 3 -Is ${HEALTH_CHECK_URL} | grep -oE "HTTP/.*\s+200")
+ if [[ -n "$STATUS" ]]; then
+ echo "${HEALTH_CHECK_URL}: ${STATUS}"
return 0
fi
sleep 2
+ i=$(($i + 1))
done
- exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION} url=${HEALTH_CHECK_URL}, status=${STATUS_CODE} health check failed!"
+ exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION} url=${HEALTH_CHECK_URL}, status=${STATUS} health check failed!"
}
if [[ -z "${SCENARIO_START_SCRIPT}" ]]; then
@@ -66,7 +67,7 @@ if [[ ! -f /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} ]]; then
fi
echo "To start mock collector"
-${TOOLS_HOME}/skywalking-mock-collector/bin/collector-startup.sh 1>${LOGS_HOME}/collector.out &
+bash ${TOOLS_HOME}/skywalking-mock-collector/bin/collector-startup.sh 1>${LOGS_HOME}/collector.out &
healthCheck http://localhost:12800/receiveData
# start applications
@@ -82,7 +83,8 @@ export agent_opts="
-Dskywalking.agent.authentication=test-token
-Dskywalking.meter.report_interval=1
-Xms256m -Xmx256m ${agent_opts}"
-exec /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>${LOGS_HOME}/scenario.out &
+
+bash /var/run/${SCENARIO_NAME}/${SCENARIO_START_SCRIPT} 1>${LOGS_HOME}/scenario.out &
healthCheck ${SCENARIO_HEALTH_CHECK_URL}
diff --git a/test/plugin/containers/tomcat-container/pom.xml b/test/plugin/containers/tomcat-container/pom.xml
index f1759b67c..de77c929f 100644
--- a/test/plugin/containers/tomcat-container/pom.xml
+++ b/test/plugin/containers/tomcat-container/pom.xml
@@ -31,6 +31,49 @@
tomcat-containerSkyWalking Tomcat Runner Image
+
+
+
+ io.fabric8
+ docker-maven-plugin
+ 0.33.0
+
+
+
+ skywalking/agent-test-tomcat:${java.version}-${project.version}
+
+ ${base.image.tomcat}
+ /usr/local/skywalking/scenario
+
+ ""
+
+
+ dir
+ /
+ assembly.xml
+
+
+ chmod +x /run.sh
+ chmod +x /usr/local/tomcat/bin/catalina.sh
+ tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
+
+ ["/run.sh"]
+
+
+
+
+
+
+ build
+ package
+
+ build
+
+
+
+
+
+
@@ -38,98 +81,24 @@
true
-
-
-
- io.fabric8
- docker-maven-plugin
- 0.33.0
-
-
-
- skywalking/agent-test-tomcat:jdk8-${project.version}
-
- tomcat:8.5.57-jdk8-openjdk
- /usr/local/skywalking/scenario
-
- ""
-
-
- dir
- /
- assembly.xml
-
-
- chmod +x /run.sh
- chmod +x /usr/local/tomcat/bin/catalina.sh
- tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
-
- ["/run.sh"]
-
-
-
-
-
-
- build
- package
-
- build
-
-
-
-
-
-
+
+ tomcat:8.5-jdk8-openjdk
+ jdk8
+
-
jdk14
-
-
-
- io.fabric8
- docker-maven-plugin
- 0.33.0
-
-
-
- skywalking/agent-test-tomcat:jdk14-${project.version}
-
- tomcat:8.5.57-jdk14-openjdk
- /usr/local/skywalking/scenario
-
- ""
-
-
- dir
- /
- assembly.xml
-
-
- chmod +x /run.sh
- chmod +x /usr/local/tomcat/bin/catalina.sh
- tar -xvf ../tools/skywalking-mock-collector.tar.gz -C ../tools
-
- ["/run.sh"]
-
-
-
-
-
-
- build
- package
-
- build
-
-
-
-
-
-
+
+ tomcat:8.5-jdk14-openjdk
+ jdk14
+
+
+ jdk17
+
+ tomcat:8.5-jdk17-openjdk
+ jdk17
+
+
-
-
-
+
\ No newline at end of file
diff --git a/test/plugin/run.sh b/test/plugin/run.sh
index 0b529e873..3e5b7d45e 100755
--- a/test/plugin/run.sh
+++ b/test/plugin/run.sh
@@ -157,9 +157,8 @@ sed -i '' '/<\/sourceDirectories>/i\'$'\n''scenarios\/'"$scenar
sed -i '/<\/sourceDirectories>/i scenarios\/'"$scenario_name"'<\/sourceDirectory>' ./pom.xml
if [[ "$force_build" == "on" ]]; then
- profile=
- [[ $image_version =~ "jdk14-" ]] && profile="-Pjdk14"
- ${mvnw} --batch-mode -f ${home}/pom.xml clean package -DskipTests ${profile}
+ profile=$(echo ${image_version} | grep -oE "jdk[0-9]+")
+ ${mvnw} --batch-mode -f ${home}/pom.xml clean package -DskipTests -P${profile}
fi
# remove scenario_name into plugin/pom.xml
sed -i '' '/scenarios\/'"$scenario_name"'<\/sourceDirectory>/d' ./pom.xml \
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/bin/startup.sh b/test/plugin/scenarios/jdk17-with-gson-scenario/bin/startup.sh
new file mode 100644
index 000000000..c6d50e663
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/bin/startup.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar --enable-preview ${agent_opts} ${home}/../libs/jdk17-with-gson-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/config/expectedData.yaml b/test/plugin/scenarios/jdk17-with-gson-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..47502b3b7
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/config/expectedData.yaml
@@ -0,0 +1,73 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+segmentItems:
+- serviceName: jdk17-with-gson-scenario
+ segmentSize: ge 2
+ segments:
+ - segmentId: nq 0
+ spans:
+ - operationName: Gson/ToJson
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Unknown
+ tags:
+ - {key: length, value: not null}
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 55
+ isError: false
+ spanType: Local
+ peer: ' '
+ skipAnalysis: 'false'
+ - operationName: Gson/FromJson
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Unknown
+ tags:
+ - {key: length, value: not null}
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 55
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: 'false'
+ - operationName: /person/action
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 0
+ isError: false
+ spanType: Local
+ peer: ''
+ skipAnalysis: 'false'
+ tags:
+ - {key: key, value: value}
+ - operationName: GET:/case/gson-scenario
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 14
+ isError: false
+ spanType: Entry
+ peer: ''
+ tags:
+ - {key: url, value: 'http://localhost:8080/gson-scenario/case/gson-scenario'}
+ - {key: http.method, value: GET}
+ skipAnalysis: 'false'
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/configuration.yml b/test/plugin/scenarios/jdk17-with-gson-scenario/configuration.yml
new file mode 100644
index 000000000..39e3a2b73
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/configuration.yml
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+type: jvm
+entryService: http://localhost:8080/gson-scenario/case/gson-scenario
+healthCheck: http://localhost:8080/gson-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+runningMode: with_optional
+withPlugins: apm-gson-2.x-plugin-*.jar
+environment:
+dependencies:
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/pom.xml b/test/plugin/scenarios/jdk17-with-gson-scenario/pom.xml
new file mode 100644
index 000000000..c2675f7df
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/pom.xml
@@ -0,0 +1,149 @@
+
+
+
+
+ org.apache.skywalking.apm.testcase
+ jdk17-with-gson-scenario
+ 1.0.0
+ jar
+
+ 4.0.0
+
+
+ UTF-8
+ 17
+ 2.5.6
+ 2.8.5
+ ${test.framework.version}
+ 2.6.2
+ 4.3.8.RELEASE
+ 8.1.0
+
+
+ skywalking-jdk17-scenario
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot-version}
+ pom
+ import
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-logging
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-log4j2
+ 2.5.6
+
+
+
+ org.apache.skywalking
+ apm-toolkit-trace
+ ${apm-toolkit-trace.version}
+
+
+
+ com.google.code.gson
+ gson
+ ${test.framework.version}
+
+
+
+ com.rabbitmq
+ http-client
+ 1.1.1.RELEASE
+ compile
+
+
+
+
+ jdk17-with-gson-scenario
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+ com.rabbitmq
+ http-client
+
+
+
+
+
+
+
+ repackage
+
+
+
+
+
+
+
+
+
+ maven-compiler-plugin
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ./target/
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..e425e3f9c
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/jdk17-with-gson-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/Application.java b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/Application.java
new file mode 100644
index 000000000..00341933b
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/Application.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package test.apache.skywalking.apm.testcase.gson;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ try {
+ SpringApplication.run(Application.class, args);
+ } catch (Exception e) {
+ // Never do this
+ }
+ }
+}
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/controller/CaseController.java b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/controller/CaseController.java
new file mode 100644
index 000000000..83c0a190d
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/java/test/apache/skywalking/apm/testcase/gson/controller/CaseController.java
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package test.apache.skywalking.apm.testcase.gson.controller;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.TypeAdapter;
+import com.google.gson.TypeAdapterFactory;
+import com.google.gson.reflect.TypeToken;
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonToken;
+import com.google.gson.stream.JsonWriter;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import org.apache.skywalking.apm.toolkit.trace.ActiveSpan;
+import org.apache.skywalking.apm.toolkit.trace.Trace;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+ private static final String SUCCESS = "Success";
+
+ @RequestMapping("/gson-scenario")
+ @ResponseBody
+ public String gsonCase() {
+ var gson = new GsonBuilder()
+ .registerTypeAdapterFactory(new RecordTypeAdapterFactory())
+ .create();
+ Person person = new Person("skywalking", "jdk17");
+ gson.fromJson(gson.toJson(person), Person.class);
+ person.action();
+ return SUCCESS;
+ }
+
+ @RequestMapping("/healthCheck")
+ @ResponseBody
+ public String healthCheck() {
+ return SUCCESS;
+ }
+
+ public record Person(String name, String uuid) {
+ @Trace(operationName = "/person/action")
+ public void action() {
+ ActiveSpan.tag("key", "value");
+ }
+ }
+
+ public static class RecordTypeAdapterFactory implements TypeAdapterFactory {
+
+ @Override
+ public TypeAdapter create(Gson gson, TypeToken type) {
+ @SuppressWarnings("unchecked")
+ Class clazz = (Class) type.getRawType();
+ if (!clazz.isRecord()) {
+ return null;
+ }
+ TypeAdapter delegate = gson.getDelegateAdapter(this, type);
+
+ return new TypeAdapter() {
+ @Override
+ public void write(JsonWriter out, T value) throws IOException {
+ delegate.write(out, value);
+ }
+
+ @Override
+ public T read(JsonReader reader) throws IOException {
+ if (reader.peek() == JsonToken.NULL) {
+ reader.nextNull();
+ return null;
+ } else {
+ var recordComponents = clazz.getRecordComponents();
+ var typeMap = new HashMap>();
+ for (int i = 0; i < recordComponents.length; i++) {
+ typeMap.put(recordComponents[i].getName(), TypeToken.get(recordComponents[i].getGenericType()));
+ }
+ var argsMap = new HashMap();
+ reader.beginObject();
+ while (reader.hasNext()) {
+ String name = reader.nextName();
+ argsMap.put(name, gson.getAdapter(typeMap.get(name)).read(reader));
+ }
+ reader.endObject();
+
+ var argTypes = new Class>[recordComponents.length];
+ var args = new Object[recordComponents.length];
+ for (int i = 0; i < recordComponents.length; i++) {
+ argTypes[i] = recordComponents[i].getType();
+ args[i] = argsMap.get(recordComponents[i].getName());
+ }
+ Constructor constructor;
+ try {
+ constructor = clazz.getDeclaredConstructor(argTypes);
+ constructor.setAccessible(true);
+ return constructor.newInstance(args);
+ } catch (NoSuchMethodException | InstantiationException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ };
+ }
+ }
+}
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/application.yaml
new file mode 100644
index 000000000..9c7f5df3a
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/application.yaml
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+server:
+ port: 8080
+ servlet:
+ context-path: /gson-scenario
+logging:
+ config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..9849ed5a8
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/jdk17-with-gson-scenario/support-version.list b/test/plugin/scenarios/jdk17-with-gson-scenario/support-version.list
new file mode 100644
index 000000000..03d0f449e
--- /dev/null
+++ b/test/plugin/scenarios/jdk17-with-gson-scenario/support-version.list
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+2.8.6
diff --git a/test/plugin/scenarios/mysql-scenario/src/main/resources/jdbc.properties b/test/plugin/scenarios/mysql-scenario/src/main/resources/jdbc.properties
index 5c266c320..a74e52543 100644
--- a/test/plugin/scenarios/mysql-scenario/src/main/resources/jdbc.properties
+++ b/test/plugin/scenarios/mysql-scenario/src/main/resources/jdbc.properties
@@ -13,6 +13,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-mysql.url=jdbc:mysql://mysql-server:3306/test?serverTimezone=CST
+mysql.url=jdbc:mysql://mysql-server:3306/test?serverTimezone=CST&enabledTLSProtocols=TLSv1.2&useSSL=false
mysql.username=root
mysql.password=root