[test/plugin] immigrate spring scenario (#3620)

* immigrate spring async scenario

* fix rat

* Fix async not in effect

* immigrate spring scenario

* immigrate spring scenario

* fix

* immigrate spring scenario

* rollback

* fix log4j2.xml
This commit is contained in:
zhangwei 2019-10-16 13:53:20 +08:00 committed by 吴晟 Wu Sheng
parent 037df35e01
commit c2e261e482
58 changed files with 3407 additions and 2 deletions

View File

@ -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'
}
}
}
}
}

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
<artifactId>spring-3.0.x-scenario</artifactId>
<version>5.0.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>3.0.0.RELEASE</test.framework.version>
<test.framework>spring</test.framework>
</properties>
<name>skywalking-spring-3.0.x-scenario</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.3</version>
</dependency>
</dependencies>
<build>
<finalName>spring-3.0.x-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="test.org.apache.skywalking.apm.testcase.spring3"/>
<context:annotation-config/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>

View File

@ -0,0 +1,35 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>skywalking-mysql-scenario</display-name>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
<artifactId>spring-3.1.x-scenario</artifactId>
<version>5.0.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>3.1.0.RELEASE</test.framework.version>
<test.framework>spring</test.framework>
</properties>
<name>skywalking-spring-3.1.x-scenario</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>spring-3.1.x-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -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;
}
}

View File

@ -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<Integer, User> users = new ConcurrentHashMap<Integer, User>();
@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);
}
}

View File

@ -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<User> 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<User> 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;
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="test.org.apache.skywalking.apm.testcase"/>
<context:annotation-config/>
<mvc:annotation-driven/>
</beans>

View File

@ -0,0 +1,37 @@
<!--
~ 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.
~
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>skywalking-spring-3.1.x-scenario</display-name>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
<artifactId>spring-4.1.x-scenario</artifactId>
<version>5.0.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>4.1.0.RELEASE</test.framework.version>
<test.framework>spring</test.framework>
</properties>
<name>skywalking-spring-4.1.x-scenario</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>spring-4.1.x-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -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;
}
}

View File

@ -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<Integer, User> users = new ConcurrentHashMap<Integer, User>();
@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);
}
}

View File

@ -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<User> 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<User> 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;
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="test.org.apache.skywalking.apm.testcase"/>
<context:annotation-config/>
<mvc:annotation-driven/>
</beans>

View File

@ -0,0 +1,37 @@
<!--
~ 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.
~
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>skywalking-spring-4.1.x-scenario</display-name>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -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

View File

@ -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}

View File

@ -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

View File

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.skywalking</groupId>
<artifactId>spring-4.3.x-scenario</artifactId>
<version>5.0.0</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>4.3.0.RELEASE</test.framework.version>
<test.framework>spring</test.framework>
</properties>
<name>skywalking-spring-4.3.x-scenario</name>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${test.framework.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.3</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>spring-4.3.x-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${compiler.version}</source>
<target>${compiler.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -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;
}
}

View File

@ -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 {
}

View File

@ -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;
}
}

View File

@ -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<Integer, User> users = new ConcurrentHashMap<Integer, User>();
@GetMapping(value = "/get/{id}")
@ResponseBody
private ResponseEntity<User> getUser(@PathVariable("id") int id) throws InterruptedException {
User currentUser = new User(id, "a");
return ResponseEntity.ok(currentUser);
}
@PostMapping(value = "/create/")
@ResponseBody
public ResponseEntity<Void> 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<Void>(headers, HttpStatus.CREATED);
}
@PutMapping(value = "/update/{id}")
@ResponseBody
public ResponseEntity<User> 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<Void> 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();
}
}

View File

@ -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<User> 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<User> 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;
}
}

View File

@ -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;
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}

View File

@ -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);
}
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_ERR">
<PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="WARN">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
~
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:component-scan base-package="test.org.apache.skywalking.apm.testcase"/>
<mvc:annotation-driven/>
</beans>

View File

@ -0,0 +1,35 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>skywalking-spring-3.1.x-scenario</display-name>
<servlet>
<servlet-name>spring-mvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-mvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -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

View File

@ -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">
<display-name>skywalking-ehcache-2.x-scenario</display-name>
<display-name>skywalking-spring-async-scenario</display-name>
<servlet>
<servlet-name>caseServlet</servlet-name>