Skip to content

Commit

Permalink
Merge branch 'master' into test_plugin_gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyuguang committed Oct 13, 2019
2 parents 272f43a + 7e7ab42 commit 2797525
Show file tree
Hide file tree
Showing 11 changed files with 595 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Jenkinsfile-Agent-Test
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ pipeline {
sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} dubbo-2.7.x-scenario'
}
}

stage('spring async 4.3.x-5.1.x (35)'){
steps{
sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} spring-async-scenario'
}
}
}
}
stage('Group2') {
Expand Down
139 changes: 139 additions & 0 deletions test/plugin/scenarios/spring-async-scenario/config/expectedData.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# 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-async-scenario: 2}
instances:
- {spring-async-scenario: 1}
operationNames:
- spring-async-scenario: [/spring-async-scenario/case/healthCheck, /spring-async-scenario/case/spring-async,
/zh/team/]
heartbeat: []
segmentItems:
- applicationCode: spring-async-scenario
segmentSize: 4
segments:
- segmentId: not null
spans:
- operationName: /spring-async-scenario/case/healthCheck
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 1
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/healthCheck'}
- {key: http.method, value: HEAD}
- segmentId: not null
spans:
- operationName: /spring-async-scenario/case/spring-async
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 1
componentName: ''
isError: false
spanType: Entry
peer: ''
peerId: 0
tags:
- {key: url, value: 'http://localhost:8080/spring-async-scenario/case/spring-async'}
- {key: http.method, value: GET}
- segmentId: not null
spans:
- operationName: /zh/team/
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 2
componentName: ''
isError: false
spanType: Exit
peer: skywalking.apache.org:80
peerId: 0
tags:
- {key: url, value: 'http://skywalking.apache.org/zh/team/?k1=v'}
- {key: http.method, value: GET}
- operationName: SpringAsync
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Unknown
startTime: nq 0
endTime: nq 0
componentId: 65
componentName: ''
isError: false
spanType: Local
peer: ''
peerId: 0
refs:
- {parentEndpointId: 0, parentEndpoint: /spring-async-scenario/case/spring-async,
networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0,
parentTraceSegmentId: not null, parentServiceInstanceId: 1,
networkAddress: '', entryEndpoint: /spring-async-scenario/case/spring-async,
entryServiceInstanceId: 1}
- segmentId: not null
spans:
- operationName: /zh/team/
operationId: 0
parentSpanId: 0
spanId: 1
spanLayer: Http
startTime: nq 0
endTime: nq 0
componentId: 2
componentName: ''
isError: false
spanType: Exit
peer: skywalking.apache.org:80
peerId: 0
tags:
- {key: url, value: 'http://skywalking.apache.org/zh/team/?k2=v'}
- {key: http.method, value: GET}
- operationName: SpringAsync
operationId: 0
parentSpanId: -1
spanId: 0
spanLayer: Unknown
startTime: nq 0
endTime: nq 0
componentId: 65
componentName: ''
isError: false
spanType: Local
peer: ''
peerId: 0
refs:
- {parentEndpointId: 0, parentEndpoint: /spring-async-scenario/case/spring-async,
networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0,
parentTraceSegmentId: not null, parentServiceInstanceId: 1,
networkAddress: '', entryEndpoint: /spring-async-scenario/case/spring-async,
entryServiceInstanceId: 1}

20 changes: 20 additions & 0 deletions test/plugin/scenarios/spring-async-scenario/configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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-async-scenario/case/spring-async
healthCheck: http://localhost:8080/spring-async-scenario/case/healthCheck
framework: spring-async
97 changes: 97 additions & 0 deletions test/plugin/scenarios/spring-async-scenario/pom.xml
Original file line number Diff line number Diff line change
@@ -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-async-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.5.RELEASE</test.framework.version>
<test.framework>spring-async</test.framework>
</properties>

<name>skywalking-spring-async-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.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>
<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.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
</dependencies>

<build>
<finalName>spring-async-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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.skywalking.apm.testcase.spring.async;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
* @author zhaoyuguang
*/
@Component
public class AsyncBean {

@Autowired
private HttpBean httpBean;

@Async
public void sendVisitBySystem() throws IOException {
httpBean.visit("http://skywalking.apache.org/zh/team/?k1=v");
}

@Async("customizeAsync")
public void sendVisitByCustomize() throws IOException {
httpBean.visit("http://skywalking.apache.org/zh/team/?k2=v");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.skywalking.apm.testcase.spring.async;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
* @author zhaoyuguang
*/
@ComponentScan(basePackages = "org.apache.skywalking.apm.testcase.spring.async")
@EnableAsync
@Configuration
public class AsyncConfig {

@Bean(value = "customizeAsync")
public AsyncTaskExecutor taskExecutor() {
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
taskExecutor.setMaxPoolSize(10);
taskExecutor.setCorePoolSize(2);
taskExecutor.setThreadNamePrefix("customize-async-thread-pool");
taskExecutor.initialize();
return taskExecutor;
}
}
Loading

0 comments on commit 2797525

Please sign in to comment.