From 986db3c6fe206dd01df3840edfd126e0e2d1b321 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 8 Apr 2020 13:17:31 -0400 Subject: [PATCH 01/13] vertx web plugin re-impl attempt --- .../vertx-web-3.x-scenario/bin/startup.sh | 21 +++ .../config/expectedData.yaml | 93 ++++++++++++ .../vertx-web-3.x-scenario/configuration.yml | 21 +++ .../scenarios/vertx-web-3.x-scenario/pom.xml | 138 ++++++++++++++++++ .../src/main/assembly/assembly.xml | 41 ++++++ .../apm/testcase/vertxweb/Application.java | 40 +++++ .../controller/VertxCoreController.java | 51 +++++++ .../src/main/resources/log4j2.xml | 30 ++++ .../support-version.list | 37 +++++ 9 files changed, 472 insertions(+) create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml create mode 100644 test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh b/test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh new file mode 100644 index 000000000000..856a33da16bb --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} ${home}/../libs/vertx-web-3.x-scenario.jar & diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000000..c1e51ec35aea --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml @@ -0,0 +1,93 @@ +registryItems: + applications: + - {vertx-web-3.x-scenario: 2} + instances: + - {vertx-web-3.x-scenario: 1} + operationNames: + - vertx-web-3.x-scenario: [ + "/vertx-web-3-scenario/case/healthCheck", + "/vertx-web-3-scenario/case/web-case" + ] +segmentItems: +- applicationCode: vertx-web-3.x-scenario + segmentSize: 3 + segments: + - segmentId: nq 0 + spans: + - operationName: "/vertx-web-3-scenario/case/healthCheck" + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + tags: + - {key: "http.method", value: "GET"} + - {key: "url", value: "/vertx-web-3-scenario/case/healthCheck"} + startTime: nq 0 + endTime: nq 0 + componentId: 59 + componentName: "" + isError: false + spanType: Exit + peer: not null + peerId: 0 + - operationName: "/vertx-web-3-scenario/case/web-case" + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + tags: + - {key: "http.method", value: "GET"} + - {key: "url", value: "/vertx-web-3-scenario/case/web-case"} + startTime: nq 0 + endTime: nq 0 + componentId: 59 + componentName: "" + isError: false + spanType: Entry + peer: "" + peerId: 0 + - segmentId: nq 0 + spans: + - operationName: "#/vertx-web-3-scenario/case/healthCheck" + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + refs: + - {parentEndpointId: 0, parentEndpoint: "/vertx-web-3-scenario/case/web-case", + networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 1, + parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: "", + entryEndpoint: "/vertx-web-3-scenario/case/web-case", entryServiceInstanceId: 1} + startTime: nq 0 + endTime: nq 0 + componentId: 59 + componentName: "" + isError: false + spanType: Local + peer: "" + peerId: 0 + - segmentId: nq 0 + spans: + - operationName: "/vertx-web-3-scenario/case/healthCheck" + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + refs: + - {parentEndpointId: 0, parentEndpoint: "/vertx-web-3-scenario/case/web-case", + networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, + parentTraceSegmentId: not null, parentServiceInstanceId: 1, + networkAddress: "localhost:8080", + entryEndpoint: "/vertx-web-3-scenario/case/web-case", + entryServiceInstanceId: 1} + tags: + - {key: "http.method", value: "GET"} + - {key: "url", value: "/vertx-web-3-scenario/case/healthCheck"} + startTime: nq 0 + endTime: nq 0 + componentId: 59 + componentName: "" + isError: false + spanType: Entry + peer: "" + peerId: 0 diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml b/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml new file mode 100644 index 000000000000..236809d59ed9 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: jvm +entryService: http://localhost:8080/vertx-web-3-scenario/case/web-case +healthCheck: http://localhost:8080/vertx-web-3-scenario/case/healthCheck +startScript: ./bin/startup.sh +framework: Vert.x diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml new file mode 100644 index 000000000000..93333b9b5f9b --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml @@ -0,0 +1,138 @@ + + + + 4.0.0 + + org.apache.skywalking + vertx-web-3.x-scenario + 5.0.0 + skywalking-vertx-web-3.x-scenario + + + UTF-8 + 1.8 + 2.6.2 + 1.5.2.RELEASE + 3.6.3 + 3 + + + + + io.vertx + vertx-web + ${vertx.version} + + + + + org.springframework.boot + spring-boot-starter + ${spring-boot-version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + + + org.apache.logging.log4j + log4j-jcl + ${log4j.version} + + + org.springframework.boot + spring-boot-starter-tomcat + ${spring-boot-version} + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot-version} + + + + + vertx-web-3.x-scenario + + + org.springframework.boot + spring-boot-maven-plugin + 1.5.9.RELEASE + + + + repackage + + + + + + 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/ + + + + + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + spring-milestones + http://repo.spring.io/milestone + + + diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000000..0494bce21351 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/vertx-web-3.x-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java new file mode 100644 index 000000000000..dadafb0959ec --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -0,0 +1,40 @@ +/* + * 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.vertxweb; + +import io.vertx.core.Vertx; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxCoreController; + +public class Application { + + private static final Logger logger = LogManager.getLogger(Application.class); + + public static void main(String[] args) { + logger.info("Application started"); + + System.setProperty("vertx.disableFileCPResolving", "true"); + Vertx.vertx().deployVerticle(new VertxCoreController(), it -> { + if (it.failed()) { + it.cause().printStackTrace(); + System.exit(-1); + } + }); + } +} diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java new file mode 100644 index 000000000000..64445a8b9a76 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.skywalking.apm.testcase.vertxweb.controller; + +import io.vertx.core.AbstractVerticle; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.RoutingContext; +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class VertxCoreController extends AbstractVerticle { + + private static final Logger logger = LogManager.getLogger(VertxCoreController.class); + + @Override + public void start() { + logger.info("VertxCoreController started"); + + Router router = Router.router(vertx); + router.get("/vertx-web-3-scenario/case/web-case").handler(this::handleCoreCase); + router.get("/vertx-web-3-scenario/case/healthCheck").handler(this::healthCheck); + vertx.createHttpServer().requestHandler(router::accept).listen(8080); + } + + private void handleCoreCase(RoutingContext routingContext) { + vertx.createHttpClient().getNow(8080, "localhost", + "/vertx-web-3-scenario/case/healthCheck", + it -> routingContext.response().setStatusCode(it.statusCode()).end()); + } + + private void healthCheck(RoutingContext routingContext) { + routingContext.response().setStatusCode(200).end("Success"); + } +} diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000000..ca19f179c233 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list b/test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list new file mode 100644 index 000000000000..3582c97d124d --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/support-version.list @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +3.7.0 +3.6.3 +3.6.2 +3.6.1 +3.6.0 +3.5.4 +3.5.3 +3.5.2 +3.5.1 +3.5.0 +3.4.2 +3.4.1 +3.4.0 +3.3.3 +3.3.2 +3.3.1 +3.3.0 +3.2.1 +3.2.0 +3.1.0 +3.0.0 From cf3665681e1e9fe594529a939a06802dd874117e Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 9 Apr 2020 02:11:59 -0400 Subject: [PATCH 02/13] added license --- .../config/expectedData.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml index c1e51ec35aea..09762b86de34 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml @@ -1,3 +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. registryItems: applications: - {vertx-web-3.x-scenario: 2} From 87d22ab647a08bf2bb45c3951bbeb91376f0dfe2 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 22 Apr 2020 12:10:23 -0400 Subject: [PATCH 03/13] update test for new plugin structure --- .../config/expectedData.yaml | 137 +++++++----------- .../vertx-web-3.x-scenario/configuration.yml | 1 - .../scenarios/vertx-web-3.x-scenario/pom.xml | 91 +++++------- .../apm/testcase/vertxweb/Application.java | 6 - .../controller/VertxCoreController.java | 10 +- 5 files changed, 94 insertions(+), 151 deletions(-) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml index 09762b86de34..7f89f199e2bf 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml @@ -24,85 +24,58 @@ registryItems: "/vertx-web-3-scenario/case/web-case" ] segmentItems: -- applicationCode: vertx-web-3.x-scenario - segmentSize: 3 - segments: - - segmentId: nq 0 - spans: - - operationName: "/vertx-web-3-scenario/case/healthCheck" - operationId: 0 - parentSpanId: 0 - spanId: 1 - spanLayer: Http - tags: - - {key: "http.method", value: "GET"} - - {key: "url", value: "/vertx-web-3-scenario/case/healthCheck"} - startTime: nq 0 - endTime: nq 0 - componentId: 59 - componentName: "" - isError: false - spanType: Exit - peer: not null - peerId: 0 - - operationName: "/vertx-web-3-scenario/case/web-case" - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - tags: - - {key: "http.method", value: "GET"} - - {key: "url", value: "/vertx-web-3-scenario/case/web-case"} - startTime: nq 0 - endTime: nq 0 - componentId: 59 - componentName: "" - isError: false - spanType: Entry - peer: "" - peerId: 0 - - segmentId: nq 0 - spans: - - operationName: "#/vertx-web-3-scenario/case/healthCheck" - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - refs: - - {parentEndpointId: 0, parentEndpoint: "/vertx-web-3-scenario/case/web-case", - networkAddressId: 0, entryEndpointId: 0, refType: CrossThread, parentSpanId: 1, - parentTraceSegmentId: not null, parentServiceInstanceId: 1, networkAddress: "", - entryEndpoint: "/vertx-web-3-scenario/case/web-case", entryServiceInstanceId: 1} - startTime: nq 0 - endTime: nq 0 - componentId: 59 - componentName: "" - isError: false - spanType: Local - peer: "" - peerId: 0 - - segmentId: nq 0 - spans: - - operationName: "/vertx-web-3-scenario/case/healthCheck" - operationId: 0 - parentSpanId: -1 - spanId: 0 - spanLayer: Http - refs: - - {parentEndpointId: 0, parentEndpoint: "/vertx-web-3-scenario/case/web-case", - networkAddressId: 0, entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, - parentTraceSegmentId: not null, parentServiceInstanceId: 1, - networkAddress: "localhost:8080", - entryEndpoint: "/vertx-web-3-scenario/case/web-case", - entryServiceInstanceId: 1} - tags: - - {key: "http.method", value: "GET"} - - {key: "url", value: "/vertx-web-3-scenario/case/healthCheck"} - startTime: nq 0 - endTime: nq 0 - componentId: 59 - componentName: "" - isError: false - spanType: Entry - peer: "" - peerId: 0 + - serviceName: vertx-web-3.x-scenario + segmentSize: 2 + segments: + - segmentId: nq 0 + spans: + - operationName: /vertx-web-3-scenario/case/healthCheck + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Exit + peer: localhost:8080 + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-web-3-scenario/case/healthCheck} + - operationName: /vertx-web-3-scenario/case/web-case + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-web-3-scenario/case/web-case} + - segmentId: nq 0 + spans: + - operationName: '#/vertx-web-3-scenario/case/healthCheck' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Local + peer: '' + skipAnalysis: false + refs: + - {parentEndpoint: /vertx-web-3-scenario/case/web-case, networkAddress: '', + refType: CrossThread, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-web-3.x-scenario, + traceId: not null} + diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml b/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml index 236809d59ed9..4be3c902de14 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/configuration.yml @@ -18,4 +18,3 @@ type: jvm entryService: http://localhost:8080/vertx-web-3-scenario/case/web-case healthCheck: http://localhost:8080/vertx-web-3-scenario/case/healthCheck startScript: ./bin/startup.sh -framework: Vert.x diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml index 93333b9b5f9b..1a54b80417be 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml @@ -19,64 +19,61 @@ - 4.0.0 - org.apache.skywalking + org.apache.skywalking.apm.testcase vertx-web-3.x-scenario - 5.0.0 - skywalking-vertx-web-3.x-scenario + 1.0.0 + jar + + 4.0.0 UTF-8 1.8 - 2.6.2 - 1.5.2.RELEASE - 3.6.3 - 3 + 3.7.0 + 2.1.6.RELEASE + 1.18.10 - - - io.vertx - vertx-web - ${vertx.version} - + skywalking-vertx-web-3.x-scenario - + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot-version} + pom + import + + + + + org.springframework.boot - spring-boot-starter - ${spring-boot-version} - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-logging + + - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} + org.springframework.boot + spring-boot-starter-log4j2 - org.apache.logging.log4j - log4j-jcl - ${log4j.version} + org.projectlombok + lombok + ${lombok.version} + provided - org.springframework.boot - spring-boot-starter-tomcat - ${spring-boot-version} - - - org.springframework.boot - spring-boot-starter-web - ${spring-boot-version} + io.vertx + vertx-web + ${test.framework.version} @@ -86,7 +83,6 @@ org.springframework.boot spring-boot-maven-plugin - 1.5.9.RELEASE @@ -124,15 +120,4 @@ - - - - spring-snapshots - http://repo.spring.io/snapshot - - - spring-milestones - http://repo.spring.io/milestone - - diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java index dadafb0959ec..f4eeffe9a453 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -18,17 +18,11 @@ package org.apache.skywalking.apm.testcase.vertxweb; import io.vertx.core.Vertx; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxCoreController; public class Application { - private static final Logger logger = LogManager.getLogger(Application.class); - public static void main(String[] args) { - logger.info("Application started"); - System.setProperty("vertx.disableFileCPResolving", "true"); Vertx.vertx().deployVerticle(new VertxCoreController(), it -> { if (it.failed()) { diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java index 64445a8b9a76..f48bdacfdf11 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java @@ -20,22 +20,14 @@ import io.vertx.core.AbstractVerticle; import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.springframework.boot.autoconfigure.SpringBootApplication; -@SpringBootApplication public class VertxCoreController extends AbstractVerticle { - private static final Logger logger = LogManager.getLogger(VertxCoreController.class); - @Override public void start() { - logger.info("VertxCoreController started"); - Router router = Router.router(vertx); router.get("/vertx-web-3-scenario/case/web-case").handler(this::handleCoreCase); - router.get("/vertx-web-3-scenario/case/healthCheck").handler(this::healthCheck); + router.head("/vertx-web-3-scenario/case/healthCheck").handler(this::healthCheck); vertx.createHttpServer().requestHandler(router::accept).listen(8080); } From 300499b153a580780c2186d3f00ca2ab65a28582 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Wed, 22 Apr 2020 12:16:17 -0400 Subject: [PATCH 04/13] got rid of registryItems --- .../vertx-web-3.x-scenario/config/expectedData.yaml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml index 7f89f199e2bf..a8be66ceabf3 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml @@ -13,16 +13,6 @@ # 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: - - {vertx-web-3.x-scenario: 2} - instances: - - {vertx-web-3.x-scenario: 1} - operationNames: - - vertx-web-3.x-scenario: [ - "/vertx-web-3-scenario/case/healthCheck", - "/vertx-web-3-scenario/case/web-case" - ] segmentItems: - serviceName: vertx-web-3.x-scenario segmentSize: 2 From 81acb7ffea0850e938b70ed50f4abe063d450131 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 01:28:37 -0400 Subject: [PATCH 05/13] remove unnecessary dependencies --- .../scenarios/vertx-web-3.x-scenario/pom.xml | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml index 1a54b80417be..58d64e9894b6 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml @@ -31,45 +31,11 @@ UTF-8 1.8 3.7.0 - 2.1.6.RELEASE - 1.18.10 skywalking-vertx-web-3.x-scenario - - - - org.springframework.boot - spring-boot-dependencies - ${spring-boot-version} - pom - import - - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-log4j2 - - - org.projectlombok - lombok - ${lombok.version} - provided - io.vertx vertx-web From 2fd69d3095e3ae0e91b49f0c073c42f692659250 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 02:10:58 -0400 Subject: [PATCH 06/13] re-impl eventbus scenario --- .../bin/startup.sh | 21 +++ .../config/expectedData.yaml | 140 ++++++++++++++++++ .../configuration.yml | 20 +++ .../vertx-eventbus-3.x-scenario/pom.xml | 99 +++++++++++++ .../src/main/assembly/assembly.xml | 41 +++++ .../testcase/vertxeventbus/Application.java | 59 ++++++++ .../controller/ClusterReceiver.java | 21 +++ .../controller/LocalReceiver.java | 18 +++ .../controller/VertxEventbusController.java | 94 ++++++++++++ .../vertxeventbus/util/CustomMessage.java | 35 +++++ .../util/CustomMessageCodec.java | 49 ++++++ .../src/main/resources/log4j2.xml | 30 ++++ .../support-version.list | 37 +++++ 13 files changed, 664 insertions(+) create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/configuration.yml create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/pom.xml create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/resources/log4j2.xml create mode 100644 test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/bin/startup.sh b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/bin/startup.sh new file mode 100644 index 000000000000..a737278b5c4d --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/bin/startup.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +home="$(cd "$(dirname $0)"; pwd)" + +java -jar ${agent_opts} ${home}/../libs/vertx-eventbus-3.x-scenario.jar & diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml new file mode 100644 index 000000000000..6b2fcb6537d7 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml @@ -0,0 +1,140 @@ +# 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. +segmentItems: + - serviceName: vertx-eventbus-3.x-scenario + segmentSize: 7 + segments: + - segmentId: not null + spans: + - operationName: local-message-receiver + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: RPCFramework + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Local + peer: '' + skipAnalysis: false + refs: + - {parentEndpoint: local-message-receiver, networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario, + traceId: not null} + - segmentId: not null + spans: + - {operationName: local-message-receiver, operationId: 0, parentSpanId: -1, spanId: 0, + spanLayer: RPCFramework, startTime: nq 0, endTime: nq 0, componentId: 59, + isError: false, spanType: Local, peer: '', skipAnalysis: false} + - segmentId: not null + spans: + - operationName: /vertx-eventbus-3-scenario/case/executeTest + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Exit + peer: localhost:8080 + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-eventbus-3-scenario/case/executeTest} + - operationName: /vertx-eventbus-3-scenario/case/eventbus-case + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-eventbus-3-scenario/case/eventbus-case} + - segmentId: not null + spans: + - operationName: '#/vertx-eventbus-3-scenario/case/executeTest' + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Local + peer: '' + skipAnalysis: false + refs: + - {parentEndpoint: /vertx-eventbus-3-scenario/case/eventbus-case, networkAddress: '', + refType: CrossThread, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario, + traceId: not null} + - segmentId: not null + spans: + - operationName: cluster-message-receiver + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: RPCFramework + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + refs: + - {parentEndpoint: cluster-message-receiver, networkAddress: 'localhost:41615', + refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario, + traceId: not null} + - segmentId: not nullnot null + spans: + - {operationName: cluster-message-receiver, operationId: 0, parentSpanId: -1, + spanId: 0, spanLayer: RPCFramework, startTime: nq 0, endTime: nq 0, + componentId: 59, isError: false, spanType: Exit, peer: 'localhost:41615', skipAnalysis: false} + - segmentId: not null + spans: + - operationName: /vertx-eventbus-3-scenario/case/executeTest + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 59 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: http.method, value: GET} + - {key: url, value: /vertx-eventbus-3-scenario/case/executeTest} + refs: + - {parentEndpoint: /vertx-eventbus-3-scenario/case/eventbus-case, networkAddress: 'localhost:8080', + refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario, + traceId: not null} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/configuration.yml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/configuration.yml new file mode 100644 index 000000000000..995bfa6f3522 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/configuration.yml @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +type: jvm +entryService: http://localhost:8080/vertx-eventbus-3-scenario/case/eventbus-case +healthCheck: http://localhost:8080/vertx-eventbus-3-scenario/case/healthCheck +startScript: ./bin/startup.sh diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/pom.xml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/pom.xml new file mode 100644 index 000000000000..2765e6ab1cb7 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/pom.xml @@ -0,0 +1,99 @@ + + + + + org.apache.skywalking.apm.testcase + vertx-eventbus-3.x-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + 3.7.0 + + + skywalking-vertx-eventbus-3.x-scenario + + + + io.vertx + vertx-core + ${test.framework.version} + + + io.vertx + vertx-web + ${test.framework.version} + + + io.vertx + vertx-hazelcast + ${test.framework.version} + + + + + vertx-eventbus-3.x-scenario + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + 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/ + + + + + + + diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000000..d0220acf0942 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/vertx-eventbus-3.x-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java new file mode 100644 index 000000000000..1295bdbca733 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java @@ -0,0 +1,59 @@ +/* + * 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.vertxeventbus; + +import io.vertx.core.Vertx; +import io.vertx.core.VertxOptions; +import io.vertx.core.spi.cluster.ClusterManager; +import io.vertx.spi.cluster.hazelcast.HazelcastClusterManager; + +import org.apache.skywalking.apm.testcase.vertxeventbus.controller.ClusterReceiver; +import org.apache.skywalking.apm.testcase.vertxeventbus.controller.VertxEventbusController; + +public class Application { + + public static void main(String[] args) { + ClusterManager mgr = new HazelcastClusterManager(); + VertxOptions options = new VertxOptions().setClusterManager(mgr); + Vertx.clusteredVertx(options, cluster -> { + if (cluster.succeeded()) { + cluster.result().deployVerticle(new ClusterReceiver(), deploy -> { + if (deploy.succeeded()) { + ClusterManager mgr2 = new HazelcastClusterManager(); + VertxOptions options2 = new VertxOptions().setClusterManager(mgr2); + Vertx.clusteredVertx(options2, cluster2 -> { + if (cluster2.succeeded()) { + cluster2.result().deployVerticle(new VertxEventbusController()); + } else { + cluster2.cause().printStackTrace(); + System.exit(-1); + } + }); + } else { + deploy.cause().printStackTrace(); + System.exit(-1); + } + }); + } else { + cluster.cause().printStackTrace(); + System.exit(-1); + } + }); + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java new file mode 100644 index 000000000000..e33471d9f715 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java @@ -0,0 +1,21 @@ +package org.apache.skywalking.apm.testcase.vertxeventbus.controller; + +import io.vertx.core.AbstractVerticle; +import io.vertx.core.eventbus.EventBus; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessage; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessageCodec; + +public class ClusterReceiver extends AbstractVerticle { + + @Override + public void start() { + EventBus eventBus = getVertx().eventBus(); + eventBus.registerDefaultCodec(CustomMessage.class, new CustomMessageCodec()); + + eventBus.consumer("cluster-message-receiver", message -> { + CustomMessage replyMessage = new CustomMessage(200, + "a00000002", "Message sent from cluster receiver!"); + message.reply(replyMessage); + }); + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java new file mode 100644 index 000000000000..102bfc1193bd --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java @@ -0,0 +1,18 @@ +package org.apache.skywalking.apm.testcase.vertxeventbus.controller; + +import io.vertx.core.AbstractVerticle; +import io.vertx.core.eventbus.EventBus; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessage; + +public class LocalReceiver extends AbstractVerticle { + + @Override + public void start() { + EventBus eventBus = getVertx().eventBus(); + eventBus.consumer("local-message-receiver", message -> { + CustomMessage replyMessage = new CustomMessage(200, + "a00000002", "Message sent from local receiver!"); + message.reply(replyMessage); + }); + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java new file mode 100644 index 000000000000..be7b53d0e393 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java @@ -0,0 +1,94 @@ +/* + * 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.vertxeventbus.controller; + +import io.vertx.core.AbstractVerticle; +import io.vertx.core.Future; +import io.vertx.core.json.Json; +import io.vertx.ext.web.Router; +import io.vertx.ext.web.RoutingContext; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessage; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessageCodec; + +public class VertxEventbusController extends AbstractVerticle { + + @Override + public void start() { + Router router = Router.router(vertx); + router.get("/vertx-eventbus-3-scenario/case/eventbus-case").handler(this::handleCoreCase); + router.get("/vertx-eventbus-3-scenario/case/executeTest").handler(this::executeTest); + router.head("/vertx-eventbus-3-scenario/case/healthCheck").handler(this::healthCheck); + vertx.createHttpServer().requestHandler(router::accept).listen(8080); + + vertx.eventBus().registerDefaultCodec(CustomMessage.class, new CustomMessageCodec()); + vertx.deployVerticle(LocalReceiver.class.getName()); + } + + private void handleCoreCase(RoutingContext routingContext) { + vertx.createHttpClient().getNow(8080, "localhost", + "/vertx-eventbus-3-scenario/case/executeTest", + it -> routingContext.response().setStatusCode(it.statusCode()).end()); + } + + private void executeTest(RoutingContext routingContext) { + Future localMessageFuture = Future.future(); + CustomMessage localMessage = new CustomMessage(200, + "a0000001", "Local message!"); + vertx.eventBus().send("local-message-receiver", localMessage, reply -> { + if (reply.succeeded()) { + CustomMessage replyMessage = (CustomMessage) reply.result().body(); + System.out.println("Received local reply: " + replyMessage.getSummary()); + localMessageFuture.complete(); + } else { + localMessageFuture.fail(reply.cause()); + } + }); + + Future clusterMessageFuture = Future.future(); + CustomMessage clusterWideMessage = new CustomMessage(200, + "a00000001", "Message sent from publisher!"); + vertx.eventBus().send("cluster-message-receiver", clusterWideMessage, reply -> { + if (reply.succeeded()) { + CustomMessage replyMessage = (CustomMessage) reply.result().body(); + System.out.println("Received reply: " + replyMessage.getSummary()); + clusterMessageFuture.complete(); + } else { + clusterMessageFuture.fail(reply.cause()); + } + }); + + localMessageFuture.setHandler(localHandler -> { + if (localHandler.succeeded()) { + clusterMessageFuture.setHandler(clusterHandler -> { + if (clusterHandler.succeeded()) { + routingContext.response().setStatusCode(200).end(); + } else { + routingContext.response().setStatusCode(500).end(Json.encodePrettily(clusterHandler.cause())); + } + }); + } else { + routingContext.response().setStatusCode(500).end(Json.encodePrettily(localHandler.cause())); + } + }); + } + + private void healthCheck(RoutingContext routingContext) { + routingContext.response().setStatusCode(200).end("Success"); + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java new file mode 100644 index 000000000000..91db968426a3 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java @@ -0,0 +1,35 @@ +package org.apache.skywalking.apm.testcase.vertxeventbus.util; + +public class CustomMessage { + private final int statusCode; + private final String resultCode; + private final String summary; + + public CustomMessage(int statusCode, String resultCode, String summary) { + this.statusCode = statusCode; + this.resultCode = resultCode; + this.summary = summary; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("CustomMessage{"); + sb.append("statusCode=").append(statusCode); + sb.append(", resultCode='").append(resultCode).append('\''); + sb.append(", summary='").append(summary).append('\''); + sb.append('}'); + return sb.toString(); + } + + public int getStatusCode() { + return statusCode; + } + + public String getResultCode() { + return resultCode; + } + + public String getSummary() { + return summary; + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java new file mode 100644 index 000000000000..3273c294127b --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java @@ -0,0 +1,49 @@ +package org.apache.skywalking.apm.testcase.vertxeventbus.util; + +import io.vertx.core.buffer.Buffer; +import io.vertx.core.eventbus.MessageCodec; +import io.vertx.core.json.JsonObject; + +public class CustomMessageCodec implements MessageCodec { + + @Override + public void encodeToWire(Buffer buffer, CustomMessage customMessage) { + JsonObject jsonToEncode = new JsonObject(); + jsonToEncode.put("statusCode", customMessage.getStatusCode()); + jsonToEncode.put("resultCode", customMessage.getResultCode()); + jsonToEncode.put("summary", customMessage.getSummary()); + + String jsonToStr = jsonToEncode.encode(); + int length = jsonToStr.getBytes().length; + buffer.appendInt(length); + buffer.appendString(jsonToStr); + } + + @Override + public CustomMessage decodeFromWire(int position, Buffer buffer) { + int _pos = position; + int length = buffer.getInt(_pos); + String jsonStr = buffer.getString(_pos += 4, _pos += length); + JsonObject contentJson = new JsonObject(jsonStr); + + int statusCode = contentJson.getInteger("statusCode"); + String resultCode = contentJson.getString("resultCode"); + String summary = contentJson.getString("summary"); + return new CustomMessage(statusCode, resultCode, summary); + } + + @Override + public CustomMessage transform(CustomMessage customMessage) { + return customMessage; + } + + @Override + public String name() { + return this.getClass().getSimpleName(); + } + + @Override + public byte systemCodecID() { + return -1; + } +} diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000000..ca19f179c233 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list new file mode 100644 index 000000000000..3582c97d124d --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +3.7.0 +3.6.3 +3.6.2 +3.6.1 +3.6.0 +3.5.4 +3.5.3 +3.5.2 +3.5.1 +3.5.0 +3.4.2 +3.4.1 +3.4.0 +3.3.3 +3.3.2 +3.3.1 +3.3.0 +3.2.1 +3.2.0 +3.1.0 +3.0.0 From 959542d095f18d4e2a5fefd25c4b2f7c35c59adc Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 02:21:35 -0400 Subject: [PATCH 07/13] more precise naming --- .../apache/skywalking/apm/testcase/vertxweb/Application.java | 4 ++-- .../{VertxCoreController.java => VertxWebController.java} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/{VertxCoreController.java => VertxWebController.java} (96%) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java index f4eeffe9a453..9dce7c37ee58 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -18,13 +18,13 @@ package org.apache.skywalking.apm.testcase.vertxweb; import io.vertx.core.Vertx; -import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxCoreController; +import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController; public class Application { public static void main(String[] args) { System.setProperty("vertx.disableFileCPResolving", "true"); - Vertx.vertx().deployVerticle(new VertxCoreController(), it -> { + Vertx.vertx().deployVerticle(new VertxWebController(), it -> { if (it.failed()) { it.cause().printStackTrace(); System.exit(-1); diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java similarity index 96% rename from test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java rename to test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java index f48bdacfdf11..40c70f3734ae 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxCoreController.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java @@ -21,7 +21,7 @@ import io.vertx.ext.web.Router; import io.vertx.ext.web.RoutingContext; -public class VertxCoreController extends AbstractVerticle { +public class VertxWebController extends AbstractVerticle { @Override public void start() { From aa0fd16adeee64c93874e0abde18cde37bd95583 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 02:22:52 -0400 Subject: [PATCH 08/13] fix expected data --- .../vertx-eventbus-3.x-scenario/config/expectedData.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml index 6b2fcb6537d7..27acc2621c86 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/config/expectedData.yaml @@ -107,15 +107,15 @@ segmentItems: peer: '' skipAnalysis: false refs: - - {parentEndpoint: cluster-message-receiver, networkAddress: 'localhost:41615', + - {parentEndpoint: cluster-message-receiver, networkAddress: not null, refType: CrossProcess, parentSpanId: 0, parentTraceSegmentId: not null, parentServiceInstance: not null, parentService: vertx-eventbus-3.x-scenario, traceId: not null} - - segmentId: not nullnot null + - segmentId: not null spans: - {operationName: cluster-message-receiver, operationId: 0, parentSpanId: -1, spanId: 0, spanLayer: RPCFramework, startTime: nq 0, endTime: nq 0, - componentId: 59, isError: false, spanType: Exit, peer: 'localhost:41615', skipAnalysis: false} + componentId: 59, isError: false, spanType: Exit, peer: not null, skipAnalysis: false} - segmentId: not null spans: - operationName: /vertx-eventbus-3-scenario/case/executeTest From db347e961176dc4c36871d38432d14b64352932c Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 02:54:35 -0400 Subject: [PATCH 09/13] removed unsupported versions and removed vertx caching (avoids permission error) --- .../skywalking/apm/testcase/vertxeventbus/Application.java | 1 + .../scenarios/vertx-eventbus-3.x-scenario/support-version.list | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java index 1295bdbca733..867b9077e2d9 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java @@ -29,6 +29,7 @@ public class Application { public static void main(String[] args) { + System.setProperty("vertx.disableFileCPResolving", "true"); ClusterManager mgr = new HazelcastClusterManager(); VertxOptions options = new VertxOptions().setClusterManager(mgr); Vertx.clusteredVertx(options, cluster -> { diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list index 3582c97d124d..8273d93a6101 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list @@ -33,5 +33,3 @@ 3.3.0 3.2.1 3.2.0 -3.1.0 -3.0.0 From 4a877c01739fc119426bc3b097728f3a094ba9ce Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Thu, 23 Apr 2020 03:41:20 -0400 Subject: [PATCH 10/13] rewrote to remove copied code --- .../testcase/vertxeventbus/Application.java | 1 - .../controller/ClusterReceiver.java | 26 +++++++--- .../controller/LocalReceiver.java | 26 +++++++--- .../controller/VertxEventbusController.java | 11 ++--- .../vertxeventbus/util/CustomMessage.java | 48 +++++++++---------- .../util/CustomMessageCodec.java | 43 ++++++++++------- 6 files changed, 90 insertions(+), 65 deletions(-) diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java index 867b9077e2d9..fbfb84c4c948 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/Application.java @@ -15,7 +15,6 @@ * limitations under the License. * */ - package org.apache.skywalking.apm.testcase.vertxeventbus; import io.vertx.core.Vertx; diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java index e33471d9f715..1a2a2a6fc238 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/ClusterReceiver.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ package org.apache.skywalking.apm.testcase.vertxeventbus.controller; import io.vertx.core.AbstractVerticle; @@ -9,13 +26,10 @@ public class ClusterReceiver extends AbstractVerticle { @Override public void start() { - EventBus eventBus = getVertx().eventBus(); + EventBus eventBus = vertx.eventBus(); eventBus.registerDefaultCodec(CustomMessage.class, new CustomMessageCodec()); - eventBus.consumer("cluster-message-receiver", message -> { - CustomMessage replyMessage = new CustomMessage(200, - "a00000002", "Message sent from cluster receiver!"); - message.reply(replyMessage); - }); + eventBus.consumer("cluster-message-receiver", + message -> message.reply(new CustomMessage("cluster-message-receiver reply"))); } } diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java index 102bfc1193bd..561954d54c27 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/LocalReceiver.java @@ -1,18 +1,30 @@ +/* + * 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.vertxeventbus.controller; import io.vertx.core.AbstractVerticle; -import io.vertx.core.eventbus.EventBus; import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessage; public class LocalReceiver extends AbstractVerticle { @Override public void start() { - EventBus eventBus = getVertx().eventBus(); - eventBus.consumer("local-message-receiver", message -> { - CustomMessage replyMessage = new CustomMessage(200, - "a00000002", "Message sent from local receiver!"); - message.reply(replyMessage); - }); + vertx.eventBus().consumer("local-message-receiver", + message -> message.reply(new CustomMessage("local-message-receiver reply"))); } } diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java index be7b53d0e393..7e9981779e98 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/controller/VertxEventbusController.java @@ -15,7 +15,6 @@ * limitations under the License. * */ - package org.apache.skywalking.apm.testcase.vertxeventbus.controller; import io.vertx.core.AbstractVerticle; @@ -48,12 +47,11 @@ private void handleCoreCase(RoutingContext routingContext) { private void executeTest(RoutingContext routingContext) { Future localMessageFuture = Future.future(); - CustomMessage localMessage = new CustomMessage(200, - "a0000001", "Local message!"); + CustomMessage localMessage = new CustomMessage("local-message-receiver request"); vertx.eventBus().send("local-message-receiver", localMessage, reply -> { if (reply.succeeded()) { CustomMessage replyMessage = (CustomMessage) reply.result().body(); - System.out.println("Received local reply: " + replyMessage.getSummary()); + System.out.println("Received local reply: " + replyMessage.getMessage()); localMessageFuture.complete(); } else { localMessageFuture.fail(reply.cause()); @@ -61,12 +59,11 @@ private void executeTest(RoutingContext routingContext) { }); Future clusterMessageFuture = Future.future(); - CustomMessage clusterWideMessage = new CustomMessage(200, - "a00000001", "Message sent from publisher!"); + CustomMessage clusterWideMessage = new CustomMessage("cluster-message-receiver request"); vertx.eventBus().send("cluster-message-receiver", clusterWideMessage, reply -> { if (reply.succeeded()) { CustomMessage replyMessage = (CustomMessage) reply.result().body(); - System.out.println("Received reply: " + replyMessage.getSummary()); + System.out.println("Received cluster reply: " + replyMessage.getMessage()); clusterMessageFuture.complete(); } else { clusterMessageFuture.fail(reply.cause()); diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java index 91db968426a3..df22264c47b3 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessage.java @@ -1,35 +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. + * + */ package org.apache.skywalking.apm.testcase.vertxeventbus.util; public class CustomMessage { - private final int statusCode; - private final String resultCode; - private final String summary; - public CustomMessage(int statusCode, String resultCode, String summary) { - this.statusCode = statusCode; - this.resultCode = resultCode; - this.summary = summary; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("CustomMessage{"); - sb.append("statusCode=").append(statusCode); - sb.append(", resultCode='").append(resultCode).append('\''); - sb.append(", summary='").append(summary).append('\''); - sb.append('}'); - return sb.toString(); - } - - public int getStatusCode() { - return statusCode; - } + private final String message; - public String getResultCode() { - return resultCode; + public CustomMessage(String message) { + this.message = message; } - public String getSummary() { - return summary; + public String getMessage() { + return message; } } diff --git a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java index 3273c294127b..84b3c176732a 100644 --- a/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxeventbus/util/CustomMessageCodec.java @@ -1,35 +1,42 @@ +/* + * 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.vertxeventbus.util; import io.vertx.core.buffer.Buffer; import io.vertx.core.eventbus.MessageCodec; +import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; public class CustomMessageCodec implements MessageCodec { @Override public void encodeToWire(Buffer buffer, CustomMessage customMessage) { - JsonObject jsonToEncode = new JsonObject(); - jsonToEncode.put("statusCode", customMessage.getStatusCode()); - jsonToEncode.put("resultCode", customMessage.getResultCode()); - jsonToEncode.put("summary", customMessage.getSummary()); - - String jsonToStr = jsonToEncode.encode(); - int length = jsonToStr.getBytes().length; + String jsonStr = Json.encode(customMessage); + int length = jsonStr.getBytes().length; buffer.appendInt(length); - buffer.appendString(jsonToStr); + buffer.appendString(jsonStr); } @Override public CustomMessage decodeFromWire(int position, Buffer buffer) { - int _pos = position; - int length = buffer.getInt(_pos); - String jsonStr = buffer.getString(_pos += 4, _pos += length); - JsonObject contentJson = new JsonObject(jsonStr); - - int statusCode = contentJson.getInteger("statusCode"); - String resultCode = contentJson.getString("resultCode"); - String summary = contentJson.getString("summary"); - return new CustomMessage(statusCode, resultCode, summary); + int length = buffer.getInt(position); + JsonObject jsonMessage = new JsonObject(buffer.getString(position += 4, position + length)); + return new CustomMessage(jsonMessage.getString("message")); } @Override @@ -39,7 +46,7 @@ public CustomMessage transform(CustomMessage customMessage) { @Override public String name() { - return this.getClass().getSimpleName(); + return getClass().getSimpleName(); } @Override From 21cebc255e25dfe9e82f59da58ccc6c71f8c5722 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 24 Apr 2020 12:11:24 +0400 Subject: [PATCH 11/13] Update plugins-test.3.yaml --- .github/workflows/plugins-test.3.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/plugins-test.3.yaml b/.github/workflows/plugins-test.3.yaml index f330223de035..dbd4d12bc877 100644 --- a/.github/workflows/plugins-test.3.yaml +++ b/.github/workflows/plugins-test.3.yaml @@ -41,6 +41,8 @@ jobs: - { name: 'spring-4.1.x-scenario', title: 'Spring 4.1.x-4.2.x (20)' } - { name: 'spring-4.3.x-scenario', title: 'Spring 4.3.x-5.2.x (54)' } - { name: 'spring-async-scenario', title: 'Spring Async 4.3.x-5.1.x (35)' } + - { name: 'vertx-eventbus-3.x-scenario', title: 'Vert.x EventBus 3.2.x-3.7.x (19)' } + - { name: 'vertx-web-3.x-scenario', title: 'Vert.x Web 3.0.x-3.7.x (21)' } steps: - uses: actions/checkout@v2 - name: checkout submodules From b4ad628209307c063cd77054fa5e03ab3ee9f422 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 24 Apr 2020 05:44:28 -0400 Subject: [PATCH 12/13] fixes issue of .vertx files remaining on v3.0.0 --- .../apm/testcase/vertxweb/Application.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java index 9dce7c37ee58..aa39f6906e64 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -20,11 +20,24 @@ import io.vertx.core.Vertx; import org.apache.skywalking.apm.testcase.vertxweb.controller.VertxWebController; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; + public class Application { - public static void main(String[] args) { + public static void main(String[] args) throws IOException { + //ensures .vertx files are uncreated/deleted System.setProperty("vertx.disableFileCPResolving", "true"); - Vertx.vertx().deployVerticle(new VertxWebController(), it -> { + Vertx vertx = Vertx.vertx(); + Files.walk(new File(".vertx").toPath()) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + + vertx.deployVerticle(new VertxWebController(), it -> { if (it.failed()) { it.cause().printStackTrace(); System.exit(-1); From b876173ef60dfc37de2c7315a08967c181648a26 Mon Sep 17 00:00:00 2001 From: Brandon Fergerson Date: Fri, 24 Apr 2020 06:12:51 -0400 Subject: [PATCH 13/13] only present in v3.0.0 --- .../skywalking/apm/testcase/vertxweb/Application.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java index aa39f6906e64..71cdfa4e08e2 100644 --- a/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/Application.java @@ -32,10 +32,12 @@ public static void main(String[] args) throws IOException { //ensures .vertx files are uncreated/deleted System.setProperty("vertx.disableFileCPResolving", "true"); Vertx vertx = Vertx.vertx(); - Files.walk(new File(".vertx").toPath()) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); + if (new File(".vertx").exists()) { + Files.walk(new File(".vertx").toPath()) + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } vertx.deployVerticle(new VertxWebController(), it -> { if (it.failed()) {