You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2019/10/27 10:33:50 UTC
[skywalking] branch master updated: [test/plugin] immigrate
undertow scenario (#3698)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new f471293 [test/plugin] immigrate undertow scenario (#3698)
f471293 is described below
commit f471293cdcfff114ce51b516c190236ae9d393a9
Author: zhangwei <pk...@outlook.com>
AuthorDate: Sun Oct 27 18:33:38 2019 +0800
[test/plugin] immigrate undertow scenario (#3698)
---
Jenkinsfile-Agent-Test | 9 +-
Jenkinsfile-Agent-Test-2 | 7 +-
.../v2x/HttpServerExchangeInterceptor.java | 51 +++++++++
.../apm/plugin/undertow/v2x/SWRunnable.java | 53 ++++++++++
.../define/HttpServerExchangeInstrumentation.java | 77 ++++++++++++++
.../src/main/resources/skywalking-plugin.def | 2 +
.../service-agent/java-agent/Supported-list.md | 2 +-
.../undertow-routing-scenario/bin/startup.sh | 10 +-
.../config/expectedData.yaml | 106 +++++++++++++++++++
.../undertow-routing-scenario/configuration.yml | 10 +-
.../scenarios/undertow-routing-scenario/pom.xml | 114 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++++
.../amp/testcase/undertow/Application.java | 72 +++++++++++++
.../undertow-routing-scenario/support-version.list | 35 +++++--
.../scenarios/undertow-scenario/bin/startup.sh | 10 +-
.../undertow-scenario/config/expectedData.yaml | 105 +++++++++++++++++++
.../scenarios/undertow-scenario/configuration.yml | 10 +-
test/plugin/scenarios/undertow-scenario/pom.xml | 114 +++++++++++++++++++++
.../src/main/assembly/assembly.xml | 41 ++++++++
.../amp/testcase/undertow/Application.java | 69 +++++++++++++
.../undertow-scenario/support-version.list | 35 +++++--
21 files changed, 937 insertions(+), 36 deletions(-)
diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test
index cdaa3d5..cb62f10 100755
--- a/Jenkinsfile-Agent-Test
+++ b/Jenkinsfile-Agent-Test
@@ -66,7 +66,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl1_${BUILD_ID} docker:build'
}
}
- stage('Test Cases Report (139)') {
+ stage('Test Cases Report (162)') {
steps {
echo "reserve."
}
@@ -113,7 +113,12 @@ pipeline {
sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} jetty-scenario'
}
}
- }
+ stage('undertow-routing-scenario 1.3.0-2.0.27 (23)') {
+ steps {
+ sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} undertow-routing-scenario'
+ }
+ }
+ }
}
}
}
diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2
index af0cbed2..c3b0f37 100755
--- a/Jenkinsfile-Agent-Test-2
+++ b/Jenkinsfile-Agent-Test-2
@@ -66,7 +66,7 @@ pipeline {
sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl2_${BUILD_ID} docker:build'
}
}
- stage('Test Cases Report (132)') {
+ stage('Test Cases Report (155)') {
steps {
echo "reserve."
}
@@ -125,6 +125,11 @@ pipeline {
sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} spring-4.3.x-scenario'
}
}
+ stage('undertow-scenario 1.3.0-2.0.27 (23)') {
+ steps {
+ sh 'bash test/plugin/run.sh --build_id=wl2_${BUILD_ID} undertow-scenario'
+ }
+ }
}
}
}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/HttpServerExchangeInterceptor.java b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/HttpServerExchangeInterceptor.java
new file mode 100644
index 0000000..87b7b78
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/HttpServerExchangeInterceptor.java
@@ -0,0 +1,51 @@
+/*
+ * 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.plugin.undertow.v2x;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author zhangwei
+ */
+public class HttpServerExchangeInterceptor implements InstanceMethodsAroundInterceptor {
+
+ @Override
+ public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
+ if (ContextManager.isActive()) {
+ Object argument = allArguments[1];
+ if (argument != null) {
+ allArguments[1] = new SWRunnable((Runnable) argument, ContextManager.capture());
+ }
+ }
+ }
+
+ @Override
+ public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+ return ret;
+ }
+
+ @Override
+ public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/SWRunnable.java b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/SWRunnable.java
new file mode 100644
index 0000000..75796bf
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/SWRunnable.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.undertow.v2x;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.ContextSnapshot;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+/**
+ * @author zhangwei
+ */
+public class SWRunnable implements Runnable {
+
+ private static final String OPERATION_NAME = "UndertowDispatch";
+
+ private Runnable runnable;
+
+ private ContextSnapshot snapshot;
+
+ public SWRunnable(Runnable runnable, ContextSnapshot snapshot) {
+ this.runnable = runnable;
+ this.snapshot = snapshot;
+ }
+
+ @Override
+ public void run() {
+ AbstractSpan span = ContextManager.createLocalSpan(SWRunnable.OPERATION_NAME);
+ span.setComponent(ComponentsDefine.UNDERTOW);
+ try {
+ ContextManager.continued(snapshot);
+ runnable.run();
+ } finally {
+ ContextManager.stopSpan();
+ }
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/define/HttpServerExchangeInstrumentation.java b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/define/HttpServerExchangeInstrumentation.java
new file mode 100644
index 0000000..d63f57e
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/undertow/v2x/define/HttpServerExchangeInstrumentation.java
@@ -0,0 +1,77 @@
+/*
+ * 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.plugin.undertow.v2x.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static org.apache.skywalking.apm.agent.core.plugin.bytebuddy.ArgumentTypeNameMatch.takesArgumentWithType;
+
+
+/**
+ * @author zhangwei
+ */
+public class HttpServerExchangeInstrumentation extends ClassInstanceMethodsEnhancePluginDefine {
+
+ private static final String ENHANCE_METHOD = "dispatch";
+
+ private static final String ENHANCE_CLASS = "io.undertow.server.HttpServerExchange";
+
+ private static final String INTERCEPTOR_CLASS = "org.apache.skywalking.apm.plugin.undertow.v2x.HttpServerExchangeInterceptor";
+
+ @Override
+ protected ClassMatch enhanceClass() {
+ return byName(ENHANCE_CLASS);
+ }
+
+ @Override
+ public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+ return new ConstructorInterceptPoint[0];
+ }
+
+ @Override
+ public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() {
+ return new InstanceMethodsInterceptPoint[] {
+ new InstanceMethodsInterceptPoint() {
+ @Override
+ public ElementMatcher<MethodDescription> getMethodsMatcher() {
+ return named(ENHANCE_METHOD)
+ .and(takesArgumentWithType(0, "java.util.concurrent.Executor"))
+ .and(takesArgumentWithType(1, "java.lang.Runnable"));
+ }
+
+ @Override
+ public String getMethodsInterceptor() {
+ return INTERCEPTOR_CLASS;
+ }
+
+ @Override
+ public boolean isOverrideArgs() {
+ return true;
+ }
+ }
+ };
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
index 315079b..2a504e6 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
@@ -19,3 +19,5 @@ undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.Request
undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.HttpServerExchangeInstrumentation
+
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md
index cc139fd..ef610a8 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -10,7 +10,7 @@
* [Resin](http://www.caucho.com/resin-4.0/) 4 (Optional¹)
* [Jetty Server](http://www.eclipse.org/jetty/) 9
* [Spring Webflux](https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html) 5.x
- * [Undertow](http://undertow.io/) 2.0.0.Final -> 2.0.13.Final
+ * [Undertow](http://undertow.io/) 1.3.0.Final -> 2.0.27.Final
* [RESTEasy](https://resteasy.github.io/) 3.1.0.Final -> 3.7.0.Final
* [Play Framework](https://www.playframework.com/) 2.6.x -> 2.7.x (Optional²)
* [Light4J Microservices Framework](https://doc.networknt.com/) 1.6.x -> 2.x
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-routing-scenario/bin/startup.sh
similarity index 59%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-routing-scenario/bin/startup.sh
index 315079b..52f5a54 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-routing-scenario/bin/startup.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -14,8 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar ${agent_opts} ${home}/../libs/undertow-routing-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-routing-scenario/config/expectedData.yaml b/test/plugin/scenarios/undertow-routing-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..b8439fe
--- /dev/null
+++ b/test/plugin/scenarios/undertow-routing-scenario/config/expectedData.yaml
@@ -0,0 +1,106 @@
+# 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:
+ - {undertow-routing-scenario: 2}
+ instances:
+ - {undertow-routing-scenario: 1}
+ operationNames:
+ - undertow-routing-scenario: [/undertow-routing-scenario/case/undertow1, '/undertow-routing-scenario/case/{context}']
+ heartbeat: []
+segmentItems:
+ - applicationCode: undertow-routing-scenario
+ segmentSize: gt 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-routing-scenario/case/{context}
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-routing-scenario/case/undertow'}
+ - {key: http.method, value: GET}
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-routing-scenario/case/{context}
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-routing-scenario/case/undertow1'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0,
+ entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: '/undertow-routing-scenario/case/{context}',
+ entryServiceInstanceId: 1}
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-routing-scenario/case/undertow1
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 2
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-routing-scenario/case/undertow1?send=httpHandler'}
+ - {key: http.method, value: GET}
+ - operationName: UndertowDispatch
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Local
+ peer: ''
+ peerId: 0
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: '/undertow-routing-scenario/case/{context}',
+ networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 0,
+ parentTraceSegmentId: not null, parentServiceInstanceId: 1,
+ networkAddress: '', entryEndpoint: '/undertow-routing-scenario/case/{context}',
+ entryServiceInstanceId: 1}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-routing-scenario/configuration.yml
similarity index 59%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-routing-scenario/configuration.yml
index 315079b..c32ce96 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-routing-scenario/configuration.yml
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+type: jvm
+entryService: http://localhost:8080/undertow-routing-scenario/case/undertow
+healthCheck: http://localhost:8080/undertow-routing-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+framework: undertow
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-routing-scenario/pom.xml b/test/plugin/scenarios/undertow-routing-scenario/pom.xml
new file mode 100644
index 0000000..7ab0a46
--- /dev/null
+++ b/test/plugin/scenarios/undertow-routing-scenario/pom.xml
@@ -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>undertow-routing-scenario</artifactId>
+ <packaging>jar</packaging>
+ <version>5.0.0</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <compiler.version>1.8</compiler.version>
+ <start-class>org.apache.skywalking.amp.testcase.undertow.Application</start-class>
+
+ <test.framework>undertow</test.framework>
+ <test.framework.version>1.3.0.Final</test.framework.version>
+ </properties>
+
+ <name>skywalking-undertow-routing-scenario</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-core</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>undertow-routing-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${compiler.version}</source>
+ <target>${compiler.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
+ </descriptors>
+ <outputDirectory>./target/</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </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>
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-routing-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/undertow-routing-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..9d3588c
--- /dev/null
+++ b/test/plugin/scenarios/undertow-routing-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?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.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/undertow-routing-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/undertow-routing-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java b/test/plugin/scenarios/undertow-routing-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java
new file mode 100644
index 0000000..4a33673
--- /dev/null
+++ b/test/plugin/scenarios/undertow-routing-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java
@@ -0,0 +1,72 @@
+/*
+ * 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.amp.testcase.undertow;
+
+import io.undertow.Undertow;
+import io.undertow.server.HttpHandler;
+import io.undertow.server.RoutingHandler;
+import io.undertow.util.Headers;
+import io.undertow.util.Methods;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+
+public class Application {
+
+ private static final String TEMPLATE = "/undertow-routing-scenario/case/{context}";
+
+ private static final String CASE_URL = "/undertow-routing-scenario/case/undertow";
+
+ public static void main(String[] args) {
+ HttpHandler httpHandler = exchange -> {
+ if (CASE_URL.equals(exchange.getRequestPath())) {
+ exchange.dispatch(httpServerExchange -> visit("http://localhost:8080/undertow-routing-scenario/case/undertow1?send=httpHandler"));
+ }
+ exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
+ exchange.getResponseSender().send("Success");
+ };
+ RoutingHandler handler = new RoutingHandler();
+ handler.add(Methods.GET, TEMPLATE, httpHandler);
+ handler.add(Methods.HEAD, TEMPLATE, httpHandler);
+ Undertow server = Undertow.builder()
+ .addHttpListener(8080, "0.0.0.0")
+ .setHandler(handler).build();
+ Runtime.getRuntime().addShutdownHook(new Thread(server::stop));
+ server.start();
+ }
+
+ private static void visit(String url) throws IOException {
+ CloseableHttpClient httpclient = HttpClients.createDefault();
+ try {
+ HttpGet httpget = new HttpGet(url);
+ ResponseHandler<String> responseHandler = response -> {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ };
+ httpclient.execute(httpget, responseHandler);
+ } finally {
+ httpclient.close();
+ }
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-routing-scenario/support-version.list
similarity index 52%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-routing-scenario/support-version.list
index 315079b..3a6f7d0 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-routing-scenario/support-version.list
@@ -2,7 +2,7 @@
# 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
+# 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
#
@@ -14,8 +14,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+# undertow has a total of 90 versions from 1.3.0 to 2.0.27, in order to reduce the workload of agent-plugin-test,
+# so, some test cases are excluded according to the following rules.
+# 1.3.x 1.4.x: select the first, middle, and last version
+# 2.0.x: when there are many releases in the same month, choose the last one
+
+1.3.0.Final
+1.3.17.Final
+1.3.33.Final
+1.4.0.Final
+1.4.12.Final
+1.4.27.Final
+2.0.0.Final
+2.0.3.Final
+2.0.4.Final
+2.0.8.Final
+2.0.9.Final
+2.0.11.Final
+2.0.13.Final
+2.0.15.Final
+2.0.16.Final
+2.0.17.Final
+2.0.19.Final
+2.0.20.Final
+2.0.21.Final
+2.0.22.Final
+2.0.23.Final
+2.0.26.Final
+2.0.27.Final
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-scenario/bin/startup.sh
similarity index 59%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-scenario/bin/startup.sh
index 315079b..c6afdcd 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-scenario/bin/startup.sh
@@ -1,3 +1,5 @@
+#!/bin/bash
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -14,8 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar ${agent_opts} ${home}/../libs/undertow-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..bbfbafb
--- /dev/null
+++ b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml
@@ -0,0 +1,105 @@
+# 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:
+ - {undertow-scenario: 2}
+ instances:
+ - {undertow-scenario: 1}
+ operationNames:
+ - undertow-scenario: [/undertow-scenario/case/undertow1, /undertow-scenario/case/undertow]
+ heartbeat: []
+segmentItems:
+ - applicationCode: undertow-scenario
+ segmentSize: gt 3
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-scenario/case/undertow
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-scenario/case/undertow'}
+ - {key: http.method, value: GET}
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-scenario/case/undertow1
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-scenario/case/undertow1'}
+ - {key: http.method, value: GET}
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: UndertowDispatch, networkAddressId: 0,
+ entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null,
+ parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /undertow-scenario/case/undertow,
+ entryServiceInstanceId: 1}
+ - segmentId: not null
+ spans:
+ - operationName: /undertow-scenario/case/undertow1
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 2
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/undertow-scenario/case/undertow1?send=runnable'}
+ - {key: http.method, value: GET}
+ - operationName: UndertowDispatch
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Unknown
+ startTime: nq 0
+ endTime: nq 0
+ componentId: 49
+ componentName: ''
+ isError: false
+ spanType: Local
+ peer: ''
+ peerId: 0
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: /undertow-scenario/case/undertow, networkAddressId: 0,
+ entryEndpointId: 0, refType: CrossThread, parentSpanId: 0, parentTraceSegmentId: not null,
+ parentServiceInstanceId: 1, networkAddress: '', entryEndpoint: /undertow-scenario/case/undertow,
+ entryServiceInstanceId: 1}
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-scenario/configuration.yml
similarity index 59%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-scenario/configuration.yml
index 315079b..277dea5 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-scenario/configuration.yml
@@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+type: jvm
+entryService: http://localhost:8080/undertow-scenario/case/undertow
+healthCheck: http://localhost:8080/undertow-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+framework: undertow
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-scenario/pom.xml b/test/plugin/scenarios/undertow-scenario/pom.xml
new file mode 100644
index 0000000..9bf672e
--- /dev/null
+++ b/test/plugin/scenarios/undertow-scenario/pom.xml
@@ -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>undertow-scenario</artifactId>
+ <packaging>jar</packaging>
+ <version>5.0.0</version>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <compiler.version>1.8</compiler.version>
+ <start-class>org.apache.skywalking.amp.testcase.undertow.Application</start-class>
+
+ <test.framework>undertow</test.framework>
+ <test.framework.version>1.3.0.Final</test.framework.version>
+ </properties>
+
+ <name>skywalking-undertow-scenario</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.undertow</groupId>
+ <artifactId>undertow-core</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>undertow-scenario</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${compiler.version}</source>
+ <target>${compiler.version}</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>assemble</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/assembly.xml</descriptor>
+ </descriptors>
+ <outputDirectory>./target/</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </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>
\ No newline at end of file
diff --git a/test/plugin/scenarios/undertow-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/undertow-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..1455d1d
--- /dev/null
+++ b/test/plugin/scenarios/undertow-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?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.
+ ~
+ -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>./bin</directory>
+ <fileMode>0775</fileMode>
+ </fileSet>
+ </fileSets>
+
+ <files>
+ <file>
+ <source>${project.build.directory}/undertow-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/scenarios/undertow-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java b/test/plugin/scenarios/undertow-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java
new file mode 100644
index 0000000..f1fa0bd
--- /dev/null
+++ b/test/plugin/scenarios/undertow-scenario/src/main/java/org/apache/skywalking/amp/testcase/undertow/Application.java
@@ -0,0 +1,69 @@
+/*
+ * 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.amp.testcase.undertow;
+
+import io.undertow.Undertow;
+import io.undertow.util.Headers;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.ResponseHandler;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+
+public class Application {
+
+ private static final String CASE_URL = "/undertow-scenario/case/undertow";
+
+ public static void main(String[] args) throws InterruptedException {
+ Undertow server = Undertow.builder()
+ .addHttpListener(8080, "0.0.0.0")
+ .setHandler(exchange -> {
+ if (CASE_URL.equals(exchange.getRequestPath())) {
+ exchange.dispatch(() -> {
+ try {
+ visit("http://localhost:8080/undertow-scenario/case/undertow1?send=runnable");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ });
+ }
+ exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");
+ exchange.getResponseSender().send("Success");
+ }).build();
+ Runtime.getRuntime().addShutdownHook(new Thread(server::stop));
+ server.start();
+ }
+
+ private static void visit(String url) throws IOException {
+ CloseableHttpClient httpclient = HttpClients.createDefault();
+ try {
+ HttpGet httpget = new HttpGet(url);
+ ResponseHandler<String> responseHandler = response -> {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ };
+ httpclient.execute(httpget, responseHandler);
+ } finally {
+ httpclient.close();
+ }
+ }
+}
diff --git a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def b/test/plugin/scenarios/undertow-scenario/support-version.list
similarity index 52%
copy from apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
copy to test/plugin/scenarios/undertow-scenario/support-version.list
index 315079b..3a6f7d0 100644
--- a/apm-sniffer/apm-sdk-plugin/undertow-plugins/undertow-2.x-plugin/src/main/resources/skywalking-plugin.def
+++ b/test/plugin/scenarios/undertow-scenario/support-version.list
@@ -2,7 +2,7 @@
# 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
+# 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
#
@@ -14,8 +14,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RoutingHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.RequestDispatcherImplInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowRootHandlerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowAddListenerInstrumentation
-undertow-2.x-plugin=org.apache.skywalking.apm.plugin.undertow.v2x.define.UndertowListenerConfigInstrumentation
+# undertow has a total of 90 versions from 1.3.0 to 2.0.27, in order to reduce the workload of agent-plugin-test,
+# so, some test cases are excluded according to the following rules.
+# 1.3.x 1.4.x: select the first, middle, and last version
+# 2.0.x: when there are many releases in the same month, choose the last one
+
+1.3.0.Final
+1.3.17.Final
+1.3.33.Final
+1.4.0.Final
+1.4.12.Final
+1.4.27.Final
+2.0.0.Final
+2.0.3.Final
+2.0.4.Final
+2.0.8.Final
+2.0.9.Final
+2.0.11.Final
+2.0.13.Final
+2.0.15.Final
+2.0.16.Final
+2.0.17.Final
+2.0.19.Final
+2.0.20.Final
+2.0.21.Final
+2.0.22.Final
+2.0.23.Final
+2.0.26.Final
+2.0.27.Final
\ No newline at end of file