diff --git a/docs/en/guides/Plugin-test.md b/docs/en/guides/Plugin-test.md
index 0a5b6b894..438cee883 100644
--- a/docs/en/guides/Plugin-test.md
+++ b/docs/en/guides/Plugin-test.md
@@ -364,7 +364,7 @@ java -jar ${agent_opts} "-Dskywalking.agent.service_name=jettyclient-scenario"
We provided archetypes and a script to make creating a project easier. It creates a completed project of a test case. So that we only need to focus on cases.
First, we can use followed command to get usage about the script.
-`bash ${SKYWALKING_HOME}/test/plugin/generator.sh -h`
+`bash ${SKYWALKING_HOME}/test/plugin/generator.sh`
Then, runs and generates a project, named by `scenario_name`, in `./scenarios`.
diff --git a/test/plugin/archetypes/jvm/src/main/resources/META-INF/maven/archetype-metadata.xml b/test/plugin/archetypes/jvm/src/main/resources/META-INF/maven/archetype-metadata.xml
index 8641ffbe2..9c42558a7 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/test/plugin/archetypes/jvm/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -55,6 +55,9 @@
config
+
+ src/main/assembly
+
src/main/java
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/bin/startup.sh b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/bin/startup.sh
index 94904d813..016a2da86 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/bin/startup.sh
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/bin/startup.sh
@@ -18,4 +18,4 @@
home="$(cd "$(dirname $0)"; pwd)"
-java -jar ${agent_opts} ${home}/../libs${scenario_name}.jar &
\ No newline at end of file
+java -jar ${agent_opts} ${home}/../libs/${scenario_name}.jar &
\ No newline at end of file
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/config/expectedData.yaml b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/config/expectedData.yaml
index d6474510c..84a375ec5 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/config/expectedData.yaml
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/config/expectedData.yaml
@@ -19,7 +19,7 @@ registryItems:
instances:
- {${scenario_name}: 1}
operationNames:
- - canal-scenario: []
+ - ${scenario_name}: []
heartbeat: []
segmentItems:
- applicationCode: ${scenario_name}
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 1bf9d5b68..68ae78b41 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
@@ -19,25 +19,41 @@
-
- org.apache.skywalking.apm.testcase
- ${artifactId}
- 1.0.0
-
+
+ org.apache.skywalking.apm.testcase
+ ${artifactId}
+ 1.0.0
+ jar
4.0.0
- ${scenario_name}
- 4.3.8.RELEASE
- 1.5.2.RELEASE
+ UTF-8
+ 1.8
+
+ YOUR VERSION
+
+ 2.1.6.RELEASE
+ skywalking-${scenario_name}
+
+
+
+
+ org.springframework.boot
+ spring-boot-dependencies
+ ${spring-boot-version}
+ pom
+ import
+
+
+
+
org.springframework.boot
- spring-boot-starter
- ${spring-boot-version}
+ spring-boot-starter-web
org.springframework.boot
@@ -48,17 +64,6 @@
org.springframework.boot
spring-boot-starter-log4j2
- ${spring-boot-version}
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
- ${spring-boot-version}
-
-
- org.springframework.boot
- spring-boot-starter-web
- ${spring-boot-version}
@@ -77,7 +82,33 @@
+
+ maven-compiler-plugin
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+ ./target/
+
+
+
+
-
\ No newline at end of file
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 e5e6e228a..96bac07ba 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,20 +16,20 @@
*
*/
-package $package;
+package ${package}.controller;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
-@Controller
+@RestController
@RequestMapping("/case")
-@PropertySource("classpath:application.properties")
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/jvm/src/main/resources/archetype-resources/src/main/resources/application.properties b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/application.yaml
similarity index 88%
rename from test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/application.properties
rename to test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/application.yaml
index 6debe4824..d77e26960 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/application.properties
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/application.yaml
@@ -15,7 +15,9 @@
# limitations under the License.
#
#
-
-server.port=8080
-server.contextPath=/${scenario_name}
-logging.config=classpath:log4j2.xml
\ No newline at end of file
+server:
+ port: 8080
+ servlet:
+ context-path: /${scenario_name}
+logging:
+ config: classpath:log4j2.xml
\ No newline at end of file
diff --git a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/log4j2.xml b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
index b5cda5ae8..9849ed5a8 100644
--- a/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
+++ b/test/plugin/archetypes/jvm/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
@@ -27,4 +27,4 @@
-
+
\ No newline at end of file
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/META-INF/maven/archetype-metadata.xml b/test/plugin/archetypes/tomcat/src/main/resources/META-INF/maven/archetype-metadata.xml
index a30eb9d20..751a583d9 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -60,5 +60,8 @@
src/main/resources
+
+ src/main/webapp
+
\ No newline at end of file
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/config/expectedData.yaml b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/config/expectedData.yaml
index d6474510c..84a375ec5 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/config/expectedData.yaml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/config/expectedData.yaml
@@ -19,7 +19,7 @@ registryItems:
instances:
- {${scenario_name}: 1}
operationNames:
- - canal-scenario: []
+ - ${scenario_name}: []
heartbeat: []
segmentItems:
- applicationCode: ${scenario_name}
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/configuration.yml b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/configuration.yml
index af2c8f7d6..50d957121 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/configuration.yml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/configuration.yml
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: jvm
+type: tomcat
entryService: http://localhost:8080/${scenario_name}/case/${scenario_case}
healthCheck: http://localhost:8080/${scenario_name}/case/healthCheck
framework: ${scenario_name}
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 48fe3612a..6316d61a3 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
@@ -27,6 +27,8 @@
4.0.0
+ skywalking-${scenario_name}
+
UTF-8
1.8
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 a9257aada..a65c423f0 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
@@ -29,6 +29,7 @@ public class CaseServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ // your codes
PrintWriter printWriter = resp.getWriter();
printWriter.write("success");
printWriter.flush();
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/HealthCheckServlet.java b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/HealthCheckServlet.java
index 4c8575606..2c4dc65a4 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/HealthCheckServlet.java
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/java/HealthCheckServlet.java
@@ -28,6 +28,7 @@ public class HealthCheckServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ // your codes
PrintWriter writer = resp.getWriter();
writer.write("Success");
writer.flush();
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/resources/log4j2.xml b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
index 4c6c06d40..9849ed5a8 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/resources/log4j2.xml
@@ -16,14 +16,14 @@
~ limitations under the License.
~
-->
-
+
-
-
+
+
-
+
diff --git a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
index 318be17d6..570d05f9d 100644
--- a/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
+++ b/test/plugin/archetypes/tomcat/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
@@ -20,7 +20,7 @@
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
- skywalking-httpclient-scenario
+ skywalking-${scenario_name}
caseServlet
diff --git a/test/plugin/generator.sh b/test/plugin/generator.sh
index 0588b940f..886a00f31 100644
--- a/test/plugin/generator.sh
+++ b/test/plugin/generator.sh
@@ -17,85 +17,51 @@
# limitation under the License.
wkdir="$(cd "$(dirname $0)"; pwd)"
-MVNW=${wkdir}/../../../mvnw
+MVNW=${wkdir}/../../mvnw
-type="jvm"
+type=
artifactId=
scenario_home=
scenario_case=
scenarios_home=${wkdir}/scenarios
+confirm=
-exitWithMessage() {
- echo $1>&2
- exit 1
-}
+while [[ -z ${scenario_name} ]]; do
+ echo "Sets the scenario name"
+ read -p ">: " scenario_name
+done
-print_help() {
- echo -e "Usage: bash generator.sh -n my-scenario -c mycase -type jvm -a my"
- echo -e "\t--type:\t\t\tchooses a type of container, 'jvm' or 'tomcat', which is 'jvm-container' or 'tomcat-container'.(required)"
- echo -e "\t-a| --artifactId:\tgives an artifactId for your project."
- echo -e "\t-n| --scenario_name:\tsets the scenario name.(required)"
- echo -e "\t-c| --scenario_case:\tsets the entry name of scenario."
- exit 0
-}
+while [[ ${type} != "jvm" && ${type} != "tomcat" ]]; do
+ echo "Chooses a type of container, 'jvm' or 'tomcat', which is 'jvm-container' or 'tomcat-container'"
+ read -p ">: " type
+done
-parse_commandline() {
- _positionals_count=0
- while test $# -gt 0
- do
- _key="$1"
- case "$_key" in
- --type=*)
- type="${_key##--type=}"
- ;;
- --type)
- test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'."
- type="$2"
- shift
- ;;
- --artifactId=*)
- artifactId="${_key##--artifactId=}"
- ;;
- -a| --artifactId)
- test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'."
- artifactId="$2"
- shift
- ;;
- --scenario_name=*)
- scenario_name="${_key##--scenario_name=}"
- ;;
- -n| --scenario_name)
- test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'."
- scenario_name="$2"
- echo "$2"
- shift
- ;;
- -c| --scenario_case)
- test $# -lt 2 && exitWithMessage "Missing value for the optional argument '$_key'."
- scenario_case="$2"
- shift
- ;;
- --scenario_case=*)
- scenario_name="${_key##--scenario_case=}"
- ;;
- -h|--help)
- print_help
- exit 0
- ;;
- esac
- shift
- done
-}
-
-parse_commandline "$@"
-
-echo "${type} ${scenario_name}"
-[[ -z ${type} ]] && print_help
-[[ -z ${scenario_name} ]] && print_help
+echo "Gives an artifactId for your project (default: ${scenario_name})"
+read -p ">: " artifactId
[[ -z ${artifactId} ]] && artifactId=${scenario_name}
+
+
+echo "Sets the entry name of scenario (default: ${scenario_name})"
+read -p ">: " scenario_case
[[ -z ${scenario_case} ]] && scenario_case=${scenario_name}
-${MVNW} -f ./pom.xml install
+echo ""
+echo -e "scenario_home: ${scenario_name}"
+echo -e "type: ${type}"
+echo -e "artifactId: ${artifactId}"
+echo -e "scenario_case: ${scenario_case}"
+echo ""
+
+while [[ ${confirm} != "Y" && ${confirm} != "N" && ${confirm} != "y" && ${confirm} != "n" ]]; do
+ echo "Please confirm: [Y/N]"
+ read -p ">: " confirm
+done
+
+if [[ ${confirm} == "N" || ${confirm} == "n" ]]; then
+ exit 0
+fi
+
+${MVNW} -f ${wkdir}/archetypes/pom.xml clean install
package="org.apache.skywalking.apm.testcase.${artifactId%%-scenario}"
${MVNW} archetype:generate \
@@ -108,4 +74,4 @@ ${MVNW} archetype:generate \
-DarchetypeCatalog=local \
-DinteractiveMode=false \
-DarchetypeVersion=1.0.0 \
- -Dpackage=${package}
+ -Dpackage=${package}
\ No newline at end of file