diff --git a/.github/workflows/plugins-test.yaml b/.github/workflows/plugins-test.yaml index 3fc8df48a..83cbdb232 100644 --- a/.github/workflows/plugins-test.yaml +++ b/.github/workflows/plugins-test.yaml @@ -88,7 +88,7 @@ jobs: - name: Run elasticsearch 5.x (3) run: bash test/plugin/run.sh elasticsearch-5.x-scenario - Webflux_SocketIO_RabbitMQ: + Toolkit_Webflux_SocketIO_RabbitMQ_GSON: runs-on: ubuntu-18.04 timeout-minutes: 90 strategy: @@ -118,6 +118,8 @@ jobs: run: bash test/plugin/run.sh netty-socketio-scenario - name: Run rabbitmq-scenario (12) run: bash test/plugin/run.sh rabbitmq-scenario + - name: Run gson-scenario (7) + run: bash test/plugin/run.sh gson-scenario Feign_Canal: runs-on: ubuntu-18.04 @@ -490,4 +492,3 @@ jobs: run: ./mvnw -f test/plugin/pom.xml clean package -DskipTests docker:build -DBUILD_NO=local >/dev/null - name: Run mysql 5.1.2-8.0.15 (53) run: bash test/plugin/run.sh mysql-scenario - diff --git a/test/plugin/scenarios/gson-scenario/bin/startup.sh b/test/plugin/scenarios/gson-scenario/bin/startup.sh new file mode 100644 index 000000000..6c7140b4e --- /dev/null +++ b/test/plugin/scenarios/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 ${agent_opts} ${home}/../libs/gson-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/gson-scenario/config/expectedData.yaml b/test/plugin/scenarios/gson-scenario/config/expectedData.yaml new file mode 100644 index 000000000..f5126cb31 --- /dev/null +++ b/test/plugin/scenarios/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. +registryItems: + applications: + - {gson-scenario: nq 0} + instances: + - {gson-scenario: nq 0} + operationNames: + - gson-scenario: [/gson-scenario/case/gson-scenario] +segmentItems: +- applicationCode: gson-scenario + segmentSize: ge 2 + segments: + - segmentId: nq 0 + spans: + - operationName: Gson/ToJson + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Unknown + tags: + - {key: 'length', value: 'not null'} + startTime: nq 0 + endTime: nq 0 + componentId: 55 + componentName: '' + isError: false + spanType: Local + peer: ' ' + peerId: 0 + - operationName: Gson/FromJson + operationId: 0 + parentSpanId: 0 + spanId: 2 + spanLayer: Unknown + tags: + - {key: 'length', value: 'not null'} + startTime: nq 0 + endTime: nq 0 + componentId: 55 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: /gson-scenario/case/gson-scenario + operationId: 0 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/gson-scenario/case/gson-scenario'} + - {key: http.method, value: GET} diff --git a/test/plugin/scenarios/gson-scenario/configuration.yml b/test/plugin/scenarios/gson-scenario/configuration.yml new file mode 100644 index 000000000..aa64dc9cb --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/configuration.yml @@ -0,0 +1,25 @@ +# 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 +framework: gson-scenario +runningMode: with_optional +withPlugins: apm-gson-2.x-plugin-*.jar +environment: +dependencies: \ No newline at end of file diff --git a/test/plugin/scenarios/gson-scenario/pom.xml b/test/plugin/scenarios/gson-scenario/pom.xml new file mode 100644 index 000000000..b49aef317 --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/pom.xml @@ -0,0 +1,120 @@ + + + + + org.apache.skywalking.apm.testcase + gson-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + 2.1.6.RELEASE + 2.8.5 + ${test.framework.version} + 2.6.2 + 4.3.8.RELEASE + + + skywalking-gson-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 + + + + com.google.code.gson + gson + ${test.framework.version} + + + + + gson-scenario + + + org.springframework.boot + spring-boot-maven-plugin + + + + 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/gson-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/gson-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..1bc15065b --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/gson-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/Application.java b/test/plugin/scenarios/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/Application.java new file mode 100644 index 000000000..ebca5766f --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/Application.java @@ -0,0 +1,35 @@ +/* + * 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 org.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/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/controller/CaseController.java b/test/plugin/scenarios/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/controller/CaseController.java new file mode 100644 index 000000000..e6a3cb5fe --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/src/main/java/org/apache/skywalking/apm/testcase/gson/controller/CaseController.java @@ -0,0 +1,47 @@ +/* + * 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 org.apache.skywalking.apm.testcase.gson.controller; + +import com.google.gson.Gson; +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() { + Gson gson = new Gson(); + gson.fromJson(gson.toJson("gson-case"), String.class); + return SUCCESS; + } + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + // your codes + return SUCCESS; + } + +} diff --git a/test/plugin/scenarios/gson-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/gson-scenario/src/main/resources/application.yaml new file mode 100644 index 000000000..9c7f5df3a --- /dev/null +++ b/test/plugin/scenarios/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/gson-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/gson-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..9849ed5a8 --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/gson-scenario/support-version.list b/test/plugin/scenarios/gson-scenario/support-version.list new file mode 100644 index 000000000..662ae45a3 --- /dev/null +++ b/test/plugin/scenarios/gson-scenario/support-version.list @@ -0,0 +1,25 @@ +# 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 +# "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. + +# lists your version here + +2.8.6 +2.8.5 +2.8.4 +2.8.3 +2.8.2 +2.8.1 +2.8.0 \ No newline at end of file