diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test index cc9093cf4..e3f11f1ba 100755 --- a/Jenkinsfile-Agent-Test +++ b/Jenkinsfile-Agent-Test @@ -66,7 +66,7 @@ pipeline { sh './mvnw -f test/plugin/pom.xml clean package -DskipTests -Dbuild_id=wl1_${BUILD_ID} docker:build' } } - stage('Test Cases Report (162)') { + stage('Test Cases Report (169)') { steps { echo "reserve." } @@ -81,6 +81,11 @@ pipeline { parallel { stage('Group1') { stages { + stage('httpasyncclient 4.0-4.1.3 (7)') { + steps { + sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} httpasyncclient-scenario' + } + } stage('httpclient 4.3.x-4.5.x (14)') { steps { sh 'bash test/plugin/run.sh --build_id=wl1_${BUILD_ID} httpclient-4.3.x-scenario' diff --git a/test/plugin/scenarios/httpasyncclient-scenario/bin/startup.sh b/test/plugin/scenarios/httpasyncclient-scenario/bin/startup.sh new file mode 100644 index 000000000..cf59d44cb --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/bin/startup.sh @@ -0,0 +1,19 @@ +#!/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/httpasyncclient-scenario.jar & diff --git a/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml new file mode 100644 index 000000000..985001db4 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/config/expectedData.yaml @@ -0,0 +1,93 @@ +# 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: + - {httpasyncclient-scenario: nq 0} + instances: + - {httpasyncclient-scenario: 1} + operationNames: + - httpasyncclient-scenario: [/httpasyncclient/case/httpasyncclient, /httpasyncclient/back] +segmentItems: +- applicationCode: httpasyncclient-scenario + segmentSize: ge 4 + segments: + - segmentId: not null + spans: + - operationName: /httpasyncclient/case/httpasyncclient + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: not null + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/httpasyncclient/case/httpasyncclient' } + - {key: http.method, value: GET } + - segmentId: not null + spans: + - operationName: /httpasyncclient/back + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: not null + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://127.0.0.1:8080/httpasyncclient/back' } + - {key: http.method, value: GET } + - segmentId: not null + spans: + - operationName: /httpasyncclient/back + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: not null + componentName: '' + isError: false + spanType: Exit + peer: 127.0.0.1:8080 + peerId: 0 + tags: + - {key: url, value: 'http://127.0.0.1:8080/httpasyncclient/back' } + - {key: http.method, value: GET } + - operationName: httpasyncclient/local + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: not null + startTime: nq 0 + endTime: nq 0 + componentId: 0 + componentName: '' + isError: false + spanType: Local + peer: "" + peerId: 0 diff --git a/test/plugin/scenarios/httpasyncclient-scenario/configuration.yml b/test/plugin/scenarios/httpasyncclient-scenario/configuration.yml new file mode 100644 index 000000000..b6825e4c3 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/configuration.yml @@ -0,0 +1,19 @@ +# 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/httpasyncclient/case/httpasyncclient +healthCheck: http://localhost:8080/httpasyncclient/case/healthcheck +startScript: ./bin/startup.sh +framework: httpasyncclient diff --git a/test/plugin/scenarios/httpasyncclient-scenario/pom.xml b/test/plugin/scenarios/httpasyncclient-scenario/pom.xml new file mode 100644 index 000000000..aecf77547 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/pom.xml @@ -0,0 +1,126 @@ + + + + 4.0.0 + + org.apache.skywalking + httpasyncclient-scenario + 6.5.0 + + + UTF-8 + UTF-8 + 1.8 + 4.1.2 + ${test.framework.version} + 1.5.9.RELEASE + 1.16.20 + 2.8.1 + + + skywalking-httpasyncclient-scenario + + + + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + + spring-boot-starter-logging + org.springframework.boot + + + + + org.springframework.boot + spring-boot-starter-web + ${spring-boot.version} + + + org.apache.httpcomponents + httpasyncclient + ${test.framework.version} + + + org.projectlombok + lombok + ${lombok.version} + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + + + httpasyncclient-scenario + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.0 + + ${compiler.version} + ${compiler.version} + ${project.build.sourceEncoding} + + + + org.springframework.boot + spring-boot-maven-plugin + 1.5.9.RELEASE + + + + repackage + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assemble + package + + single + + + + src/main/assembly/assembly.xml + + + + + + + + diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/httpasyncclient-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..59529c740 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/httpasyncclient-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/BackController.java b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/BackController.java new file mode 100644 index 000000000..318286506 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/BackController.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.testcase.httpasyncclient; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/httpasyncclient") +public class BackController { + @GetMapping("/back") + public String back() { + return "Hello back"; + } +} diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/FrontController.java b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/FrontController.java new file mode 100644 index 000000000..4ed5e48ac --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/FrontController.java @@ -0,0 +1,106 @@ +/* + * 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.testcase.httpasyncclient; + +import java.io.IOException; +import java.nio.CharBuffer; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.concurrent.FutureCallback; +import org.apache.http.impl.nio.client.CloseableHttpAsyncClient; +import org.apache.http.impl.nio.client.HttpAsyncClients; +import org.apache.http.nio.IOControl; +import org.apache.http.nio.client.methods.AsyncCharConsumer; +import org.apache.http.nio.client.methods.HttpAsyncMethods; +import org.apache.http.nio.protocol.HttpAsyncRequestProducer; +import org.apache.http.protocol.HttpContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/httpasyncclient/case") +public class FrontController { + + private static Logger logger = LogManager.getLogger(FrontController.class); + + @GetMapping("/healthcheck") + public String healthcheck() { + return "Success"; + } + + @GetMapping("/httpasyncclient") + public String front() throws Exception { + String content = asyncRequest3("http://127.0.0.1:8080/httpasyncclient/back"); + return content; + } + + public static final String asyncRequest3(String url) throws IOException { + + final CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); + + httpclient.start(); + + final HttpGet request3 = new HttpGet(url); + HttpAsyncRequestProducer producer3 = HttpAsyncMethods.create(request3); + AsyncCharConsumer consumer3 = new AsyncCharConsumer() { + HttpResponse response; + + @Override + protected void onResponseReceived(final HttpResponse response) { + this.response = response; + } + + @Override + protected void onCharReceived(final CharBuffer buf, final IOControl ioctrl) throws IOException { + } + + @Override + protected void releaseResources() { + } + + @Override + protected HttpResponse buildResult(final HttpContext context) { + return this.response; + } + }; + + httpclient.execute(producer3, consumer3, new FutureCallback() { + public void completed(final HttpResponse response3) { + logger.info(request3.getRequestLine() + "->" + response3.getStatusLine()); + try { + httpclient.close(); + } catch (IOException e) { + logger.error("Httpclient close failed" + e); + } + } + + public void failed(final Exception ex) { + logger.error(request3.getRequestLine() + "->" + ex); + } + + public void cancelled() { + logger.error(request3.getRequestLine() + " cancelled"); + } + + }); + return "Success"; + } +} diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/HttpasyncclientApplication.java b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/HttpasyncclientApplication.java new file mode 100644 index 000000000..8d65eedbe --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/java/org/apache/skywalking/testcase/httpasyncclient/HttpasyncclientApplication.java @@ -0,0 +1,32 @@ +/* + * 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.testcase.httpasyncclient; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HttpasyncclientApplication { + + public static void main(String[] args) { + + Object[] sources = new Object[] {HttpasyncclientApplication.class}; + SpringApplication.run(sources, args); + + } +} diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/application.yml b/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/application.yml new file mode 100644 index 000000000..187d66a35 --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/application.yml @@ -0,0 +1,17 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +server: + port: 8080 diff --git a/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/log4j2.xml b/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/log4j2.xml new file mode 100644 index 000000000..985bd03bf --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/src/main/resource/log4j2.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/httpasyncclient-scenario/support-version.list b/test/plugin/scenarios/httpasyncclient-scenario/support-version.list new file mode 100644 index 000000000..974d854ad --- /dev/null +++ b/test/plugin/scenarios/httpasyncclient-scenario/support-version.list @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +4.0 +4.0.1 +4.0.2 +4.1 +4.1.1 +4.1.2 +4.1.3