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 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..27acc2621c86 --- /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: not null, + refType: CrossProcess, parentSpanId: 0, 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: Exit, peer: not null, 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..fbfb84c4c948 --- /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) { + System.setProperty("vertx.disableFileCPResolving", "true"); + 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..1a2a2a6fc238 --- /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,35 @@ +/* + * 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; +import org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessageCodec; + +public class ClusterReceiver extends AbstractVerticle { + + @Override + public void start() { + EventBus eventBus = vertx.eventBus(); + eventBus.registerDefaultCodec(CustomMessage.class, new CustomMessageCodec()); + + 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 new file mode 100644 index 000000000000..561954d54c27 --- /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,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 org.apache.skywalking.apm.testcase.vertxeventbus.util.CustomMessage; + +public class LocalReceiver extends AbstractVerticle { + + @Override + public void start() { + 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 new file mode 100644 index 000000000000..7e9981779e98 --- /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,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +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("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.getMessage()); + localMessageFuture.complete(); + } else { + localMessageFuture.fail(reply.cause()); + } + }); + + Future clusterMessageFuture = Future.future(); + 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 cluster reply: " + replyMessage.getMessage()); + 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..df22264c47b3 --- /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,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 String message; + + public CustomMessage(String message) { + this.message = message; + } + + 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 new file mode 100644 index 000000000000..84b3c176732a --- /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,56 @@ +/* + * 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) { + String jsonStr = Json.encode(customMessage); + int length = jsonStr.getBytes().length; + buffer.appendInt(length); + buffer.appendString(jsonStr); + } + + @Override + public CustomMessage decodeFromWire(int position, Buffer buffer) { + int length = buffer.getInt(position); + JsonObject jsonMessage = new JsonObject(buffer.getString(position += 4, position + length)); + return new CustomMessage(jsonMessage.getString("message")); + } + + @Override + public CustomMessage transform(CustomMessage customMessage) { + return customMessage; + } + + @Override + public String name() { + return 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..8273d93a6101 --- /dev/null +++ b/test/plugin/scenarios/vertx-eventbus-3.x-scenario/support-version.list @@ -0,0 +1,35 @@ +# 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 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..a8be66ceabf3 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/config/expectedData.yaml @@ -0,0 +1,71 @@ +# 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-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 new file mode 100644 index 000000000000..4be3c902de14 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-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-web-3-scenario/case/web-case +healthCheck: http://localhost:8080/vertx-web-3-scenario/case/healthCheck +startScript: ./bin/startup.sh 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..58d64e9894b6 --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/pom.xml @@ -0,0 +1,89 @@ + + + + + org.apache.skywalking.apm.testcase + vertx-web-3.x-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + 3.7.0 + + + skywalking-vertx-web-3.x-scenario + + + + io.vertx + vertx-web + ${test.framework.version} + + + + + vertx-web-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-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..71cdfa4e08e2 --- /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,49 @@ +/* + * 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.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) throws IOException { + //ensures .vertx files are uncreated/deleted + System.setProperty("vertx.disableFileCPResolving", "true"); + Vertx vertx = Vertx.vertx(); + 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()) { + 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/VertxWebController.java b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java new file mode 100644 index 000000000000..40c70f3734ae --- /dev/null +++ b/test/plugin/scenarios/vertx-web-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/vertxweb/controller/VertxWebController.java @@ -0,0 +1,43 @@ +/* + * 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; + +public class VertxWebController extends AbstractVerticle { + + @Override + public void start() { + Router router = Router.router(vertx); + router.get("/vertx-web-3-scenario/case/web-case").handler(this::handleCoreCase); + router.head("/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