diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test
index d30f0562f..aa82fb6ad 100755
--- a/Jenkinsfile-Agent-Test
+++ b/Jenkinsfile-Agent-Test
@@ -70,12 +70,6 @@ pipeline {
}
}
- stage('dubbo 2.5.x-2.6.x (10)') {
- steps {
- sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} dubbo-2.5.x-scenario'
- }
- }
-
stage('dubbo 2.7.x (4)') {
steps {
sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} dubbo-2.7.x-scenario'
@@ -103,7 +97,7 @@ pipeline {
}
post {
- always {
+ cleanup {
sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} --cleanup'
deleteDir()
}
diff --git a/Jenkinsfile-Agent-Test-2 b/Jenkinsfile-Agent-Test-2
new file mode 100755
index 000000000..fbf72f15e
--- /dev/null
+++ b/Jenkinsfile-Agent-Test-2
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ *
+ */
+
+pipeline {
+ agent {
+ label 'skywalking'
+ }
+
+ options {
+ timestamps()
+ timeout(time: 5, unit: 'HOURS')
+ }
+
+ tools {
+ jdk 'JDK 1.8 (latest)'
+ }
+
+ environment {
+ MAVEN_OPTS = '-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
+ }
+
+ stages {
+ stage('Checkout Source Code') {
+ steps {
+ deleteDir()
+ checkout scm
+ sh 'git submodule update --init'
+ }
+ }
+
+ stage('Compile agent Codes') {
+ steps {
+ sh './mvnw -Pagent clean package -DskipTests'
+ }
+ }
+
+ stage('Compile plugin-test tools Codes') {
+ steps {
+ sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=${BUILD_ID} docker:build'
+ }
+ }
+ stage('Run Agent Plugin Tests') {
+ parallel {
+ stage('Group1') {
+ stages {
+ stage('dubbo 2.5.x-2.6.x (10)') {
+ steps {
+ sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} dubbo-2.5.x-scenario'
+ }
+ }
+ }
+ }
+ stage('Group2') {
+ stages {
+ stage('solrj 7.x (12)') {
+ steps {
+ sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} solrj-7.x-scenario'
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ post {
+ cleanup {
+ sh 'bash test/plugin/run.sh --build_id=${BUILD_ID} --cleanup'
+ deleteDir()
+ }
+ }
+}
\ No newline at end of file
diff --git a/Jenkinsfile-E2E b/Jenkinsfile-E2E
index c04487184..7f32d6578 100755
--- a/Jenkinsfile-E2E
+++ b/Jenkinsfile-E2E
@@ -97,7 +97,7 @@ pipeline {
}
post {
- always {
+ cleanup {
// "Abort old build on update" will interrupt the job completely,
// we need to clean up when there are containers started by the e2e tests
sh 'docker ps'
diff --git a/test/plugin/containers/jvm-container/docker/run.sh b/test/plugin/containers/jvm-container/docker/run.sh
index 4ba21aa28..0fbb9d9c6 100644
--- a/test/plugin/containers/jvm-container/docker/run.sh
+++ b/test/plugin/containers/jvm-container/docker/run.sh
@@ -31,6 +31,7 @@ function exitAndClean() {
function healthCheck() {
HEALTH_CHECK_URL=$1
+ STATUS_CODE="-1"
for ((i=1; i<=30; i++));
do
@@ -42,7 +43,7 @@ function healthCheck() {
sleep 2
done
- exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION} health check failed!"
+ exitOnError "${SCENARIO_NAME}-${SCENARIO_VERSION} url=${HEALTH_CHECK_URL}, status=${STATUS_CODE} health check failed!"
}
if [[ -z "${SCENARIO_START_SCRIPT}" ]]; then
diff --git a/test/plugin/pom.xml b/test/plugin/pom.xml
index 655d9e7ab..efcae7fdc 100644
--- a/test/plugin/pom.xml
+++ b/test/plugin/pom.xml
@@ -31,7 +31,7 @@
pom
- runner
+ runner-helper
validator
mock-collector
containers
diff --git a/test/plugin/run.sh b/test/plugin/run.sh
index a49f1a3e6..efcfe6b00 100644
--- a/test/plugin/run.sh
+++ b/test/plugin/run.sh
@@ -110,7 +110,7 @@ waitForAvailable() {
do_cleanup() {
docker images -q "skywalking/agent-test-*:${build_id}" | xargs -r docker rmi -f
[[ -d ${home}/dist ]] && rm -rf ${home}/dist
- [[ -d ${home}/workspce ]] && rm -rf ${home}/workspace
+ [[ -d ${home}/workspace ]] && rm -rf ${home}/workspace
}
start_stamp=`date +%s`
@@ -132,9 +132,9 @@ task_state_house="${workspace}/.states"
[[ -d ${workspace} ]] && rm -rf $workspace
mkdir -p ${task_state_house}
-plugin_autotest_helper="${home}/dist/plugin-autotest-helper.jar"
-if [[ ! -f ${plugin_autotest_helper} ]]; then
- exitWithMessage "Plugin autotest tools not exists, Please re-try it with '-f'"
+plugin_runner_helper="${home}/dist/plugin-runner-helper.jar"
+if [[ ! -f ${plugin_runner_helper} ]]; then
+ exitWithMessage "Plugin Runner tools not exists, Please re-try it with '-f'"
print_helper
fi
@@ -174,7 +174,7 @@ do
-Doutput.dir=${case_work_base} \
-Dagent.dir=${agent_home} \
-Ddocker.image.version=${build_id} \
- ${plugin_autotest_helper} 1>${case_work_logs_dir}/helper.log
+ ${plugin_runner_helper} 1>${case_work_logs_dir}/helper.log
[[ $? -ne 0 ]] && exitWithMessage "${testcase_name}, generate script failure!"
diff --git a/test/plugin/runner/pom.xml b/test/plugin/runner-helper/pom.xml
similarity index 96%
rename from test/plugin/runner/pom.xml
rename to test/plugin/runner-helper/pom.xml
index 3781b0a63..748d90018 100644
--- a/test/plugin/runner/pom.xml
+++ b/test/plugin/runner-helper/pom.xml
@@ -27,8 +27,8 @@
4.0.0
- runner
- plugin-autotest-helper
+ runner-helper
+ plugin-runner-helper
@@ -59,7 +59,7 @@
- plugin-autotest-helper
+ plugin-runner-helper
org.apache.maven.plugins
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/AbstractRunningGenerator.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/AbstractRunningGenerator.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/AbstractRunningGenerator.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/AbstractRunningGenerator.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java
similarity index 97%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java
index 9a81d98ac..9984e20e5 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ConfigurationImpl.java
@@ -19,7 +19,6 @@ package org.apache.skywalking.plugin.test.helper;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
-import java.util.UUID;
import org.apache.skywalking.plugin.test.helper.exception.ConfigureFileNotFoundException;
import org.apache.skywalking.plugin.test.helper.util.StringUtils;
@@ -27,7 +26,6 @@ import org.apache.skywalking.plugin.test.helper.vo.CaseConfiguration;
import org.yaml.snakeyaml.Yaml;
public class ConfigurationImpl implements IConfiguration {
-
private CaseConfiguration configuration;
private final String scenarioHome;
@@ -55,7 +53,7 @@ public class ConfigurationImpl implements IConfiguration {
@Override public ScenarioRunningScriptGenerator scenarioGenerator() {
switch (runningType()) {
case DockerCompose:
- return new DockerComposeV2RunningGenerator();
+ return new DockerComposeRunningGenerator();
case Container:
return new DockerContainerRunningGenerator();
default:
@@ -108,9 +106,10 @@ public class ConfigurationImpl implements IConfiguration {
return System.getProperty("docker.image.version", "latest");
}
+
@Override
public String dockerContainerName() {
- return scenarioName() + "-" + scenarioVersion() + "-" + Long.toHexString(System.nanoTime());
+ return scenarioName() + "-" + scenarioVersion() + "-" + dockerImageVersion();
}
@Override public String scenarioHome() {
@@ -120,4 +119,5 @@ public class ConfigurationImpl implements IConfiguration {
@Override public String outputDir(){
return System.getProperty("output.dir");
}
+
}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGenerator.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java
similarity index 62%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGenerator.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java
index a03eb03f2..400184901 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGenerator.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java
@@ -28,16 +28,17 @@ import org.apache.skywalking.plugin.test.helper.vo.DockerService;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.StringWriter;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-public class DockerComposeV2RunningGenerator extends AbstractRunningGenerator {
+public class DockerComposeRunningGenerator extends AbstractRunningGenerator {
private static Logger logger = LogManager.getLogger(MethodHandles.lookup().lookupClass());
- protected DockerComposeV2RunningGenerator() {
+ protected DockerComposeRunningGenerator() {
}
@Override
@@ -49,19 +50,26 @@ public class DockerComposeV2RunningGenerator extends AbstractRunningGenerator {
root.put("scenario_name", configuration.scenarioName());
root.put("scenario_version", configuration.scenarioVersion());
root.put("entry_service", configuration.entryService());
+ root.put("start_script", configuration.startScript());
root.put("health_check", configuration.healthCheck());
- root.put("test_framework", configuration.testFramework());
+
+ root.put("expose", configuration.caseConfiguration().getExpose());
+ root.put("hostname", configuration.caseConfiguration().getHostname());
+ root.put("depends_on", configuration.caseConfiguration().getDepends_on());
+ root.put("environments", configuration.caseConfiguration().getEnvironment());
+
root.put("docker_image_name", configuration.dockerImageName());
root.put("docker_image_version", configuration.dockerImageVersion());
root.put("docker_container_name", configuration.dockerContainerName());
ArrayList links = Lists.newArrayList();
configuration.caseConfiguration().getDependencies().forEach((k, service) -> {
- links.add(service.getHost());
+ links.add(service.getHostname());
});
root.put("links", links);
- root.put("services", convertDockerServices(configuration.caseConfiguration().getDependencies()));
+ root.put("services", convertDockerServices(configuration.scenarioVersion(),
+ configuration.caseConfiguration().getDependencies()));
Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
try {
@@ -81,28 +89,46 @@ public class DockerComposeV2RunningGenerator extends AbstractRunningGenerator {
}
}
- protected List convertDockerServices(Map componentMap) {
+ protected List convertDockerServices(final String version, Map componentMap) {
ArrayList services = Lists.newArrayList();
componentMap.forEach((name, dependency) -> {
DockerService service = new DockerService();
+
+ String imageName = dependency.getImage()
+ .replace("${CASE_SERVER_IMAGE_VERSION}", version);
service.setName(name);
- service.setVersion(dependency.getVersion());
- service.setImage(dependency.getImage());
- service.setHost(dependency.getHost());
- service.setExpose(nullToEmpty(dependency.getExpose()));
- service.setVolumes(nullToEmpty(dependency.getVolumes()));
- service.setEnvironments(nullToEmpty(dependency.getEnvironment()));
+ service.setImageName(imageName);
+ service.setExpose(dependency.getExpose());
+ service.setLinks(dependency.getDepends_on());
+ service.setHostname(dependency.getHostname());
+ service.setDepends_on(dependency.getDepends_on());
+ service.setEntrypoint(dependency.getEntrypoint());
+ service.setHealthcheck(dependency.getHealthcheck());
+ service.setEnvironment(dependency.getEnvironment());
services.add(service);
});
return services;
}
- private static final List nullToEmpty(List list) {
- return list == null ? Lists.newArrayList() : list;
- }
@Override
public String runningScript(IConfiguration configuration) {
- return String.format("docker-compose -f %s up", configuration.outputDir() + File.separator +
- "docker-compose.yml");
+ String docker_compose_file = configuration.outputDir() + File.separator + "docker-compose.yml";
+
+ Map root = new HashMap<>();
+ root.put("scenario_name", configuration.scenarioName());
+ root.put("scenario_home", configuration.scenarioHome());
+ root.put("scenario_version", configuration.scenarioVersion());
+ root.put("docker_compose_file", docker_compose_file);
+ root.put("build_id", configuration.dockerImageVersion());
+ root.put("docker_container_name", configuration.dockerContainerName());
+ StringWriter out = null;
+
+ try {
+ out = new StringWriter();
+ cfg.getTemplate("compose-start-script.template").process(root, out);
+ } catch (Exception e) {
+ logger.error("Failed to generate running script.", e);
+ }
+ return out.toString();
}
}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGenerator.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGenerator.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGenerator.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGenerator.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java
similarity index 99%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java
index 038e2f563..06916e98b 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/IConfiguration.java
@@ -49,4 +49,5 @@ public interface IConfiguration {
String scenarioHome();
String outputDir();
+
}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/Main.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/Main.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/Main.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/Main.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/RunningType.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/RunningType.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/RunningType.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/RunningType.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/ScenarioRunningScriptGenerator.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ScenarioRunningScriptGenerator.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/ScenarioRunningScriptGenerator.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/ScenarioRunningScriptGenerator.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/ConfigureFileNotFoundException.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/ConfigureFileNotFoundException.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/ConfigureFileNotFoundException.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/ConfigureFileNotFoundException.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateAdditionFileException.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateAdditionFileException.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateAdditionFileException.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateAdditionFileException.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateFailedException.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateFailedException.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateFailedException.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/exception/GenerateFailedException.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/util/StringUtils.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/util/StringUtils.java
similarity index 100%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/util/StringUtils.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/util/StringUtils.java
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java
similarity index 80%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java
index 6ada6408f..a0df82eb3 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/CaseConfiguration.java
@@ -24,10 +24,12 @@ public class CaseConfiguration {
private String entryService;
private String healthCheck;
private String framework;
- @Deprecated private String version;
+ private String hostname;
private String startScript;
private Map dependencies;
private List environment;
+ private List expose;
+ private List depends_on;
public String getType() {
return type;
@@ -45,6 +47,14 @@ public class CaseConfiguration {
this.entryService = entryService;
}
+ public String getHealthCheck() {
+ return healthCheck;
+ }
+
+ public void setHealthCheck(String healthCheck) {
+ this.healthCheck = healthCheck;
+ }
+
public String getFramework() {
return framework;
}
@@ -53,12 +63,12 @@ public class CaseConfiguration {
this.framework = framework;
}
- public String getVersion() {
- return version;
+ public String getHostname() {
+ return hostname;
}
- public void setVersion(String version) {
- this.version = version;
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
}
public String getStartScript() {
@@ -77,14 +87,6 @@ public class CaseConfiguration {
this.dependencies = dependencies;
}
- public String getHealthCheck() {
- return healthCheck;
- }
-
- public void setHealthCheck(String healthCheck) {
- this.healthCheck = healthCheck;
- }
-
public List getEnvironment() {
return environment;
}
@@ -92,4 +94,20 @@ public class CaseConfiguration {
public void setEnvironment(List environment) {
this.environment = environment;
}
+
+ public List getExpose() {
+ return expose;
+ }
+
+ public void setExpose(List expose) {
+ this.expose = expose;
+ }
+
+ public List getDepends_on() {
+ return depends_on;
+ }
+
+ public void setDepends_on(List depends_on) {
+ this.depends_on = depends_on;
+ }
}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java
similarity index 70%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java
index a170bf133..5210f8766 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DependencyComponent.java
@@ -18,22 +18,16 @@ package org.apache.skywalking.plugin.test.helper.vo;
import java.util.List;
-public class DependencyComponent implements DockerServiceReader {
+public class DependencyComponent {
private String image;
- private String host;
+ private String hostname;
private String version;
+ private List links;
private List expose;
- private List volumes;
private List entrypoint;
private List environment;
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
+ private List depends_on;
+ private List healthcheck;
public String getImage() {
return image;
@@ -43,28 +37,28 @@ public class DependencyComponent implements DockerServiceReader {
this.image = image;
}
- public String getHost() {
- return host;
+ public String getHostname() {
+ return hostname;
}
- public void setHost(String host) {
- this.host = host;
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
}
- public List getEnvironment() {
- return environment;
+ public String getVersion() {
+ return version;
}
- public void setEnvironment(List environment) {
- this.environment = environment;
+ public void setVersion(String version) {
+ this.version = version;
}
- @Override public List environment() {
- return environment;
+ public List getLinks() {
+ return links;
}
- @Override public String image() {
- return host;
+ public void setLinks(List links) {
+ this.links = links;
}
public List getExpose() {
@@ -83,11 +77,27 @@ public class DependencyComponent implements DockerServiceReader {
this.entrypoint = entrypoint;
}
- public List getVolumes() {
- return volumes;
+ public List getEnvironment() {
+ return environment;
}
- public void setVolumes(List volumes) {
- this.volumes = volumes;
+ public void setEnvironment(List environment) {
+ this.environment = environment;
+ }
+
+ public List getDepends_on() {
+ return depends_on;
+ }
+
+ public void setDepends_on(List depends_on) {
+ this.depends_on = depends_on;
+ }
+
+ public List getHealthcheck() {
+ return healthcheck;
+ }
+
+ public void setHealthcheck(List healthcheck) {
+ this.healthcheck = healthcheck;
}
}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java
similarity index 54%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java
rename to test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java
index 0b7a5f610..dbc4ff9b9 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java
+++ b/test/plugin/runner-helper/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerService.java
@@ -16,21 +16,18 @@
*/
package org.apache.skywalking.plugin.test.helper.vo;
-import com.google.common.collect.Lists;
-
import java.util.List;
public class DockerService {
private String name;
- private String version;
- private String image;
- private String host;
- private List expose = Lists.newArrayList();
- @Deprecated private List ports;
- private List environments = Lists.newArrayList();
- private List volumes = Lists.newArrayList();
-
- @Deprecated private List links;
+ private String imageName;
+ private String hostname;
+ private List links;
+ private List expose;
+ private List entrypoint;
+ private List healthcheck;
+ private List depends_on;
+ private List environment;
public String getName() {
return name;
@@ -40,52 +37,20 @@ public class DockerService {
this.name = name;
}
- public String getVersion() {
- return version;
+ public String getImageName() {
+ return imageName;
}
- public void setVersion(String version) {
- this.version = version;
+ public void setImageName(String imageName) {
+ this.imageName = imageName;
}
- public String getImage() {
- return image;
+ public String getHostname() {
+ return hostname;
}
- public void setImage(String image) {
- this.image = image;
- }
-
- public List getExpose() {
- return expose;
- }
-
- public void setExpose(List expose) {
- this.expose = expose;
- }
-
- public List getPorts() {
- return ports;
- }
-
- public void setPorts(List ports) {
- this.ports = ports;
- }
-
- public List getEnvironments() {
- return environments;
- }
-
- public void setEnvironments(List environments) {
- this.environments = environments;
- }
-
- public List getVolumes() {
- return volumes;
- }
-
- public void setVolumes(List volumes) {
- this.volumes = volumes;
+ public void setHostname(String hostname) {
+ this.hostname = hostname;
}
public List getLinks() {
@@ -96,11 +61,43 @@ public class DockerService {
this.links = links;
}
- public String getHost() {
- return host;
+ public List getExpose() {
+ return expose;
}
- public void setHost(String host) {
- this.host = host;
+ public void setExpose(List expose) {
+ this.expose = expose;
+ }
+
+ public List getEntrypoint() {
+ return entrypoint;
+ }
+
+ public void setEntrypoint(List entrypoint) {
+ this.entrypoint = entrypoint;
+ }
+
+ public List getHealthcheck() {
+ return healthcheck;
+ }
+
+ public void setHealthcheck(List healthcheck) {
+ this.healthcheck = healthcheck;
+ }
+
+ public List getDepends_on() {
+ return depends_on;
+ }
+
+ public void setDepends_on(List depends_on) {
+ this.depends_on = depends_on;
+ }
+
+ public List getEnvironment() {
+ return environment;
+ }
+
+ public void setEnvironment(List environment) {
+ this.environment = environment;
}
}
diff --git a/test/plugin/runner/src/test/resources/container-start-script.template b/test/plugin/runner-helper/src/main/resources/compose-start-script.template
similarity index 52%
rename from test/plugin/runner/src/test/resources/container-start-script.template
rename to test/plugin/runner-helper/src/main/resources/compose-start-script.template
index 7ff71ba76..7a15280e3 100644
--- a/test/plugin/runner/src/test/resources/container-start-script.template
+++ b/test/plugin/runner-helper/src/main/resources/compose-start-script.template
@@ -15,15 +15,20 @@
~ limitations under the License.
-->
-docker run -itd \
- --name skywalking-agent-test-${scenario_name}-${scenario_version} \
- --env SCENARIO_VERSION=${scenario_version} \
- --env SCENARIO_SUPPORT_FRAMEWORK=${scenario_name} \
- --env SCENARIO_ENTRY_SERVICE=${entry_service} \
- --env SCENARIO_HEALTH_CHECK_URL=${health_check} \
- -v ${agent_home}:/usr/local/skywalking-agent-scenario/agent \
- -v ${scenario_home}/logs:/usr/local/skywalking-agent-scenario/logs \
- -v ${scenario_home}/reports:/usr/local/skywalking-agent-scenario/reports \
- -v ${scenario_home}/data:/usr/local/skywalking-agent-scenario/data \
- -v ${scenario_home}/packages:/usr/local/skywalking-agent-scenario/packages \
- ${docker_image_name}:latest
+compose_file="${docker_compose_file}"
+project_name="${build_id}"
+docker_container_name="${docker_container_name}_1"
+
+<#noparse>
+container_name="${project_name}_${docker_container_name}"
+docker-compose -p ${project_name} -f ${compose_file} up -d
+
+container=`docker ps -qf "name=${container_name}"`
+status=`docker wait ${container}`
+if [[ $status -ne 0 ]]; then
+ docker logs ${container} >&2
+fi
+
+docker-compose -p ${project_name} -f ${compose_file} kill
+docker-compose -p ${project_name} -f ${compose_file} rm -f
+#noparse>
\ No newline at end of file
diff --git a/test/plugin/runner/src/main/resources/container-start-script.template b/test/plugin/runner-helper/src/main/resources/container-start-script.template
similarity index 100%
rename from test/plugin/runner/src/main/resources/container-start-script.template
rename to test/plugin/runner-helper/src/main/resources/container-start-script.template
diff --git a/test/plugin/runner/src/main/resources/docker-compose.template b/test/plugin/runner-helper/src/main/resources/docker-compose.template
similarity index 53%
rename from test/plugin/runner/src/main/resources/docker-compose.template
rename to test/plugin/runner-helper/src/main/resources/docker-compose.template
index cdecb5cee..144fdf29f 100644
--- a/test/plugin/runner/src/main/resources/docker-compose.template
+++ b/test/plugin/runner-helper/src/main/resources/docker-compose.template
@@ -14,49 +14,77 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-version: 2.1
+version: '2.1'
services:
${docker_container_name}:
image: ${docker_image_name}:latest
- <#if links?size \gt 0>
+ <#if hostname??>
+ hostname: ${hostname}
+ #if>
+ <#if links??>
links:
<#list links as link>
- ${link}
#list>
#if>
environment:
- <#if environments?size \gt 0>
+ <#if environments??>
<#list environments as env>
- ${env}
#list>
#if>
- - SCENARIO_NAME:${scenario_name}
- - SCENARIO_VERSION:${scenario_version}
- - SCENARIO_ENTRY_SERVICE:${entry_service}
- - SCENARIO_HEALTH_CHECK_URL:${health_check}
+ - SCENARIO_START_SCRIPT=${start_script}
+ - SCENARIO_NAME=${scenario_name}
+ - SCENARIO_VERSION=${scenario_version}
+ - SCENARIO_ENTRY_SERVICE=${entry_service}
+ - SCENARIO_HEALTH_CHECK_URL=${health_check}
volumes:
- - ${agent_home}:/usr/local/skywalking-agent-scenario/agent
- - ${scenario_home}:/usr/local/skywalking-agent-scenario
+ - ${agent_home}:/usr/local/skywalking/scenario/agent
+ - ${scenario_home}:/usr/local/skywalking/scenario
+ <#if depends_on??>
+ depends_on:
+ <#list depends_on as item>
+ - ${item}
+ #list>
+ #if>
<#list services as service>
${service.name}:
- image: ${service.image}:${service.version}
- host: ${service.host}
- <#if service.volumes?size \gt 0>
+ image: ${service.imageName}
+ hostname: ${service.hostname}
+ <#if service.volumes??>
volumes:
<#list service.volumes as volume>
- ${volume}
#list>
#if>
- <#if service.environments?size \gt 0>
- environments:
+ <#if service.environments??>
+ environment:
<#list service.environments as environment>
- ${environment}
#list>
#if>
- <#if service.expose?size \gt 0>
+ <#if service.expose??>
expose:
<#list service.expose as expose>
- ${expose}
#list>
#if>
+ <#if service.depends_on??>
+ depends_on:
+ <#list service.depends_on as item>
+ - ${item}
+ #list>
+ #if>
+ <#if service.entrypoint??>
+ entrypoint:
+ <#list service.entrypoint as item>
+ - ${item}
+ #list>
+ #if>
+ <#if service.healthcheck??>
+ healthcheck:
+ <#list service.healthcheck as item>
+ - ${item}
+ #list>
+ #if>
#list>
\ No newline at end of file
diff --git a/test/plugin/runner/src/main/resources/log4j2.xml b/test/plugin/runner-helper/src/main/resources/log4j2.xml
similarity index 100%
rename from test/plugin/runner/src/main/resources/log4j2.xml
rename to test/plugin/runner-helper/src/main/resources/log4j2.xml
diff --git a/test/plugin/runner/src/main/resources/scenario.sh b/test/plugin/runner-helper/src/main/resources/scenario.sh
similarity index 100%
rename from test/plugin/runner/src/main/resources/scenario.sh
rename to test/plugin/runner-helper/src/main/resources/scenario.sh
diff --git a/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java b/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java
new file mode 100644
index 000000000..00754394e
--- /dev/null
+++ b/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.plugin.test.helper;
+
+import org.apache.skywalking.plugin.test.helper.exception.ConfigureFileNotFoundException;
+import org.apache.skywalking.plugin.test.helper.exception.GenerateFailedException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+
+import static org.junit.Assert.assertTrue;
+
+public class DockerComposeV2RunningGeneratorTest {
+ private DockerComposeRunningGenerator dockerComposeRunningGenerator;
+
+ private IConfiguration configuration;
+
+ public static final String TARGET_DIR = DockerComposeV2RunningGeneratorTest.class.getResource("/").getFile();
+
+ @Before
+ public void setUp() throws FileNotFoundException, ConfigureFileNotFoundException {
+ dockerComposeRunningGenerator = new DockerComposeRunningGenerator();
+
+ System.setProperty("configure.file", TARGET_DIR + "configuration-test.yml");
+ System.setProperty("scenario.home", "/solrj-scenario");
+ System.setProperty("scenario.name", "solrj-scenario");
+ System.setProperty("scenario.version", "7.7.1");
+ System.setProperty("agent.dir", "/usr/local/skywalking-agent/");
+ System.setProperty("output.dir", TARGET_DIR);
+
+ configuration = new ConfigurationImpl();
+ }
+
+ @Test
+ public void testGenerateDockerCompose() {
+ String runningScript = dockerComposeRunningGenerator.runningScript(configuration);
+// assertEquals(String.format("docker-compose -f %s/docker-compose.yml up", TARGET_DIR), runningScript);
+ }
+
+ @Test
+ public void testGenerateAdditionalFile() throws GenerateFailedException {
+ dockerComposeRunningGenerator.generateAdditionFiles(configuration);
+ assertTrue(new File(TARGET_DIR, "docker-compose.yml").exists());
+ }
+
+ @After
+ public void tearDown() {
+
+ }
+}
diff --git a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGeneratorTest.java b/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGeneratorTest.java
similarity index 100%
rename from test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGeneratorTest.java
rename to test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/DockerContainerRunningGeneratorTest.java
diff --git a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java b/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java
similarity index 92%
rename from test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java
rename to test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java
index 8d7aa7baf..31014f016 100644
--- a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java
+++ b/test/plugin/runner-helper/src/test/java/org/apache/skywalking/plugin/test/helper/vo/CaseIConfigurationTest.java
@@ -42,8 +42,7 @@ public class CaseIConfigurationTest {
CaseConfiguration caseConfiguration = yaml.loadAs(configurationFile, CaseConfiguration.class);
assertNotNull(caseConfiguration);
- assertThat(caseConfiguration.getVersion(), is("4.0.3"));
- assertThat(caseConfiguration.getFramework(), is("httpclient"));
+ assertThat(caseConfiguration.getFramework(), is("solrj"));
assertThat(caseConfiguration.getDependencies().size(), is(1));
}
}
diff --git a/test/plugin/runner/src/test/resources/configuration-test.yml b/test/plugin/runner-helper/src/test/resources/configuration-test.yml
similarity index 73%
rename from test/plugin/runner/src/test/resources/configuration-test.yml
rename to test/plugin/runner-helper/src/test/resources/configuration-test.yml
index 7df290bc2..4ce75c9f8 100644
--- a/test/plugin/runner/src/test/resources/configuration-test.yml
+++ b/test/plugin/runner-helper/src/test/resources/configuration-test.yml
@@ -1,4 +1,4 @@
-# Licensed to the Apache 5Software Foundation (ASF) under one or more
+# 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
@@ -13,18 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-type: tomcat
-entryService: http://localhost:8080/solrj-7.x-scenario/case
+type: jvm
+entryService: http://localhost:8080/solrj-7.x-scenario/case/solrj
+healthCheck: http://localhost:8080/solrj-7.x-scenario/heathcheck
+startScript: ./bin/startup.sh
framework: solrj
+environment:
+ - SOLR_SERVER=http://solr-server:8983
dependencies:
solr:
image: solr:${CASE_SERVER_IMAGE_VERSION}
- host: solr-server
- environment:
- - a:b
+ hostname: solr-server
entrypoint:
- docker-entrypoint.sh
- solr-precreate
- mycore
- volumes:
- - c:d
+
diff --git a/test/plugin/runner/src/test/resources/docker-compose-test.yml b/test/plugin/runner-helper/src/test/resources/docker-compose-test.yml
similarity index 100%
rename from test/plugin/runner/src/test/resources/docker-compose-test.yml
rename to test/plugin/runner-helper/src/test/resources/docker-compose-test.yml
diff --git a/test/plugin/runner/src/test/resources/scenario.sh b/test/plugin/runner-helper/src/test/resources/scenario.sh
similarity index 100%
rename from test/plugin/runner/src/test/resources/scenario.sh
rename to test/plugin/runner-helper/src/test/resources/scenario.sh
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java b/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java
deleted file mode 100644
index a09899f80..000000000
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGenerator.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.plugin.test.helper;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.skywalking.plugin.test.helper.exception.GenerateFailedException;
-import org.apache.skywalking.plugin.test.helper.vo.DockerCompose;
-import org.apache.skywalking.plugin.test.helper.vo.DockerService;
-import org.apache.skywalking.plugin.test.helper.vo.DockerServiceReader;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.introspector.Property;
-import org.yaml.snakeyaml.nodes.NodeTuple;
-import org.yaml.snakeyaml.nodes.Tag;
-import org.yaml.snakeyaml.representer.Representer;
-
-public class DockerComposeRunningGenerator extends AbstractRunningGenerator {
-
- @Override
- public void generateAdditionFiles(IConfiguration configuration) throws GenerateFailedException {
- DockerCompose dockerCompose = convertDockerCompose(configuration);
-
- try {
- getFileWriter().dump(dockerCompose, new FileWriter(new File(configuration.outputDir(), "docker-compose" +
- ".yml")));
- } catch (IOException e) {
- throw new GenerateFailedException();
- }
- }
-
- private DockerCompose convertDockerCompose(IConfiguration configuration) {
- DockerCompose dockerCompose = new DockerCompose();
- dockerCompose.setVersion("2.1");
-
- HashMap dockerServices = new HashMap<>();
- DockerService container = new DockerService();
- container.setImage(String.format("%s:latest", configuration.dockerImageName()));
-
- configuration.caseConfiguration().getDependencies().forEach((name, dependencyComponent) -> {
- DockerService dockerService = new DockerService();
- DockerServiceReader serviceReader = dependencyComponent;
- dockerService.setEnvironments(serviceReader.environment());
- dockerService.setImage(serviceReader.image());
- dockerServices.put(name, dockerService);
- });
-
- container.setLinks(new ArrayList<>(configuration.caseConfiguration().getDependencies().keySet()));
-
- List environment = new ArrayList();
- environment.add(String.format("SCENARIO_VERSION=%s", configuration.scenarioVersion()));
- environment.add(String.format("SCENARIO_SUPPORT_FRAMEWORK=%s", configuration.testFramework()));
- environment.add(String.format("SCENARIO_ENTRY_SERVICE=%s", configuration.entryService()));
- environment.add(String.format("SCENARIO_HEALTH_CHECK_URL=%s", configuration.healthCheck()));
-
- List volumes = new ArrayList<>();
- volumes.add(String.format("%s:/usr/local/skywalking-agent-scenario/agent", configuration.agentHome()));
-
- container.setVolumes(volumes);
- container.setEnvironments(environment);
-
- dockerServices.put(String.format("skywalking-agent-test-%s-%s", configuration.testFramework(),
- configuration.scenarioVersion())
- , container);
- dockerCompose.setServices(dockerServices);
-
- return dockerCompose;
- }
-
- private Yaml getFileWriter() {
- DumperOptions dumperOptions = new DumperOptions();
- dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- Representer representer = new Representer() {
- @Override
- protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue,
- Tag customTag) {
- if (propertyValue == null) {
- return null;
- } else {
- return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
- }
- }
- };
-
- representer.addClassTag(DockerCompose.class, Tag.MAP);
- return new Yaml(representer, dumperOptions);
- }
-
- @Override
- public String runningScript(IConfiguration configuration) {
- return String.format("docker-compose -f %s up", configuration.outputDir() + File.separator + "docker-compose" +
- ".yml");
- }
-}
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerCompose.java b/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerCompose.java
deleted file mode 100644
index 72d8624ed..000000000
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerCompose.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.plugin.test.helper.vo;
-
-import java.util.HashMap;
-
-public class DockerCompose {
- private String version;
- private HashMap services;
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public HashMap getServices() {
- return services;
- }
-
- public void setServices(HashMap services) {
- this.services = services;
- }
-}
diff --git a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGeneratorTest.java b/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGeneratorTest.java
deleted file mode 100644
index f1df6d91e..000000000
--- a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeRunningGeneratorTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.plugin.test.helper;
-
-import java.io.File;
-import java.io.InputStream;
-
-import org.apache.skywalking.plugin.test.helper.exception.GenerateFailedException;
-import org.apache.skywalking.plugin.test.helper.vo.CaseConfiguration;
-import org.apache.skywalking.plugin.test.helper.vo.CaseIConfigurationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.yaml.snakeyaml.Yaml;
-
-import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class DockerComposeRunningGeneratorTest {
-
- private DockerComposeRunningGenerator dockerComposeRunningGenerator;
- private InputStream configurationFile;
-
- @Mock
- private IConfiguration configuration;
-
- public static final String TARGET_DIR = DockerComposeRunningGeneratorTest.class.getResource("/").getFile();
-
- @Before
- public void setUp() {
- dockerComposeRunningGenerator = new DockerComposeRunningGenerator();
-
- when(configuration.outputDir()).thenReturn(TARGET_DIR);
- when(configuration.agentHome()).thenReturn("/agent/path");
- when(configuration.dockerImageName()).thenReturn("skyapm/agent-tomcat");
- when(configuration.entryService()).thenReturn("http://localhost:8080/entryService");
- when(configuration.healthCheck()).thenReturn("http://localhost:8080/healthCheck");
- when(configuration.testFramework()).thenReturn("http");
- when(configuration.scenarioVersion()).thenReturn("4.3.2");
-
- configurationFile = CaseIConfigurationTest.class.getResourceAsStream("/configuration-test.yml");
- assertNotNull(configurationFile);
- when(configuration.caseConfiguration()).thenReturn(new Yaml().loadAs(configurationFile, CaseConfiguration.class));
- }
-
- @Test
- public void testGenerateDockerCompose() {
- String runningScript = dockerComposeRunningGenerator.runningScript(configuration);
- assertEquals(String.format("docker-compose -f %s/docker-compose.template up", TARGET_DIR), runningScript);
- }
-
- @Test
- public void testGenerateAdditionalFile() throws GenerateFailedException {
- dockerComposeRunningGenerator.generateAdditionFiles(configuration);
- assertTrue(new File(TARGET_DIR, "docker-compose.template").exists());
- }
-
- @After
- public void tearDown() {
-
- }
-}
diff --git a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java b/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java
deleted file mode 100644
index 9bb033855..000000000
--- a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/DockerComposeV2RunningGeneratorTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.plugin.test.helper;
-
-import org.apache.skywalking.plugin.test.helper.exception.GenerateFailedException;
-import org.apache.skywalking.plugin.test.helper.vo.CaseConfiguration;
-import org.apache.skywalking.plugin.test.helper.vo.CaseIConfigurationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.InputStream;
-
-import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public class DockerComposeV2RunningGeneratorTest {
- private DockerComposeV2RunningGenerator dockerComposeRunningGenerator;
- private InputStream configurationFile;
-
- @Mock
- private IConfiguration configuration;
-
- public static final String TARGET_DIR = DockerComposeRunningGeneratorTest.class.getResource("/").getFile();
-
- @Before
- public void setUp() {
- dockerComposeRunningGenerator = new DockerComposeV2RunningGenerator();
-
- when(configuration.outputDir()).thenReturn(TARGET_DIR);
- when(configuration.agentHome()).thenReturn("/agent/path");
- when(configuration.dockerImageName()).thenReturn("skyapm/agent-tomcat");
- when(configuration.entryService()).thenReturn("http://localhost:8080/entryService");
- when(configuration.healthCheck()).thenReturn("http://localhost:8080/healthCheck");
- when(configuration.testFramework()).thenReturn("http");
- when(configuration.scenarioVersion()).thenReturn("4.3.2");
-
- when(configuration.scenarioName()).thenReturn("http");
- when(configuration.scenarioHome()).thenReturn("scenario_home");
- when(configuration.dockerContainerName()).thenReturn("docker_container_name");
-// when(configuration.serverAddr()).thenReturn("")
-
-
- configurationFile = CaseIConfigurationTest.class.getResourceAsStream("/configuration-test.yml");
- assertNotNull(configurationFile);
- when(configuration.caseConfiguration()).thenReturn(new Yaml().loadAs(configurationFile, CaseConfiguration.class));
- }
-
- @Test
- public void testGenerateDockerCompose() {
- String runningScript = dockerComposeRunningGenerator.runningScript(configuration);
- assertEquals(String.format("docker-compose -f %s/docker-compose.yml up", TARGET_DIR), runningScript);
- }
-
- @Test
- public void testGenerateAdditionalFile() throws GenerateFailedException {
- dockerComposeRunningGenerator.generateAdditionFiles(configuration);
- assertTrue(new File(TARGET_DIR, "docker-compose.yml").exists());
- }
-
- @After
- public void tearDown() {
-
- }
-}
diff --git a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/DockerComposeTest.java b/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/DockerComposeTest.java
deleted file mode 100644
index abe34afa9..000000000
--- a/test/plugin/runner/src/test/java/org/apache/skywalking/plugin/test/helper/vo/DockerComposeTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * 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.plugin.test.helper.vo;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.introspector.Property;
-import org.yaml.snakeyaml.nodes.NodeTuple;
-import org.yaml.snakeyaml.nodes.Tag;
-import org.yaml.snakeyaml.representer.Representer;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-public class DockerComposeTest {
- private InputStream dockerCompose;
- private String writeFile;
-
- @Before
- public void setUp() {
- writeFile = CaseIConfigurationTest.class.getResource("/").getFile() + "/file.yaml";
- dockerCompose = CaseIConfigurationTest.class.getResourceAsStream("/docker-compose-test.yml");
- assertNotNull(dockerCompose);
- }
-
- @Test
- public void readDockerCompose() {
- Yaml yaml = new Yaml();
- DockerCompose dockerfile = yaml.loadAs(dockerCompose, DockerCompose.class);
- assertNotNull(dockerfile);
- assertThat(dockerfile.getServices().size(), is(2));
- }
-
- @Test
- public void writeDockerCompose() throws IOException {
- DumperOptions dumperOptions = new DumperOptions();
- dumperOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
- Representer representer = new Representer() {
- @Override
- protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue,
- Tag customTag) {
- if (propertyValue == null) {
- return null;
- } else {
- return super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
- }
- }
- };
-
- representer.addClassTag(DockerCompose.class, Tag.MAP);
- Yaml yaml = new Yaml(representer, dumperOptions);
-
- DockerCompose dockerfile = yaml.loadAs(dockerCompose, DockerCompose.class);
- FileWriter writer = new FileWriter(writeFile);
- yaml.dump(dockerfile, writer);
-
- assertTrue(new File(writeFile).exists());
- }
-
- @After
- public void tearDown(){
- new File(writeFile).deleteOnExit();
- }
-}
diff --git a/test/plugin/runner/src/test/resources/docker-compose.template b/test/plugin/runner/src/test/resources/docker-compose.template
deleted file mode 100644
index 909a32605..000000000
--- a/test/plugin/runner/src/test/resources/docker-compose.template
+++ /dev/null
@@ -1,58 +0,0 @@
-<#--
- ~ 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.
--->
-version: 2.1
-services:
- ${docker_container_name}:
- image: ${docker_image_name}:latest
- <#if links?size \gt 0>
- links:
- <#list links as link>
- - ${link}
- #list>
- #if>
- environment:
- - SERVER_ADDR:${server_addr}
- - SCENARIO_NAME:${scenario_name}
- - SCENARIO_VERSION:${scenario_version}
- - SCENARIO_ENTRY_SERVICE:${entry_service}
- - SCENARIO_HEALTH_CHECK_URL:${health_check}
- volumes:
- - ${agent_home}:/usr/local/skywalking-agent-scenario/agent
- - ${scenario_home}:/usr/local/skywalking-agent-scenario
-<#list services as service>
- ${service.name}:
- image: ${service.image}:${service.version}
- host: ${service.host}
- <#if service.volumes?size \gt 0>
- volumes:
- <#list service.volumes as volume>
- - ${volume}
- #list>
- #if>
- <#if service.environments?size \gt 0>
- environments:
- <#list service.environments as environment>
- - ${environment}
- #list>
- #if>
- <#if service.expose?size \gt 0>
- expose:
- <#list service.expose as expose>
- - ${expose}
- #list>
- #if>
-#list>
\ No newline at end of file
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/bin/startup.sh b/test/plugin/scenarios/solrj-7.x-scenario/bin/startup.sh
new file mode 100644
index 000000000..4d6afa85e
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/bin/startup.sh
@@ -0,0 +1,20 @@
+#!/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/solrj-7.x-scenario.jar &
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml
new file mode 100644
index 000000000..85e9086dc
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/config/expectedData.yaml
@@ -0,0 +1,181 @@
+# 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:
+ - {solrj-7.x-scenario: nq 0}
+ instances:
+ - {solrj-7.x-scenario: nq 0}
+ operationNames:
+ - solrj-7.x-scenario: [/solrj-scenario/case/solrj, solrJ/mycore/update/COMMIT, solrJ/mycore/update/DELETE_BY_IDS,
+ solrJ/mycore/select, solrJ/mycore/update/DELETE_BY_QUERY, solrJ/mycore/get,
+ /solrj-scenario/case/healthcheck, solrJ/mycore/update/OPTIMIZE, solrJ/mycore/update/ADD]
+ heartbeat: []
+segmentItems:
+ - applicationCode: solrj-7.x-scenario
+ segmentSize: 2
+ segments:
+ - segmentId: not null
+ spans:
+ - operationName: /solrj-scenario/case/healthcheck
+ 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/solrj-scenario/case/healthcheck'}
+ - {key: http.method, value: HEAD}
+ - segmentId: not null
+ spans:
+ - operationName: solrJ/mycore/update/ADD
+ operationId: 0
+ parentSpanId: 0
+ spanId: 1
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: QTime, value: gt 0}
+ - operationName: solrJ/mycore/update/COMMIT
+ operationId: 0
+ parentSpanId: 0
+ spanId: 2
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: QTime, value: gt 0}
+ - operationName: solrJ/mycore/update/OPTIMIZE
+ operationId: 0
+ parentSpanId: 0
+ spanId: 3
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: QTime, value: gt 0}
+ - operationName: solrJ/mycore/select
+ operationId: 0
+ parentSpanId: 0
+ spanId: 4
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: start, value: '0'}
+ - {key: qt, value: /select}
+ - {key: numFound, value: '100'}
+ - operationName: solrJ/mycore/get
+ operationId: 0
+ parentSpanId: 0
+ spanId: 5
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: start, value: '0'}
+ - {key: qt, value: /get}
+ - {key: numFound, value: '1'}
+ - operationName: solrJ/mycore/update/DELETE_BY_IDS
+ operationId: 0
+ parentSpanId: 0
+ spanId: 6
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: QTime, value: 'gt 0'}
+ - operationName: solrJ/mycore/update/DELETE_BY_QUERY
+ operationId: 0
+ parentSpanId: 0
+ spanId: 7
+ spanLayer: Database
+ startTime: gt 0
+ endTime: gt 0
+ componentId: 63
+ componentName: ''
+ isError: false
+ spanType: Exit
+ peer: solr-server:8983
+ peerId: 0
+ tags:
+ - {key: db.type, value: Solr}
+ - {key: QTime, value: 'gt 0'}
+ - operationName: /solrj-scenario/case/solrj
+ 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/solrj-scenario/case/solrj'}
+ - {key: http.method, value: GET}
\ No newline at end of file
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml b/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml
new file mode 100644
index 000000000..30f1c29f1
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/configuration.yml
@@ -0,0 +1,31 @@
+# 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/solrj-scenario/case/solrj
+healthCheck: http://localhost:8080/solrj-scenario/case/healthcheck
+startScript: ./bin/startup.sh
+framework: solrj
+environment:
+ - SOLR_SERVER=solr-server:8983
+dependencies:
+ solr-server:
+ image: solr:${CASE_SERVER_IMAGE_VERSION}
+ hostname: solr-server
+ entrypoint:
+ - docker-entrypoint.sh
+ - solr-precreate
+ - mycore
+
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/pom.xml b/test/plugin/scenarios/solrj-7.x-scenario/pom.xml
new file mode 100644
index 000000000..0b1c955ca
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/pom.xml
@@ -0,0 +1,107 @@
+
+
+
+ 4.0.0
+
+ org.apache.skywalking
+ solrj-scenario
+ 5.0.0
+
+ skywalking-solrj-scenario
+
+
+ UTF-8
+ 1.8
+
+ 7.7.1
+ ${test.framework.version}
+
+ 2.1.4.RELEASE
+ 1.16.20
+ 2.6.2
+
+
+
+
+ org.apache.solr
+ solr-solrj
+ ${test.framework.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+ ${spring-boot.version}
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+ ${spring-boot.version}
+
+
+
+
+ solrj-7.x-scenario
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.0
+
+ ${compiler.version}
+ ${compiler.version}
+ ${project.build.sourceEncoding}
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 1.5.9.RELEASE
+
+
+
+ repackage
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+
+
+ assemble
+ package
+
+ single
+
+
+
+ src/main/assembly/assembly.xml
+
+
+
+
+
+
+
+
+
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/solrj-7.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 000000000..f2df7c7fc
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+
+
+
+
+ zip
+
+
+
+
+ ./bin
+ 0775
+
+
+
+
+
+ ${project.build.directory}/solrj-7.x-scenario.jar
+ ./libs
+ 0775
+
+
+
diff --git a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerServiceReader.java b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/Application.java
similarity index 65%
rename from test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerServiceReader.java
rename to test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/Application.java
index 8464f88e2..1a8159b0c 100644
--- a/test/plugin/runner/src/main/java/org/apache/skywalking/plugin/test/helper/vo/DockerServiceReader.java
+++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/Application.java
@@ -13,14 +13,24 @@
* 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.plugin.test.helper.vo;
-import java.util.List;
+package org.apache.skywalking.apm.testcase.solrj;
-public interface DockerServiceReader {
+import org.springframework.boot.SpringApplication;
- List environment();
+import org.springframework.boot.autoconfigure.SpringBootApplication;
- String image();
+
+@SpringBootApplication
+public class Application {
+
+ public static void main(String[] args) {
+ try {
+ SpringApplication.run(Application.class, args);
+ } catch (Exception e) {
+ // Never do this
+ }
+ }
}
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java
new file mode 100644
index 000000000..a8d895890
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/solrj/controller/CaseController.java
@@ -0,0 +1,123 @@
+/*
+ * 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.solrj.controller;
+
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+@RestController
+@RequestMapping("/solrj-scenario/case")
+public class CaseController {
+ private Logger logger = LogManager.getLogger(CaseController.class);
+
+ @Value("${SOLR_SERVER}")
+ private String host;
+
+ private String collection = "mycore";
+
+ @GetMapping("/healthcheck")
+ public String healthcheck() throws Exception {
+ return "Success";
+ }
+
+
+ @GetMapping("/solrj")
+ public String solrj() throws SolrServerException, IOException {
+ HttpSolrClient client = getClient();
+ add(client);
+
+ commit(client);
+
+ optimize(client);
+
+ search(client);
+
+ get(client);
+
+ deleteById(client);
+
+ deleteByQuery(client);
+
+ client.close();
+ return "Success";
+ }
+
+ public String add(HttpSolrClient client) throws SolrServerException, IOException {
+ List docs = new ArrayList<>();
+ for (int i=0; i<100; i++) {
+ SolrInputDocument doc = new SolrInputDocument();
+ doc.addField("id", i);
+ docs.add(doc);
+ }
+ client.add(collection, docs);
+ return "Success";
+ }
+
+ public String commit(HttpSolrClient client) throws SolrServerException, IOException {
+ client.commit(collection);
+ return "Success";
+ }
+
+ public String optimize(HttpSolrClient client) throws SolrServerException, IOException {
+ client.optimize(collection);
+ return "Success";
+ }
+ public String search(HttpSolrClient client) throws IOException, SolrServerException {
+ ModifiableSolrParams params = new ModifiableSolrParams();
+ params.set(CommonParams.Q, "*:*");
+ params.set(CommonParams.OMIT_HEADER, true);
+ QueryResponse response = client.query(collection, params);
+ return "Success";
+ }
+
+ public String get(HttpSolrClient client) throws SolrServerException, IOException {
+ client.getById(collection, "1"); //
+ return "Success";
+ }
+
+ public String deleteById(HttpSolrClient client) throws SolrServerException, IOException {
+ client.deleteById(collection, "2"); //
+ return "Success";
+ }
+
+ public String deleteByQuery(HttpSolrClient client) throws SolrServerException, IOException {
+ client.deleteByQuery(collection, "*:*"); //
+ return "Success";
+ }
+
+ private final HttpSolrClient getClient() {
+ return new HttpSolrClient.Builder(String.format("http://%s/solr/", host)).build();
+ }
+}
+
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/application.yml b/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/application.yml
new file mode 100644
index 000000000..5e94654a8
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/application.yml
@@ -0,0 +1,18 @@
+# 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
+ contextPath: /solrj-scenario
\ No newline at end of file
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 000000000..985bd03bf
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/plugin/scenarios/solrj-7.x-scenario/support-version.list b/test/plugin/scenarios/solrj-7.x-scenario/support-version.list
new file mode 100644
index 000000000..f97f2bafe
--- /dev/null
+++ b/test/plugin/scenarios/solrj-7.x-scenario/support-version.list
@@ -0,0 +1,27 @@
+# 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.
+7.7.1
+7.7.0
+7.6.0
+7.5.0
+7.4.0
+7.3.1
+7.3.0
+7.2.1
+7.2.0
+7.1.0
+7.0.1
+7.0.0
\ No newline at end of file