You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/02/23 12:34:59 UTC
[skywalking] branch master updated: [test/plugin] immigrate h2 &
struts scenario (#4395)
This is an automated email from the ASF dual-hosted git repository.
wusheng 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 2ac2d25 [test/plugin] immigrate h2 & struts scenario (#4395)
2ac2d25 is described below
commit 2ac2d2555ad46f890d46897caa3ca5dea248f52b
Author: zhang-wei <pk...@outlook.com>
AuthorDate: Sun Feb 23 20:34:44 2020 +0800
[test/plugin] immigrate h2 & struts scenario (#4395)
* immigrate test code
* enhance mysql case healthCheck
Co-authored-by: 吴晟 Wu Sheng <wu...@foxmail.com>
---
.github/workflows/plugins-test.yaml | 12 ++-
.../src/main/resources/archetype-resources/pom.xml | 9 +-
.../src/main/java/controller/CaseController.java | 10 +-
.../src/main/resources/archetype-resources/pom.xml | 7 ++
.../src/main/java/CaseServlet.java | 4 +-
test/plugin/scenarios/h2-scenario/bin/startup.sh | 21 ++++
.../scenarios/h2-scenario/config/expectedData.yaml | 115 +++++++++++++++++++++
.../plugin/scenarios/h2-scenario/configuration.yml | 21 ++++
.../h2-scenario}/pom.xml | 23 +++--
.../h2-scenario/src/main/assembly/assembly.xml | 41 ++++++++
.../skywalking/apm/testcase/h2/Application.java} | 32 ++----
.../testcase/h2}/controller/CaseController.java | 38 +++----
.../apm/testcase/h2/controller}/SQLExecutor.java | 21 +++-
.../src/main/resources/application.yaml | 23 +++++
.../h2-scenario/src/main/resources/log4j2.xml | 30 ++++++
.../scenarios/h2-scenario/support-version.list | 41 ++++++++
.../skywalking/apm/testcase/mysql/SQLExecutor.java | 7 +-
.../testcase/mysql/controller/CaseController.java | 27 ++---
.../struts2.3-scenario/config/expectedData.yaml | 91 ++++++++++++++++
.../scenarios/struts2.3-scenario/configuration.yml | 22 ++++
.../struts2.3-scenario}/pom.xml | 26 ++++-
.../apm/testcase/struts/Case1Action.java} | 24 +----
.../skywalking/apm/testcase/struts/CaseAction.java | 47 +++++++++
.../apm/testcase/struts/HealthCheckServlet.java} | 13 +--
.../src/main/resources/log4j2.xml | 30 ++++++
.../src/main/resources/struts.xml | 32 ++++++
.../src/main/webapp/WEB-INF/web.xml | 44 ++++++++
.../src/main/webapp/jsp/success.jsp | 25 +++++
.../struts2.3-scenario/support-version.list | 53 ++++++++++
.../struts2.5-scenario/config/expectedData.yaml | 91 ++++++++++++++++
.../scenarios/struts2.5-scenario/configuration.yml | 22 ++++
.../struts2.5-scenario}/pom.xml | 25 ++++-
.../apm/testcase/struts/Case1Action.java} | 24 +----
.../skywalking/apm/testcase/struts/CaseAction.java | 47 +++++++++
.../apm/testcase/struts/HealthCheckServlet.java} | 13 +--
.../src/main/resources/log4j2.xml | 30 ++++++
.../src/main/resources/struts.xml | 32 ++++++
.../src/main/webapp/WEB-INF/web.xml | 44 ++++++++
.../src/main/webapp/jsp/success.jsp | 25 +++++
.../struts2.5-scenario/support-version.list | 33 ++++++
.../undertow-scenario/config/expectedData.yaml | 10 +-
41 files changed, 1126 insertions(+), 159 deletions(-)
diff --git a/.github/workflows/plugins-test.yaml b/.github/workflows/plugins-test.yaml
index 0317d8a..db94cbe 100644
--- a/.github/workflows/plugins-test.yaml
+++ b/.github/workflows/plugins-test.yaml
@@ -53,7 +53,7 @@ jobs:
- name: Run okhttp 3.0.x-3.14.x (34)
run: bash test/plugin/run.sh okhttp-scenario
- Spring31x_ES5_Gateway_Avro:
+ Spring31x_ES5_Gateway_Avro_Struts25:
runs-on: ubuntu-18.04
timeout-minutes: 90
strategy:
@@ -83,6 +83,8 @@ jobs:
run: bash test/plugin/run.sh elasticsearch-5.x-scenario
- name: Run avro 1.7.0-1.8.2 (10)
run: bash test/plugin/run.sh avro-scenario
+ - name: Run struts2.5-scenario (14)
+ run: bash test/plugin/run.sh struts2.5-scenario
Toolkit_Webflux_SocketIO_RabbitMQ_GSON:
runs-on: ubuntu-18.04
@@ -333,7 +335,7 @@ jobs:
- name: Run zookeeper 3.4.x (14)
run: bash test/plugin/run.sh zookeeper-scenario
- Spring43:
+ Spring43_Struts23:
runs-on: ubuntu-18.04
timeout-minutes: 90
strategy:
@@ -357,6 +359,8 @@ jobs:
run: ./mvnw --batch-mode -f test/plugin/pom.xml clean package -DskipTests docker:build -DBUILD_NO=local >/dev/null
- name: Run spring 4.3.x-5.2.x (54)
run: bash test/plugin/run.sh spring-4.3.x-scenario
+ - name: Run struts2.3-scenario (35)
+ run: bash test/plugin/run.sh struts2.3-scenario
PostgreSQL94:
runs-on: ubuntu-18.04
@@ -525,7 +529,7 @@ jobs:
- name: Run mysql 5.1.2-8.0.15 (53)
run: bash test/plugin/run.sh mysql-scenario
- LETTUCE_PlayFramework:
+ LETTUCE_PlayFramework_H2:
runs-on: ubuntu-18.04
timeout-minutes: 90
strategy:
@@ -551,3 +555,5 @@ jobs:
run: bash test/plugin/run.sh lettuce-scenario
- name: Run Play! Framework
run: bash test/plugin/run.sh play-scenario
+ - name: Run h2-scenario (24)
+ run: bash test/plugin/run.sh h2-scenario
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml
index 072ed85..026b500 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml
@@ -30,10 +30,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
-
<test.framework.version>YOUR VERSION</test.framework.version>
-
<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
+ <lombok.version>1.18.10</lombok.version>
</properties>
<name>skywalking-${scenario_name}</name>
@@ -65,6 +64,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/java/controller/CaseController.java b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/java/controller/CaseController.java
index af5bd23..cde343b 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/java/controller/CaseController.java
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/java/controller/CaseController.java
@@ -16,22 +16,18 @@
*
*/
-package $
+package ${package}.controller;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
-{package}.controller;
-
@RestController
@RequestMapping("/case")
+@Log4j2
public class CaseController {
- private static final Logger logger = LogManager.getLogger(CaseController.class);
-
private static final String SUCCESS = "Success";
@RequestMapping("/${scenario_case}")
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
index 6316d61..7d4acfb 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
@@ -33,6 +33,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
<test.framework.version>YOUR VERSION</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
</properties>
<dependencies>
@@ -52,6 +53,12 @@
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
index a65c423..ee6abc1 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
@@ -18,12 +18,12 @@
package $package;
-import java.io.IOException;
-import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
public class CaseServlet extends HttpServlet {
diff --git a/test/plugin/scenarios/h2-scenario/bin/startup.sh b/test/plugin/scenarios/h2-scenario/bin/startup.sh
new file mode 100644
index 0000000..42b57dc
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/bin/startup.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar ${agent_opts} ${home}/../libs/h2-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/h2-scenario/config/expectedData.yaml b/test/plugin/scenarios/h2-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..052ac92
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/config/expectedData.yaml
@@ -0,0 +1,115 @@
+# 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:
+ - {h2-scenario: 2}
+ instances:
+ - {h2-scenario: 1}
+ operationNames:
+ - h2-scenario: [/h2-scenario/case/h2-scenario]
+ heartbeat: []
+segmentItems:
+ - applicationCode: h2-scenario
+ segmentSize: gt 1
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: H2/JDBI/PreparedStatement/execute
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 32
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:-1
+ peerId: 0
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - key: db.statement
+ value: "CREATE TABLE test_007(\nid VARCHAR(1) PRIMARY KEY, \nvalue VARCHAR(1)\
+ \ NOT NULL)"
+ - operationName: H2/JDBI/CallableStatement/execute
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 32
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:-1
+ peerId: 0
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: 'INSERT INTO test_007(id, value) VALUES(?,?)'}
+ - operationName: H2/JDBI/Statement/execute
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 32
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:-1
+ peerId: 0
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: DROP table test_007}
+ - operationName: H2/JDBI/Connection/close
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 32
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:-1
+ peerId: 0
+ tags:
+ - {key: db.type, value: sql}
+ - {key: db.instance, value: test}
+ - {key: db.statement, value: ''}
+ - operationName: /h2-scenario/case/h2-scenario
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 1
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/h2-scenario/case/h2-scenario'}
+ - {key: http.method, value: GET}
diff --git a/test/plugin/scenarios/h2-scenario/configuration.yml b/test/plugin/scenarios/h2-scenario/configuration.yml
new file mode 100644
index 0000000..b109abb
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/configuration.yml
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+type: jvm
+entryService: http://localhost:8080/h2-scenario/case/h2-scenario
+healthCheck: http://localhost:8080/h2-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+framework: h2-scenario
\ No newline at end of file
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml b/test/plugin/scenarios/h2-scenario/pom.xml
similarity index 86%
copy from test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml
copy to test/plugin/scenarios/h2-scenario/pom.xml
index 072ed85..e0f1dd2 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/pom.xml
+++ b/test/plugin/scenarios/h2-scenario/pom.xml
@@ -21,7 +21,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.skywalking.apm.testcase</groupId>
- <artifactId>${artifactId}</artifactId>
+ <artifactId>h2-scenario</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
@@ -30,13 +30,12 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
-
- <test.framework.version>YOUR VERSION</test.framework.version>
-
+ <test.framework.version>1.4.177</test.framework.version>
<spring-boot-version>2.1.6.RELEASE</spring-boot-version>
+ <lombok.version>1.18.10</lombok.version>
</properties>
- <name>skywalking-${scenario_name}</name>
+ <name>skywalking-h2-scenario</name>
<dependencyManagement>
<dependencies>
@@ -65,10 +64,22 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
</dependencies>
<build>
- <finalName>${scenario_name}</finalName>
+ <finalName>h2-scenario</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
diff --git a/test/plugin/scenarios/h2-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/h2-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..cc43dda
--- /dev/null
+++ b/test/plugin/scenarios/h2-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}/h2-scenario.jar</source>
+ <outputDirectory>./libs</outputDirectory>
+ <fileMode>0775</fileMode>
+ </file>
+ </files>
+</assembly>
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/Application.java
similarity index 52%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
copy to test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/Application.java
index a65c423..8cdfba4 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/Application.java
@@ -16,29 +16,19 @@
*
*/
-package $package;
+package org.apache.skywalking.apm.testcase.h2;
-import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
-public class CaseServlet extends HttpServlet {
+@SpringBootApplication
+public class Application {
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- // your codes
- PrintWriter printWriter = resp.getWriter();
- printWriter.write("success");
- printWriter.flush();
- printWriter.close();
+ public static void main(String[] args) {
+ try {
+ SpringApplication.run(Application.class, args);
+ } catch (Exception e) {
+ // Never do this
+ }
}
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doGet(req, resp);
- }
-
}
diff --git a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/CaseController.java
similarity index 60%
copy from test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java
copy to test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/CaseController.java
index d0121b7..32304af 100644
--- a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java
+++ b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/CaseController.java
@@ -16,51 +16,37 @@
*
*/
-package org.apache.skywalking.apm.testcase.mysql.controller;
+package org.apache.skywalking.apm.testcase.h2.controller;
-import java.sql.SQLException;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.skywalking.apm.testcase.mysql.SQLExecutor;
+import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/case")
+@Log4j2
public class CaseController {
- private static final Logger logger = LogManager.getLogger(CaseController.class);
-
private static final String SUCCESS = "Success";
- private static final String CREATE_TABLE_SQL = "CREATE TABLE test_007(\n" + "id VARCHAR(1) PRIMARY KEY, \n" + "value VARCHAR(1) NOT NULL)";
+ private static final String CREATE_TABLE_SQL = "CREATE TABLE test_007(\n" +
+ "id VARCHAR(1) PRIMARY KEY, \n" +
+ "value VARCHAR(1) NOT NULL)";
private static final String INSERT_DATA_SQL = "INSERT INTO test_007(id, value) VALUES(?,?)";
- private static final String QUERY_DATA_SQL = "SELECT id, value FROM test_007 WHERE id=?";
- private static final String DELETE_DATA_SQL = "DELETE FROM test_007 WHERE id=?";
private static final String DROP_TABLE_SQL = "DROP table test_007";
- @RequestMapping("/mysql-scenario")
+ @RequestMapping("/h2-scenario")
@ResponseBody
- public String testcase() {
- SQLExecutor sqlExecute = null;
- try {
- sqlExecute = new SQLExecutor();
+ public String testcase() throws Exception {
+ try (SQLExecutor sqlExecute = new SQLExecutor()) {
sqlExecute.createTable(CREATE_TABLE_SQL);
sqlExecute.insertData(INSERT_DATA_SQL, "1", "1");
sqlExecute.dropTable(DROP_TABLE_SQL);
- } catch (SQLException e) {
- logger.error("Failed to execute sql.", e);
- } finally {
- if (sqlExecute != null) {
- try {
- sqlExecute.closeConnection();
- } catch (SQLException e) {
- logger.error("Failed to close connection.", e);
- }
- }
+ } catch (Exception e) {
+ log.error("Failed to execute sql.", e);
+ throw e;
}
-
return SUCCESS;
}
diff --git a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/SQLExecutor.java
similarity index 76%
copy from test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java
copy to test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/SQLExecutor.java
index 4051899..1f6e3b3 100644
--- a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java
+++ b/test/plugin/scenarios/h2-scenario/src/main/java/org/apache/skywalking/apm/testcase/h2/controller/SQLExecutor.java
@@ -16,24 +16,30 @@
*
*/
-package org.apache.skywalking.apm.testcase.mysql;
+package org.apache.skywalking.apm.testcase.h2.controller;
+import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
-public class SQLExecutor {
+public class SQLExecutor implements AutoCloseable {
+
+ private static final String URL = "jdbc:h2:mem:test";
+ private static final String USERNAME = "root";
+ private static final String PASSWORD = "root";
+
private Connection connection;
public SQLExecutor() throws SQLException {
try {
- Class.forName("com.mysql.jdbc.Driver");
+ Class.forName("org.h2.Driver");
} catch (ClassNotFoundException e) {
//
}
- connection = DriverManager.getConnection(MysqlConfig.getUrl(), MysqlConfig.getUserName(), MysqlConfig.getPassword());
+ connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
}
public void createTable(String sql) throws SQLException {
@@ -43,7 +49,7 @@ public class SQLExecutor {
}
public void insertData(String sql, String id, String value) throws SQLException {
- PreparedStatement preparedStatement = connection.prepareStatement(sql);
+ CallableStatement preparedStatement = connection.prepareCall(sql);
preparedStatement.setString(1, id);
preparedStatement.setString(2, value);
preparedStatement.execute();
@@ -61,4 +67,9 @@ public class SQLExecutor {
this.connection.close();
}
}
+
+ @Override
+ public void close() throws Exception {
+ closeConnection();
+ }
}
diff --git a/test/plugin/scenarios/h2-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/h2-scenario/src/main/resources/application.yaml
new file mode 100644
index 0000000..10fe948
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/src/main/resources/application.yaml
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+server:
+ port: 8080
+ servlet:
+ context-path: /h2-scenario
+logging:
+ config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/scenarios/h2-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/h2-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9849ed5
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/src/main/resources/log4j2.xml
@@ -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>
\ No newline at end of file
diff --git a/test/plugin/scenarios/h2-scenario/support-version.list b/test/plugin/scenarios/h2-scenario/support-version.list
new file mode 100644
index 0000000..f2d7a43
--- /dev/null
+++ b/test/plugin/scenarios/h2-scenario/support-version.list
@@ -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
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# lists your version here
+1.4.177
+1.4.178
+1.4.179
+1.4.180
+1.4.181
+1.4.182
+1.4.183
+1.4.184
+1.4.185
+1.4.186
+1.4.187
+1.4.188
+1.4.189
+1.4.190
+1.4.191
+1.4.192
+1.4.193
+1.4.194
+1.4.195
+1.4.196
+1.4.197
+1.4.198
+1.4.199
+1.4.200
\ No newline at end of file
diff --git a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java b/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java
index 4051899..77e0205 100644
--- a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java
+++ b/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/SQLExecutor.java
@@ -24,7 +24,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
-public class SQLExecutor {
+public class SQLExecutor implements AutoCloseable {
private Connection connection;
public SQLExecutor() throws SQLException {
@@ -61,4 +61,9 @@ public class SQLExecutor {
this.connection.close();
}
}
+
+ @Override
+ public void close() throws Exception {
+ closeConnection();
+ }
}
diff --git a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java b/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java
index d0121b7..f72b4ef 100644
--- a/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java
+++ b/test/plugin/scenarios/mysql-scenario/src/main/java/org/apache/skywalking/apm/testcase/mysql/controller/CaseController.java
@@ -18,7 +18,6 @@
package org.apache.skywalking.apm.testcase.mysql.controller;
-import java.sql.SQLException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.skywalking.apm.testcase.mysql.SQLExecutor;
@@ -26,6 +25,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
+import java.sql.SQLException;
+
@RestController
@RequestMapping("/case")
public class CaseController {
@@ -42,32 +43,24 @@ public class CaseController {
@RequestMapping("/mysql-scenario")
@ResponseBody
- public String testcase() {
- SQLExecutor sqlExecute = null;
- try {
- sqlExecute = new SQLExecutor();
+ public String testcase() throws Exception {
+ try (SQLExecutor sqlExecute = new SQLExecutor()) {
sqlExecute.createTable(CREATE_TABLE_SQL);
sqlExecute.insertData(INSERT_DATA_SQL, "1", "1");
sqlExecute.dropTable(DROP_TABLE_SQL);
- } catch (SQLException e) {
+ } catch (Exception e) {
logger.error("Failed to execute sql.", e);
- } finally {
- if (sqlExecute != null) {
- try {
- sqlExecute.closeConnection();
- } catch (SQLException e) {
- logger.error("Failed to close connection.", e);
- }
- }
+ throw e;
}
-
return SUCCESS;
}
@RequestMapping("/healthCheck")
@ResponseBody
- public String healthCheck() {
- // your codes
+ public String healthCheck() throws Exception {
+ try (SQLExecutor sqlExecutor = new SQLExecutor()) {
+ // ignore
+ }
return SUCCESS;
}
diff --git a/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml b/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..c7e5e8b
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/config/expectedData.yaml
@@ -0,0 +1,91 @@
+# 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:
+ - {struts2.3-scenario: 2}
+ instances:
+ - {struts2.3-scenario: 1}
+ operationNames:
+ - struts2.3-scenario: [/struts2.3-scenario/struts-scenario/case1.action, /struts2.3-scenario/struts-scenario/case.action]
+ heartbeat: []
+segmentItems:
+ - applicationCode: struts2.3-scenario
+ segmentSize: gt 2
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /struts2.3-scenario/struts-scenario/case1.action
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 15
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.3-scenario/struts-scenario/case1.action'}
+ - {key: http.method, value: GET}
+ logs:
+ - logEvent:
+ - {key: forward-url, value: /struts2.3-scenario/jsp/success.jsp}
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: /struts2.3-scenario/struts-scenario/case.action,
+ networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1,
+ parentTraceSegmentId: not null, parentServiceInstanceId: 1,
+ networkAddress: 'localhost:8080', entryEndpoint: /struts2.3-scenario/struts-scenario/case.action,
+ entryServiceInstanceId: 1}
+ - segmentId: not null
+ spans:
+ - operationName: /struts2.3-scenario/struts-scenario/case1.action
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 2
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.3-scenario/struts-scenario/case1.action'}
+ - {key: http.method, value: GET}
+ - operationName: /struts2.3-scenario/struts-scenario/case.action
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 15
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.3-scenario/struts-scenario/case.action'}
+ - {key: http.method, value: GET}
+ logs:
+ - logEvent:
+ - {key: forward-url, value: /struts2.3-scenario/jsp/success.jsp}
\ No newline at end of file
diff --git a/test/plugin/scenarios/struts2.3-scenario/configuration.yml b/test/plugin/scenarios/struts2.3-scenario/configuration.yml
new file mode 100644
index 0000000..99145cd
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/configuration.yml
@@ -0,0 +1,22 @@
+# 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/struts2.3-scenario/struts-scenario/case.action
+healthCheck: http://localhost:8080/struts2.3-scenario/case/healthCheck
+framework: struts2.3-scenario
+environment:
+dependencies:
\ No newline at end of file
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml b/test/plugin/scenarios/struts2.3-scenario/pom.xml
similarity index 74%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
copy to test/plugin/scenarios/struts2.3-scenario/pom.xml
index 6316d61..1f055d9 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
+++ b/test/plugin/scenarios/struts2.3-scenario/pom.xml
@@ -21,18 +21,19 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.skywalking.apm.testcase</groupId>
- <artifactId>${artifactId}</artifactId>
+ <artifactId>struts2.3-scenario</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<modelVersion>4.0.0</modelVersion>
- <name>skywalking-${scenario_name}</name>
+ <name>skywalking-struts2.3-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
- <test.framework.version>YOUR VERSION</test.framework.version>
+ <test.framework.version>2.3.4</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
</properties>
<dependencies>
@@ -52,10 +53,27 @@
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-core</artifactId>
+ <version>${test.framework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3</version>
+ </dependency>
</dependencies>
<build>
- <finalName>${scenario_name}</finalName>
+ <finalName>struts2.3-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
similarity index 53%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
copy to test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
index a65c423..9f40d9c 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
@@ -16,29 +16,13 @@
*
*/
-package $package;
+package org.apache.skywalking.apm.testcase.struts;
import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-public class CaseServlet extends HttpServlet {
+public class Case1Action {
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- // your codes
- PrintWriter printWriter = resp.getWriter();
- printWriter.write("success");
- printWriter.flush();
- printWriter.close();
+ public String execute() throws IOException {
+ return "SUCCESS";
}
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doGet(req, resp);
- }
-
}
diff --git a/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java
new file mode 100644
index 0000000..a2405d9
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.struts;
+
+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 CaseAction {
+
+ public String execute() throws IOException {
+ visit();
+ return "SUCCESS";
+ }
+
+ private static void visit() throws IOException {
+ try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+ HttpGet httpget = new HttpGet("http://localhost:8080/struts2.3-scenario/struts-scenario/case1.action");
+ ResponseHandler<String> responseHandler = response -> {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ };
+ httpClient.execute(httpget, responseHandler);
+ }
+ }
+}
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
similarity index 86%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
copy to test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
index a65c423..0271b75 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
@@ -13,10 +13,9 @@
* 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 $package;
+package org.apache.skywalking.apm.testcase.struts;
import java.io.IOException;
import java.io.PrintWriter;
@@ -25,20 +24,18 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class CaseServlet extends HttpServlet {
+public class HealthCheckServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// your codes
- PrintWriter printWriter = resp.getWriter();
- printWriter.write("success");
- printWriter.flush();
- printWriter.close();
+ PrintWriter writer = resp.getWriter();
+ writer.write("Success");
+ writer.flush();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
-
}
diff --git a/test/plugin/scenarios/struts2.3-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/struts2.3-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9849ed5
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/resources/log4j2.xml
@@ -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>
\ No newline at end of file
diff --git a/test/plugin/scenarios/struts2.3-scenario/src/main/resources/struts.xml b/test/plugin/scenarios/struts2.3-scenario/src/main/resources/struts.xml
new file mode 100644
index 0000000..bae340e
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/resources/struts.xml
@@ -0,0 +1,32 @@
+<?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.
+ ~
+ -->
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+ <package name="case" namespace="/struts-scenario" extends="struts-default">
+ <action name="case" class="org.apache.skywalking.apm.testcase.struts.CaseAction">
+ <result name="SUCCESS">/jsp/success.jsp</result>
+ </action>
+ <action name="case1" class="org.apache.skywalking.apm.testcase.struts.Case1Action">
+ <result name="SUCCESS">/jsp/success.jsp</result>
+ </action>
+ </package>
+</struts>
diff --git a/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..2a382f5
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/WEB-INF/web.xml
@@ -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.
+ ~
+ -->
+<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-struts2.3-scenario</display-name>
+
+ <filter>
+ <filter-name>struts2</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>struts2</filter-name>
+ <url-pattern>/struts-scenario/*</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>healthCheck</servlet-name>
+ <servlet-class>org.apache.skywalking.apm.testcase.struts.HealthCheckServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>healthCheck</servlet-name>
+ <url-pattern>/case/healthCheck</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/jsp/success.jsp b/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/jsp/success.jsp
new file mode 100644
index 0000000..82c72c0
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/src/main/webapp/jsp/success.jsp
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+ <title>Title</title>
+</head>
+<body>
+Success
+</body>
+</html>
diff --git a/test/plugin/scenarios/struts2.3-scenario/support-version.list b/test/plugin/scenarios/struts2.3-scenario/support-version.list
new file mode 100644
index 0000000..e7cef99
--- /dev/null
+++ b/test/plugin/scenarios/struts2.3-scenario/support-version.list
@@ -0,0 +1,53 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# lists your version here
+
+2.3.1
+2.3.1.1
+2.3.1.2
+2.3.3
+2.3.4
+2.3.4.1
+2.3.7
+2.3.8
+2.3.12
+2.3.14
+2.3.14.1
+2.3.14.2
+2.3.24.3
+2.3.15
+2.3.15.1
+2.3.15.2
+2.3.15.3
+2.3.16
+2.3.20
+2.3.20.1
+2.3.20.3
+2.3.24
+2.3.24.1
+2.3.24.3
+2.3.28
+2.3.28.1
+2.3.29
+2.3.30
+2.3.31
+2.3.32
+2.3.33
+2.3.34
+2.3.35
+2.3.36
+2.3.37
\ No newline at end of file
diff --git a/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml b/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..3e274b1
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/config/expectedData.yaml
@@ -0,0 +1,91 @@
+# 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:
+ - {struts2.5-scenario: 2}
+ instances:
+ - {struts2.5-scenario: 1}
+ operationNames:
+ - struts2.5-scenario: [/struts2.5-scenario/struts-scenario/case1.action, /struts2.5-scenario/struts-scenario/case.action]
+ heartbeat: []
+segmentItems:
+ - applicationCode: struts2.5-scenario
+ segmentSize: gt 2
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /struts2.5-scenario/struts-scenario/case1.action
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 15
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.5-scenario/struts-scenario/case1.action'}
+ - {key: http.method, value: GET}
+ logs:
+ - logEvent:
+ - {key: forward-url, value: /struts2.5-scenario/jsp/success.jsp}
+ refs:
+ - {parentEndpointId: 0, parentEndpoint: /struts2.5-scenario/struts-scenario/case.action,
+ networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1,
+ parentTraceSegmentId: not null, parentServiceInstanceId: 1,
+ networkAddress: 'localhost:8080', entryEndpoint: /struts2.5-scenario/struts-scenario/case.action,
+ entryServiceInstanceId: 1}
+ - segmentId: not null
+ spans:
+ - operationName: /struts2.5-scenario/struts-scenario/case1.action
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 2
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: localhost:8080
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.5-scenario/struts-scenario/case1.action'}
+ - {key: http.method, value: GET}
+ - operationName: /struts2.5-scenario/struts-scenario/case.action
+ operationId: 0
+ parentSpanId: -1
+ spanId: 0
+ spanLayer: Http
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 15
+ componentName: ''
+ isError: false
+ spanType: Entry
+ peer: ''
+ peerId: 0
+ tags:
+ - {key: url, value: 'http://localhost:8080/struts2.5-scenario/struts-scenario/case.action'}
+ - {key: http.method, value: GET}
+ logs:
+ - logEvent:
+ - {key: forward-url, value: /struts2.5-scenario/jsp/success.jsp}
\ No newline at end of file
diff --git a/test/plugin/scenarios/struts2.5-scenario/configuration.yml b/test/plugin/scenarios/struts2.5-scenario/configuration.yml
new file mode 100644
index 0000000..7d5ccf4
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/configuration.yml
@@ -0,0 +1,22 @@
+# 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/struts2.5-scenario/struts-scenario/case.action
+healthCheck: http://localhost:8080/struts2.5-scenario/case/healthCheck
+framework: struts2.5-scenario
+environment:
+dependencies:
\ No newline at end of file
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml b/test/plugin/scenarios/struts2.5-scenario/pom.xml
similarity index 74%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
copy to test/plugin/scenarios/struts2.5-scenario/pom.xml
index 6316d61..3fcbfb6 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/pom.xml
+++ b/test/plugin/scenarios/struts2.5-scenario/pom.xml
@@ -21,18 +21,19 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.skywalking.apm.testcase</groupId>
- <artifactId>${artifactId}</artifactId>
+ <artifactId>struts2.5-scenario</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<modelVersion>4.0.0</modelVersion>
- <name>skywalking-${scenario_name}</name>
+ <name>skywalking-struts2.5-scenario</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compiler.version>1.8</compiler.version>
- <test.framework.version>YOUR VERSION</test.framework.version>
+ <test.framework.version>2.5.1</test.framework.version>
+ <lombok.version>1.18.10</lombok.version>
</properties>
<dependencies>
@@ -52,10 +53,26 @@
<artifactId>log4j-core</artifactId>
<version>2.8.1</version>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>${lombok.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.struts</groupId>
+ <artifactId>struts2-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>${scenario_name}</finalName>
+ <finalName>struts2.5-scenario</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
similarity index 53%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
copy to test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
index a65c423..9f40d9c 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/Case1Action.java
@@ -16,29 +16,13 @@
*
*/
-package $package;
+package org.apache.skywalking.apm.testcase.struts;
import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-public class CaseServlet extends HttpServlet {
+public class Case1Action {
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- // your codes
- PrintWriter printWriter = resp.getWriter();
- printWriter.write("success");
- printWriter.flush();
- printWriter.close();
+ public String execute() throws IOException {
+ return "SUCCESS";
}
-
- @Override
- protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- doGet(req, resp);
- }
-
}
diff --git a/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java
new file mode 100644
index 0000000..c9350b6
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/CaseAction.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.testcase.struts;
+
+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 CaseAction {
+
+ public String execute() throws IOException {
+ visit();
+ return "SUCCESS";
+ }
+
+ private static void visit() throws IOException {
+ try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
+ HttpGet httpget = new HttpGet("http://localhost:8080/struts2.5-scenario/struts-scenario/case1.action");
+ ResponseHandler<String> responseHandler = response -> {
+ HttpEntity entity = response.getEntity();
+ return entity != null ? EntityUtils.toString(entity) : null;
+ };
+ httpClient.execute(httpget, responseHandler);
+ }
+ }
+}
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
similarity index 86%
copy from test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
copy to test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
index a65c423..0271b75 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/CaseServlet.java
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/java/org/apache/skywalking/apm/testcase/struts/HealthCheckServlet.java
@@ -13,10 +13,9 @@
* 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 $package;
+package org.apache.skywalking.apm.testcase.struts;
import java.io.IOException;
import java.io.PrintWriter;
@@ -25,20 +24,18 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class CaseServlet extends HttpServlet {
+public class HealthCheckServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// your codes
- PrintWriter printWriter = resp.getWriter();
- printWriter.write("success");
- printWriter.flush();
- printWriter.close();
+ PrintWriter writer = resp.getWriter();
+ writer.write("Success");
+ writer.flush();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
-
}
diff --git a/test/plugin/scenarios/struts2.5-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/struts2.5-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9849ed5
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/resources/log4j2.xml
@@ -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>
\ No newline at end of file
diff --git a/test/plugin/scenarios/struts2.5-scenario/src/main/resources/struts.xml b/test/plugin/scenarios/struts2.5-scenario/src/main/resources/struts.xml
new file mode 100644
index 0000000..bae340e
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/resources/struts.xml
@@ -0,0 +1,32 @@
+<?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.
+ ~
+ -->
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+ <package name="case" namespace="/struts-scenario" extends="struts-default">
+ <action name="case" class="org.apache.skywalking.apm.testcase.struts.CaseAction">
+ <result name="SUCCESS">/jsp/success.jsp</result>
+ </action>
+ <action name="case1" class="org.apache.skywalking.apm.testcase.struts.Case1Action">
+ <result name="SUCCESS">/jsp/success.jsp</result>
+ </action>
+ </package>
+</struts>
diff --git a/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/WEB-INF/web.xml b/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..bb64728
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/WEB-INF/web.xml
@@ -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.
+ ~
+ -->
+<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-struts2.5-scenario</display-name>
+
+ <filter>
+ <filter-name>struts2</filter-name>
+ <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>struts2</filter-name>
+ <url-pattern>/struts-scenario/*</url-pattern>
+ </filter-mapping>
+
+ <servlet>
+ <servlet-name>healthCheck</servlet-name>
+ <servlet-class>org.apache.skywalking.apm.testcase.struts.HealthCheckServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>healthCheck</servlet-name>
+ <url-pattern>/case/healthCheck</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/jsp/success.jsp b/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/jsp/success.jsp
new file mode 100644
index 0000000..82c72c0
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/src/main/webapp/jsp/success.jsp
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+ <title>Title</title>
+</head>
+<body>
+Success
+</body>
+</html>
diff --git a/test/plugin/scenarios/struts2.5-scenario/support-version.list b/test/plugin/scenarios/struts2.5-scenario/support-version.list
new file mode 100644
index 0000000..173df13
--- /dev/null
+++ b/test/plugin/scenarios/struts2.5-scenario/support-version.list
@@ -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
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# lists your version here
+
+2.5
+2.5.1
+2.5.2
+2.5.8
+2.5.10
+2.5.10.1
+2.5.12
+2.5.13
+2.5.14
+2.5.14.1
+2.5.16
+2.5.17
+2.5.18
+2.5.20
+2.5.22
diff --git a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml
index 010032d..a600a80 100644
--- a/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml
+++ b/test/plugin/scenarios/undertow-scenario/config/expectedData.yaml
@@ -36,7 +36,7 @@ segmentItems:
spanLayer: Http
startTime: nq 0
endTime: nq 0
- componentId: 49
+ componentId: 84
componentName: ''
isError: false
spanType: Entry
@@ -54,7 +54,7 @@ segmentItems:
spanLayer: Http
startTime: nq 0
endTime: nq 0
- componentId: 49
+ componentId: 84
componentName: ''
isError: false
spanType: Entry
@@ -77,7 +77,7 @@ segmentItems:
spanLayer: Http
startTime: nq 0
endTime: nq 0
- componentId: 49
+ componentId: 84
componentName: ''
isError: false
spanType: Entry
@@ -116,7 +116,7 @@ segmentItems:
spanLayer: Unknown
startTime: nq 0
endTime: nq 0
- componentId: 49
+ componentId: 84
componentName: ''
isError: false
spanType: Local
@@ -152,7 +152,7 @@ segmentItems:
spanLayer: Unknown
startTime: nq 0
endTime: nq 0
- componentId: 49
+ componentId: 84
componentName: ''
isError: false
spanType: Local