diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2 index b41785a34..7f7a21d79 100755 --- a/Jenkinsfile-Agent-Test-2 +++ b/Jenkinsfile-Agent-Test-2 @@ -69,6 +69,24 @@ pipeline { sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} dubbo-2.5.x-scenario' } } + + stage('spring 3.0.x (8)') { + steps { + sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} spring-3.0.x-scenario' + } + } + + stage('spring 3.1.x-4.0.x (25)') { + steps { + sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} spring-3.1.x-scenario' + } + } + + stage('spring 4.1.x-4.2.x (20)') { + steps { + sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} spring-4.1.x-scenario' + } + } } } stage('Group2') { @@ -78,6 +96,12 @@ pipeline { sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} solrj-7.x-scenario' } } + + stage('spring 4.3.x-5.2.x (54)') { + steps { + sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} spring-4.3.x-scenario' + } + } } } } diff --git a/test/plugin/run.sh b/test/plugin/run.sh index dadd9477b..dc9109267 100644 --- a/test/plugin/run.sh +++ b/test/plugin/run.sh @@ -147,7 +147,7 @@ if [[ ! -f $supported_version_file ]]; then fi _agent_home=${agent_home} -mode=`grep "runningMode" ${scenario_home}/configuration.yml |sed -e "s/\s//g" |awk -F: '{print $2}'` +mode=`grep "runningMode" ${scenario_home}/configuration.yml |sed -e "s/ //g" |awk -F: '{print $2}'` if [[ "$mode" == "with_optional" ]]; then agent_with_optional_home=${home}/workspace/agent_with_optional if [[ ! -d ${agent_with_optional_home} ]]; then diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..22ed29b2d --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/config/expectedData.yaml @@ -0,0 +1,104 @@ +# 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: + - {spring-3.0.x-scenario: 2} + instances: + - {spring-3.0.x-scenario: 1} + operationNames: + - spring-3.0.x-scenario: [/healthCheck, /case/spring3] + heartbeat: [] +segmentItems: + - applicationCode: spring-3.0.x-scenario + segmentSize: 2 + segments: + - segmentId: not null + spans: + - operationName: /healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.0.x-scenario/healthCheck'} + - {key: http.method, value: HEAD} + - segmentId: not null + spans: + - operationName: test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean.componentMethod + operationId: 0 + parentSpanId: 1 + spanId: 2 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean.doSomeStuff + operationId: 0 + parentSpanId: 1 + spanId: 3 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean.doSomeBusiness + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: /case/spring3 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.0.x-scenario/case/spring3'} + - {key: http.method, value: GET} + + diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/configuration.yml b/test/plugin/scenarios/spring-3.0.x-scenario/configuration.yml new file mode 100644 index 000000000..4ad4d6bf5 --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/configuration.yml @@ -0,0 +1,21 @@ +# 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: tomcat +entryService: http://localhost:8080/spring-3.0.x-scenario/case/spring3 +healthCheck: http://localhost:8080/spring-3.0.x-scenario/healthCheck +runningMode: with_optional +framework: spring \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/pom.xml b/test/plugin/scenarios/spring-3.0.x-scenario/pom.xml new file mode 100644 index 000000000..c233a7d7b --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.apache.skywalking + spring-3.0.x-scenario + 5.0.0 + + war + + + UTF-8 + 1.8 + 3.0.0.RELEASE + spring + + + skywalking-spring-3.0.x-scenario + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.springframework + spring-context + ${test.framework.version} + + + org.springframework + spring-aop + ${test.framework.version} + + + org.springframework + spring-webmvc + ${test.framework.version} + + + org.springframework + spring-web + ${test.framework.version} + + + com.fasterxml.jackson.core + jackson-databind + 2.9.3 + + + + + spring-3.0.x-scenario + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java new file mode 100644 index 000000000..728b8ccea --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java @@ -0,0 +1,48 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3; + +import test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class CaseController { + + private static final String SUCCESS = "Success"; + + @Autowired + private TestServiceBean testServiceBean; + + @RequestMapping(value = "/case/spring3") + @ResponseBody + public String updateUser() { + testServiceBean.doSomeBusiness("test"); + return SUCCESS; + } + + @RequestMapping(value = "/healthCheck") + @ResponseBody + public String healthCheck() { + return SUCCESS; + } + +} diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java new file mode 100644 index 000000000..b3d9b3762 --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.component; + +import org.springframework.stereotype.Component; + +@Component +public class TestComponentBean { + + public String componentMethod(String name) { + return name + "-" + "dealWith-component"; + } +} diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java new file mode 100644 index 000000000..c2f7004db --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.dao; + +import org.springframework.stereotype.Repository; + +@Repository +public class TestRepositoryBean { + + public String doSomeStuff(String name) { + return name + "-dealWithRepository"; + } +} diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java new file mode 100644 index 000000000..d81ee4e1b --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java @@ -0,0 +1,38 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.service; + +import test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean; +import test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TestServiceBean { + @Autowired + private TestComponentBean componentBean; + + @Autowired + private TestRepositoryBean repositoryBean; + + public void doSomeBusiness(String name) { + componentBean.componentMethod(name); + repositoryBean.doSomeStuff(name); + } +} diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..b5cda5ae8 --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml new file mode 100644 index 000000000..830528d2c --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..aeabdd38b --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + skywalking-mysql-scenario + + + spring-mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + spring-mvc + / + + diff --git a/test/plugin/scenarios/spring-3.0.x-scenario/support-version.list b/test/plugin/scenarios/spring-3.0.x-scenario/support-version.list new file mode 100644 index 000000000..8f899bebd --- /dev/null +++ b/test/plugin/scenarios/spring-3.0.x-scenario/support-version.list @@ -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 +# "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. + +3.0.7.RELEASE +3.0.6.RELEASE +3.0.5.RELEASE +3.0.4.RELEASE +3.0.3.RELEASE +3.0.2.RELEASE +3.0.1.RELEASE +3.0.0.RELEASE \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..fdba07915 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/config/expectedData.yaml @@ -0,0 +1,300 @@ +# 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: + - {spring-3.1.x-scenario: 2} + instances: + - {spring-3.1.x-scenario: 1} + operationNames: + - spring-3.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', + /spring-3.1.x-scenario/delete/1, '{POST}/create/', /healthCheck, /case/spring3, + /spring-3.1.x-scenario/case/spring3/, /spring-3.1.x-scenario/update/1, '{PUT}/update/{id}', + /spring-3.1.x-scenario/create/, /spring-3.1.x-scenario/get/1] + heartbeat: [] +segmentItems: + - applicationCode: spring-3.1.x-scenario + segmentSize: 7 + segments: + - segmentId: not null + spans: + - operationName: /healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/healthCheck'} + - {key: http.method, value: HEAD} + - segmentId: not null + spans: + - operationName: test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean.componentMethod + operationId: 0 + parentSpanId: 1 + spanId: 2 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean.doSomeStuff + operationId: 0 + parentSpanId: 1 + spanId: 3 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean.doSomeBusiness + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: /case/spring3 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/case/spring3/'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{POST}/create/' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/create/'} + - {key: http.method, value: POST} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{GET}/get/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/get/1'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{DELETE}/delete/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 5, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /spring-3.1.x-scenario/case/spring3/ + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 12 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: GET} + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/case/spring3/'} + - operationName: /spring-3.1.x-scenario/create/ + operationId: 0 + parentSpanId: 0 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/create/'} + - {key: http.method, value: POST} + - operationName: /spring-3.1.x-scenario/get/1 + operationId: 0 + parentSpanId: 0 + spanId: 3 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/get/1'} + - {key: http.method, value: GET} + - operationName: /spring-3.1.x-scenario/update/1 + operationId: 0 + parentSpanId: 0 + spanId: 4 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/update/1'} + - {key: http.method, value: PUT} + - operationName: /spring-3.1.x-scenario/delete/1 + operationId: 0 + parentSpanId: 0 + spanId: 5 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + - operationName: /case/resttemplate + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/case/resttemplate'} + - {key: http.method, value: GET} + - segmentId: not null + spans: + - operationName: '{PUT}/update/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-3.1.x-scenario/update/1'} + - {key: http.method, value: PUT} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 4, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/configuration.yml b/test/plugin/scenarios/spring-3.1.x-scenario/configuration.yml new file mode 100644 index 000000000..c58a0d8ee --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/configuration.yml @@ -0,0 +1,21 @@ +# 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: tomcat +entryService: http://localhost:8080/spring-3.1.x-scenario/case/resttemplate +healthCheck: http://localhost:8080/spring-3.1.x-scenario/healthCheck +runningMode: with_optional +framework: spring \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/pom.xml b/test/plugin/scenarios/spring-3.1.x-scenario/pom.xml new file mode 100644 index 000000000..62b0fbe4a --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/pom.xml @@ -0,0 +1,125 @@ + + + + 4.0.0 + + org.apache.skywalking + spring-3.1.x-scenario + 5.0.0 + + war + + + UTF-8 + 1.8 + 3.1.0.RELEASE + spring + + + skywalking-spring-3.1.x-scenario + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.springframework + spring-context + ${test.framework.version} + + + org.springframework + spring-aop + ${test.framework.version} + + + org.springframework + spring-webmvc + ${test.framework.version} + + + org.springframework + spring-web + ${test.framework.version} + + + org.codehaus.jackson + jackson-core-asl + 1.9.13 + + + org.codehaus.jackson + jackson-mapper-asl + 1.9.13 + + + + com.google.code.gson + gson + 2.8.2 + + + + com.squareup.okhttp3 + okhttp + 3.0.0 + + + + org.apache.logging.log4j + log4j-api + 2.8.1 + + + org.apache.logging.log4j + log4j-core + 2.8.1 + + + + + spring-3.1.x-scenario + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java new file mode 100644 index 000000000..2a310e705 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java @@ -0,0 +1,53 @@ +/* + * 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.org.apache.skywalking.apm.testcase.entity; + +public class User { + + private int id; + private String userName; + + public User(int id) { + this.id = id; + } + + public User(int id, String userName) { + this.id = id; + this.userName = userName; + } + + public User() { + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java new file mode 100644 index 000000000..63d582e92 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java @@ -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. + * + */ + +package test.org.apache.skywalking.apm.testcase.restapi; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.util.UriComponentsBuilder; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Controller +public class RestCaseController { + + private static final Map users = new ConcurrentHashMap(); + + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) + @ResponseBody + private User getUser(@PathVariable("id") int id) throws InterruptedException { + return new User(id, "a"); + } + + @RequestMapping(value = "/create/", method = RequestMethod.POST) + @ResponseBody + @ResponseStatus(HttpStatus.CREATED) + public void createUser(@RequestBody User user, + HttpServletResponse response, UriComponentsBuilder ucBuilder) throws InterruptedException { + users.put(user.getId(), user); + response.setHeader("Location", ucBuilder.path("/get/{id}").buildAndExpand(user.getId()).toUri().toASCIIString()); + } + + @RequestMapping(value = "/update/{id}", method = RequestMethod.PUT) + @ResponseBody + public User updateUser(@PathVariable("id") int id, + @RequestBody User user) throws InterruptedException { + return new User(id, user.getUserName()); + } + + @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE) + @ResponseBody + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = users.get(id); + if (currentUser == null) { + return; + } + users.remove(id); + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java new file mode 100644 index 000000000..03e1f5778 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java @@ -0,0 +1,76 @@ +/* + * 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.org.apache.skywalking.apm.testcase.resttemplate; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.http.HttpEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import java.io.IOException; + +@Controller +public class RestTemplateController { + + private static final String SUCCESS = "Success"; + + private Logger logger = LogManager.getLogger(RestTemplateController.class); + + private static final String url = "http://localhost:8080/spring-3.1.x-scenario"; + + @RequestMapping("/case/resttemplate") + @ResponseBody + public String restTemplate() throws IOException { + Request request = new Request.Builder().url(url + "/case/spring3/").build(); + Response response = new OkHttpClient().newCall(request).execute(); + logger.info(response.toString()); + + // Create user + HttpEntity userEntity = new HttpEntity<>(new User(1, "a")); + new RestTemplate().postForEntity(url + "/create/", userEntity, Void.class); + + // Find User + new RestTemplate().getForEntity(url + "/get/{id}", User.class, 1); + + //Modify user + HttpEntity updateUserEntity = new HttpEntity<>(new User(1, "b")); + new RestTemplate().put(url + "/update/{id}", updateUserEntity, userEntity.getBody().getId(), 1); + + //Delete user + new RestTemplate().delete(url + "/delete/{id}", 1); + + return SUCCESS; + } + + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + return SUCCESS; + } + + +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java new file mode 100644 index 000000000..183e50934 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java @@ -0,0 +1,41 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean; + +@Controller +public class CaseController { + + private static final String SUCCESS = "Success"; + + @Autowired + private TestServiceBean testServiceBean; + + @RequestMapping(value = "/case/spring3") + @ResponseBody + public String updateUser() { + testServiceBean.doSomeBusiness("test"); + return SUCCESS; + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java new file mode 100644 index 000000000..b3d9b3762 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.component; + +import org.springframework.stereotype.Component; + +@Component +public class TestComponentBean { + + public String componentMethod(String name) { + return name + "-" + "dealWith-component"; + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java new file mode 100644 index 000000000..c2f7004db --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.dao; + +import org.springframework.stereotype.Repository; + +@Repository +public class TestRepositoryBean { + + public String doSomeStuff(String name) { + return name + "-dealWithRepository"; + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java new file mode 100644 index 000000000..d81ee4e1b --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java @@ -0,0 +1,38 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.service; + +import test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean; +import test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TestServiceBean { + @Autowired + private TestComponentBean componentBean; + + @Autowired + private TestRepositoryBean repositoryBean; + + public void doSomeBusiness(String name) { + componentBean.componentMethod(name); + repositoryBean.doSomeStuff(name); + } +} diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..b5cda5ae8 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml new file mode 100644 index 000000000..f43733653 --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..cca749c1a --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + skywalking-spring-3.1.x-scenario + + + spring-mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + spring-mvc + / + + + + diff --git a/test/plugin/scenarios/spring-3.1.x-scenario/support-version.list b/test/plugin/scenarios/spring-3.1.x-scenario/support-version.list new file mode 100644 index 000000000..0de19335c --- /dev/null +++ b/test/plugin/scenarios/spring-3.1.x-scenario/support-version.list @@ -0,0 +1,53 @@ +# 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. + +# 3.2.0-3.2.8 does not support jdk8 +# (https://stackoverflow.com/questions/30072135/spring-3-2-x-with-java-8) + +3.1.0.RELEASE +3.1.1.RELEASE +3.1.2.RELEASE +3.1.3.RELEASE +3.1.4.RELEASE +#3.2.0.RELEASE +#3.2.1.RELEASE +#3.2.2.RELEASE +#3.2.3.RELEASE +#3.2.4.RELEASE +#3.2.5.RELEASE +#3.2.6.RELEASE +#3.2.7.RELEASE +#3.2.8.RELEASE +3.2.9.RELEASE +3.2.10.RELEASE +3.2.11.RELEASE +3.2.12.RELEASE +3.2.13.RELEASE +3.2.14.RELEASE +3.2.15.RELEASE +3.2.16.RELEASE +3.2.17.RELEASE +3.2.18.RELEASE +4.0.0.RELEASE +4.0.1.RELEASE +4.0.2.RELEASE +4.0.3.RELEASE +4.0.4.RELEASE +4.0.5.RELEASE +4.0.6.RELEASE +4.0.7.RELEASE +4.0.8.RELEASE +4.0.9.RELEASE diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..b73b99ed8 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/config/expectedData.yaml @@ -0,0 +1,300 @@ +# 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: + - {spring-4.1.x-scenario: 2} + instances: + - {spring-4.1.x-scenario: 1} + operationNames: + - spring-4.1.x-scenario: ['{DELETE}/delete/{id}', /case/resttemplate, '{GET}/get/{id}', + /spring-4.1.x-scenario/delete/1, '{POST}/create/', /healthCheck, /case/spring3, + /spring-4.1.x-scenario/case/spring3/, /spring-4.1.x-scenario/update/1, '{PUT}/update/{id}', + /spring-4.1.x-scenario/create/, /spring-4.1.x-scenario/get/1] + heartbeat: [] +segmentItems: + - applicationCode: spring-4.1.x-scenario + segmentSize: 7 + segments: + - segmentId: not null + spans: + - operationName: /healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/healthCheck'} + - {key: http.method, value: HEAD} + - segmentId: not null + spans: + - operationName: test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean.componentMethod + operationId: 0 + parentSpanId: 1 + spanId: 2 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean.doSomeStuff + operationId: 0 + parentSpanId: 1 + spanId: 3 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean.doSomeBusiness + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: /case/spring3 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/case/spring3/'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{POST}/create/' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/create/'} + - {key: http.method, value: POST} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{GET}/get/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/get/1'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: '{DELETE}/delete/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 5, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /spring-4.1.x-scenario/case/spring3/ + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 12 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: GET} + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/case/spring3/'} + - operationName: /spring-4.1.x-scenario/create/ + operationId: 0 + parentSpanId: 0 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/create/'} + - {key: http.method, value: POST} + - operationName: /spring-4.1.x-scenario/get/1 + operationId: 0 + parentSpanId: 0 + spanId: 3 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/get/1'} + - {key: http.method, value: GET} + - operationName: /spring-4.1.x-scenario/update/1 + operationId: 0 + parentSpanId: 0 + spanId: 4 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/update/1'} + - {key: http.method, value: PUT} + - operationName: /spring-4.1.x-scenario/delete/1 + operationId: 0 + parentSpanId: 0 + spanId: 5 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + - operationName: /case/resttemplate + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/case/resttemplate'} + - {key: http.method, value: GET} + - segmentId: not null + spans: + - operationName: '{PUT}/update/{id}' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.1.x-scenario/update/1'} + - {key: http.method, value: PUT} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 4, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/configuration.yml b/test/plugin/scenarios/spring-4.1.x-scenario/configuration.yml new file mode 100644 index 000000000..32532cb6f --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/configuration.yml @@ -0,0 +1,21 @@ +# 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: tomcat +entryService: http://localhost:8080/spring-4.1.x-scenario/case/resttemplate +healthCheck: http://localhost:8080/spring-4.1.x-scenario/healthCheck +runningMode: with_optional +framework: spring \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/pom.xml b/test/plugin/scenarios/spring-4.1.x-scenario/pom.xml new file mode 100644 index 000000000..784ad6bc7 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/pom.xml @@ -0,0 +1,114 @@ + + + + 4.0.0 + + org.apache.skywalking + spring-4.1.x-scenario + 5.0.0 + + war + + + UTF-8 + 1.8 + 4.1.0.RELEASE + spring + + + skywalking-spring-4.1.x-scenario + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.springframework + spring-context + ${test.framework.version} + + + org.springframework + spring-aop + ${test.framework.version} + + + org.springframework + spring-webmvc + ${test.framework.version} + + + org.springframework + spring-web + ${test.framework.version} + + + com.fasterxml.jackson.core + jackson-databind + 2.9.3 + + + + com.squareup.okhttp3 + okhttp + 3.0.0 + + + + org.apache.logging.log4j + log4j-api + 2.8.1 + + + org.apache.logging.log4j + log4j-core + 2.8.1 + + + + + spring-4.1.x-scenario + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java new file mode 100644 index 000000000..2a310e705 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java @@ -0,0 +1,53 @@ +/* + * 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.org.apache.skywalking.apm.testcase.entity; + +public class User { + + private int id; + private String userName; + + public User(int id) { + this.id = id; + } + + public User(int id, String userName) { + this.id = id; + this.userName = userName; + } + + public User() { + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java new file mode 100644 index 000000000..63d582e92 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java @@ -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. + * + */ + +package test.org.apache.skywalking.apm.testcase.restapi; + +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.util.UriComponentsBuilder; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Controller +public class RestCaseController { + + private static final Map users = new ConcurrentHashMap(); + + @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) + @ResponseBody + private User getUser(@PathVariable("id") int id) throws InterruptedException { + return new User(id, "a"); + } + + @RequestMapping(value = "/create/", method = RequestMethod.POST) + @ResponseBody + @ResponseStatus(HttpStatus.CREATED) + public void createUser(@RequestBody User user, + HttpServletResponse response, UriComponentsBuilder ucBuilder) throws InterruptedException { + users.put(user.getId(), user); + response.setHeader("Location", ucBuilder.path("/get/{id}").buildAndExpand(user.getId()).toUri().toASCIIString()); + } + + @RequestMapping(value = "/update/{id}", method = RequestMethod.PUT) + @ResponseBody + public User updateUser(@PathVariable("id") int id, + @RequestBody User user) throws InterruptedException { + return new User(id, user.getUserName()); + } + + @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE) + @ResponseBody + @ResponseStatus(HttpStatus.NO_CONTENT) + public void deleteUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = users.get(id); + if (currentUser == null) { + return; + } + users.remove(id); + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java new file mode 100644 index 000000000..16807ee2c --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java @@ -0,0 +1,75 @@ +/* + * 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.org.apache.skywalking.apm.testcase.resttemplate; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.http.HttpEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.client.RestTemplate; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import java.io.IOException; + +@Controller +public class RestTemplateController { + + private static final String SUCCESS = "Success"; + + private Logger logger = LogManager.getLogger(RestTemplateController.class); + + private static final String url = "http://localhost:8080/spring-4.1.x-scenario"; + + @RequestMapping("/case/resttemplate") + @ResponseBody + public String restTemplate() throws IOException { + Request request = new Request.Builder().url(url + "/case/spring3/").build(); + Response response = new OkHttpClient().newCall(request).execute(); + logger.info(response.toString()); + + // Create user + HttpEntity userEntity = new HttpEntity<>(new User(1, "a")); + new RestTemplate().postForEntity(url + "/create/", userEntity, Void.class); + + // Find User + new RestTemplate().getForEntity(url + "/get/{id}", User.class, 1); + + //Modify user + HttpEntity updateUserEntity = new HttpEntity<>(new User(1, "b")); + new RestTemplate().put(url + "/update/{id}", updateUserEntity, userEntity.getBody().getId(), 1); + + //Delete user + new RestTemplate().delete(url + "/delete/{id}", 1); + + return SUCCESS; + } + + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + return SUCCESS; + } + + +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java new file mode 100644 index 000000000..183e50934 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java @@ -0,0 +1,41 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean; + +@Controller +public class CaseController { + + private static final String SUCCESS = "Success"; + + @Autowired + private TestServiceBean testServiceBean; + + @RequestMapping(value = "/case/spring3") + @ResponseBody + public String updateUser() { + testServiceBean.doSomeBusiness("test"); + return SUCCESS; + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java new file mode 100644 index 000000000..b3d9b3762 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.component; + +import org.springframework.stereotype.Component; + +@Component +public class TestComponentBean { + + public String componentMethod(String name) { + return name + "-" + "dealWith-component"; + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java new file mode 100644 index 000000000..c2f7004db --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.dao; + +import org.springframework.stereotype.Repository; + +@Repository +public class TestRepositoryBean { + + public String doSomeStuff(String name) { + return name + "-dealWithRepository"; + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java new file mode 100644 index 000000000..d81ee4e1b --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java @@ -0,0 +1,38 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.service; + +import test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean; +import test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TestServiceBean { + @Autowired + private TestComponentBean componentBean; + + @Autowired + private TestRepositoryBean repositoryBean; + + public void doSomeBusiness(String name) { + componentBean.componentMethod(name); + repositoryBean.doSomeStuff(name); + } +} diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..b5cda5ae8 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml new file mode 100644 index 000000000..f43733653 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml @@ -0,0 +1,28 @@ + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..9f9d8101c --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + skywalking-spring-4.1.x-scenario + + + spring-mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + spring-mvc + / + + + + diff --git a/test/plugin/scenarios/spring-4.1.x-scenario/support-version.list b/test/plugin/scenarios/spring-4.1.x-scenario/support-version.list new file mode 100644 index 000000000..14fbda627 --- /dev/null +++ b/test/plugin/scenarios/spring-4.1.x-scenario/support-version.list @@ -0,0 +1,36 @@ +# 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. + +4.1.0.RELEASE +4.1.1.RELEASE +4.1.2.RELEASE +4.1.3.RELEASE +4.1.4.RELEASE +4.1.5.RELEASE +4.1.6.RELEASE +4.1.7.RELEASE +4.1.8.RELEASE +4.1.9.RELEASE +4.2.0.RELEASE +4.2.1.RELEASE +4.2.2.RELEASE +4.2.3.RELEASE +4.2.4.RELEASE +4.2.5.RELEASE +4.2.6.RELEASE +4.2.7.RELEASE +4.2.8.RELEASE +4.2.9.RELEASE diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000..dfe78d4a2 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/config/expectedData.yaml @@ -0,0 +1,342 @@ +# 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: + - {spring-4.3.x-scenario: 2} + instances: + - {spring-4.3.x-scenario: 1} + operationNames: + - spring-4.3.x-scenario: [/create/, '/delete/{id}', /inherit/child/test, /healthCheck, + /spring-4.3.x-scenario/case/spring3/, /spring-4.3.x-scenario/create/, /spring-4.3.x-scenario/get/1, + '/get/{id}', '/update/{id}', /case/resttemplate, /spring-4.3.x-scenario/delete/1, + /spring-4.3.x-scenario/inherit/child/test, /spring-4.3.x-scenario/update/1, + /case/spring3] + heartbeat: [] +segmentItems: + - applicationCode: spring-4.3.x-scenario + segmentSize: 8 + segments: + - segmentId: not null + spans: + - operationName: /healthCheck + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/healthCheck'} + - {key: http.method, value: HEAD} + - segmentId: not null + spans: + - operationName: test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean.componentMethod + operationId: 0 + parentSpanId: 1 + spanId: 2 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean.doSomeStuff + operationId: 0 + parentSpanId: 1 + spanId: 3 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean.doSomeBusiness + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Unknown + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: '' + peerId: 0 + - operationName: /case/spring3 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/case/spring3/'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /create/ + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/create/'} + - {key: http.method, value: POST} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /get/{id} + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/get/1'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /update/{id} + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/update/1'} + - {key: http.method, value: PUT} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 4, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /delete/{id} + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 5, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /inherit/child/test + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/inherit/child/test'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /case/resttemplate, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 6, parentTraceSegmentId: not null, + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /case/resttemplate, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /spring-4.3.x-scenario/case/spring3/ + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 12 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: GET} + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/case/spring3/'} + - operationName: /spring-4.3.x-scenario/create/ + operationId: 0 + parentSpanId: 0 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/create/'} + - {key: http.method, value: POST} + - operationName: /spring-4.3.x-scenario/get/1 + operationId: 0 + parentSpanId: 0 + spanId: 3 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/get/1'} + - {key: http.method, value: GET} + - operationName: /spring-4.3.x-scenario/update/1 + operationId: 0 + parentSpanId: 0 + spanId: 4 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/update/1'} + - {key: http.method, value: PUT} + - operationName: /spring-4.3.x-scenario/delete/1 + operationId: 0 + parentSpanId: 0 + spanId: 5 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 13 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/delete/1'} + - {key: http.method, value: DELETE} + - operationName: /spring-4.3.x-scenario/inherit/child/test + operationId: 0 + parentSpanId: 0 + spanId: 6 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 12 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: GET} + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/inherit/child/test'} + - operationName: /case/resttemplate + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 14 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/spring-4.3.x-scenario/case/resttemplate'} + - {key: http.method, value: GET} + + diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/configuration.yml b/test/plugin/scenarios/spring-4.3.x-scenario/configuration.yml new file mode 100644 index 000000000..daf4c31f7 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/configuration.yml @@ -0,0 +1,21 @@ +# 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: tomcat +entryService: http://localhost:8080/spring-4.3.x-scenario/case/resttemplate +healthCheck: http://localhost:8080/spring-4.3.x-scenario/healthCheck +runningMode: with_optional +framework: spring \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/pom.xml b/test/plugin/scenarios/spring-4.3.x-scenario/pom.xml new file mode 100644 index 000000000..85cf9c4b3 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/pom.xml @@ -0,0 +1,121 @@ + + + + 4.0.0 + + org.apache.skywalking + spring-4.3.x-scenario + 5.0.0 + + war + + + UTF-8 + 1.8 + 4.3.0.RELEASE + spring + + + skywalking-spring-4.3.x-scenario + + + + javax.servlet + javax.servlet-api + 3.1.0 + provided + + + org.springframework + spring-context + ${test.framework.version} + + + org.springframework + spring-aop + ${test.framework.version} + + + org.springframework + spring-webmvc + ${test.framework.version} + + + org.springframework + spring-web + ${test.framework.version} + + + + com.fasterxml.jackson.core + jackson-databind + 2.9.3 + + + + com.google.code.gson + gson + 2.8.2 + + + + com.squareup.okhttp3 + okhttp + 3.0.0 + + + + org.apache.logging.log4j + log4j-api + 2.8.1 + + + org.apache.logging.log4j + log4j-core + 2.8.1 + + + + + spring-4.3.x-scenario + + + maven-compiler-plugin + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java new file mode 100644 index 000000000..2a310e705 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/entity/User.java @@ -0,0 +1,53 @@ +/* + * 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.org.apache.skywalking.apm.testcase.entity; + +public class User { + + private int id; + private String userName; + + public User(int id) { + this.id = id; + } + + public User(int id, String userName) { + this.id = id; + this.userName = userName; + } + + public User() { + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ChildController.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ChildController.java new file mode 100644 index 000000000..264d955fc --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ChildController.java @@ -0,0 +1,29 @@ +/* + * + * 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.org.apache.skywalking.apm.testcase.inherit; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/inherit/child") +public class ChildController extends ParentController { + +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ParentController.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ParentController.java new file mode 100644 index 000000000..c4e3d7b7e --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/inherit/ParentController.java @@ -0,0 +1,33 @@ +/* + * + * 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.org.apache.skywalking.apm.testcase.inherit; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/inherit/parent") +public class ParentController { + + @RequestMapping("test") + public String test(Integer param) { + return "parent-a" + param; + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java new file mode 100644 index 000000000..0cd13c34b --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/restapi/RestCaseController.java @@ -0,0 +1,79 @@ +/* + * 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.org.apache.skywalking.apm.testcase.restapi; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.util.UriComponentsBuilder; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@RestController +public class RestCaseController { + + private static final Map users = new ConcurrentHashMap(); + + @GetMapping(value = "/get/{id}") + @ResponseBody + private ResponseEntity getUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = new User(id, "a"); + return ResponseEntity.ok(currentUser); + } + + @PostMapping(value = "/create/") + @ResponseBody + public ResponseEntity createUser(@RequestBody User user, + UriComponentsBuilder ucBuilder) throws InterruptedException { + users.put(user.getId(), user); + HttpHeaders headers = new HttpHeaders(); + headers.setLocation(ucBuilder.path("/get/{id}").buildAndExpand(user.getId()).toUri()); + return new ResponseEntity(headers, HttpStatus.CREATED); + } + + @PutMapping(value = "/update/{id}") + @ResponseBody + public ResponseEntity updateUser(@PathVariable("id") int id, + @RequestBody User user) throws InterruptedException { + User currentUser = new User(id, user.getUserName()); + return ResponseEntity.ok(currentUser); + } + + @DeleteMapping(value = "/delete/{id}") + @ResponseBody + public ResponseEntity deleteUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = users.get(id); + if (currentUser == null) { + return ResponseEntity.noContent().build(); + } + users.remove(id); + return ResponseEntity.noContent().build(); + } +} + diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java new file mode 100644 index 000000000..bd5520328 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/resttemplate/RestTemplateController.java @@ -0,0 +1,80 @@ +/* + * 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.org.apache.skywalking.apm.testcase.resttemplate; + +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.http.HttpEntity; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; +import test.org.apache.skywalking.apm.testcase.entity.User; + +import java.io.IOException; + +@RestController +public class RestTemplateController { + + private static final String SUCCESS = "Success"; + + private Logger logger = LogManager.getLogger(RestTemplateController.class); + + private static final String url = "http://localhost:8080/spring-4.3.x-scenario"; + + @RequestMapping("/case/resttemplate") + @ResponseBody + public String restTemplate() throws IOException { + Request request = new Request.Builder().url(url + "/case/spring3/").build(); + Response response = new OkHttpClient().newCall(request).execute(); + logger.info(response.toString()); + + // Create user + HttpEntity userEntity = new HttpEntity<>(new User(1, "a")); + new RestTemplate().postForEntity(url + "/create/", userEntity, Void.class); + + // Find User + new RestTemplate().getForEntity(url + "/get/{id}", User.class, 1); + + //Modify user + HttpEntity updateUserEntity = new HttpEntity<>(new User(1, "b")); + new RestTemplate().put(url + "/update/{id}", updateUserEntity, userEntity.getBody().getId(), 1); + + //Delete user + new RestTemplate().delete(url + "/delete/{id}", 1); + + Request inheritRequest = new Request.Builder().url(url + "/inherit/child/test").build(); + response = new OkHttpClient().newCall(inheritRequest).execute(); + logger.info(response.toString()); + + return SUCCESS; + } + + + @RequestMapping("/healthCheck") + @ResponseBody + public String healthCheck() { + return SUCCESS; + } + + +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java new file mode 100644 index 000000000..183e50934 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/CaseController.java @@ -0,0 +1,41 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import test.org.apache.skywalking.apm.testcase.spring3.service.TestServiceBean; + +@Controller +public class CaseController { + + private static final String SUCCESS = "Success"; + + @Autowired + private TestServiceBean testServiceBean; + + @RequestMapping(value = "/case/spring3") + @ResponseBody + public String updateUser() { + testServiceBean.doSomeBusiness("test"); + return SUCCESS; + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java new file mode 100644 index 000000000..b3d9b3762 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/component/TestComponentBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.component; + +import org.springframework.stereotype.Component; + +@Component +public class TestComponentBean { + + public String componentMethod(String name) { + return name + "-" + "dealWith-component"; + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java new file mode 100644 index 000000000..c2f7004db --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/dao/TestRepositoryBean.java @@ -0,0 +1,29 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.dao; + +import org.springframework.stereotype.Repository; + +@Repository +public class TestRepositoryBean { + + public String doSomeStuff(String name) { + return name + "-dealWithRepository"; + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java new file mode 100644 index 000000000..d81ee4e1b --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/java/test/org/apache/skywalking/apm/testcase/spring3/service/TestServiceBean.java @@ -0,0 +1,38 @@ +/* + * 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.org.apache.skywalking.apm.testcase.spring3.service; + +import test.org.apache.skywalking.apm.testcase.spring3.component.TestComponentBean; +import test.org.apache.skywalking.apm.testcase.spring3.dao.TestRepositoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class TestServiceBean { + @Autowired + private TestComponentBean componentBean; + + @Autowired + private TestRepositoryBean repositoryBean; + + public void doSomeBusiness(String name) { + componentBean.componentMethod(name); + repositoryBean.doSomeStuff(name); + } +} diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..b5cda5ae8 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml new file mode 100644 index 000000000..10222c880 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/spring-mvc-servlet.xml @@ -0,0 +1,30 @@ + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 000000000..fb573c21f --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,35 @@ + + + + skywalking-spring-3.1.x-scenario + + + spring-mvc + org.springframework.web.servlet.DispatcherServlet + 1 + + + spring-mvc + / + + diff --git a/test/plugin/scenarios/spring-4.3.x-scenario/support-version.list b/test/plugin/scenarios/spring-4.3.x-scenario/support-version.list new file mode 100644 index 000000000..956243ee5 --- /dev/null +++ b/test/plugin/scenarios/spring-4.3.x-scenario/support-version.list @@ -0,0 +1,70 @@ +# 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. + +4.3.0.RELEASE +4.3.1.RELEASE +4.3.2.RELEASE +4.3.3.RELEASE +4.3.4.RELEASE +4.3.5.RELEASE +4.3.6.RELEASE +4.3.7.RELEASE +4.3.8.RELEASE +4.3.9.RELEASE +4.3.10.RELEASE +4.3.11.RELEASE +4.3.12.RELEASE +4.3.13.RELEASE +4.3.14.RELEASE +4.3.15.RELEASE +4.3.16.RELEASE +4.3.17.RELEASE +4.3.18.RELEASE +4.3.19.RELEASE +4.3.20.RELEASE +4.3.21.RELEASE +4.3.22.RELEASE +4.3.23.RELEASE +4.3.24.RELEASE +4.3.25.RELEASE +5.0.0.RELEASE +5.0.1.RELEASE +5.0.2.RELEASE +5.0.3.RELEASE +5.0.4.RELEASE +5.0.5.RELEASE +5.0.6.RELEASE +5.0.7.RELEASE +5.0.8.RELEASE +5.0.9.RELEASE +5.0.10.RELEASE +5.0.11.RELEASE +5.0.12.RELEASE +5.0.13.RELEASE +5.0.14.RELEASE +5.0.15.RELEASE +5.1.0.RELEASE +5.1.1.RELEASE +5.1.2.RELEASE +5.1.3.RELEASE +5.1.4.RELEASE +5.1.5.RELEASE +5.1.6.RELEASE +5.1.7.RELEASE +5.1.8.RELEASE +5.1.9.RELEASE +5.1.10.RELEASE +5.2.0.RELEASE \ No newline at end of file diff --git a/test/plugin/scenarios/spring-async-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/spring-async-scenario/src/main/webapp/WEB-INF/web.xml index e00145333..581a0290d 100644 --- a/test/plugin/scenarios/spring-async-scenario/src/main/webapp/WEB-INF/web.xml +++ b/test/plugin/scenarios/spring-async-scenario/src/main/webapp/WEB-INF/web.xml @@ -20,7 +20,7 @@ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> - skywalking-ehcache-2.x-scenario + skywalking-spring-async-scenario caseServlet