From 5f8ee254a4191edc44408471d9f665c018728499 Mon Sep 17 00:00:00 2001 From: aderm <394102339@qq.com> Date: Fri, 15 Nov 2019 00:11:43 +0800 Subject: [PATCH] [test/plugin] immigrate test feign scenario. (#3838) * immigrate test feign scenario. * add license. * update use test skeleton. * delete repeat spring-boot starter dependence. * add support-list version. --- Jenkinsfile-Agent-Test | 8 +- docs/en/guides/Plugin-test.md | 3 +- .../scenarios/feign-scenario/bin/startup.sh | 21 ++ .../feign-scenario/config/expectedData.yaml | 202 ++++++++++++++++++ .../feign-scenario/configuration.yml | 23 ++ test/plugin/scenarios/feign-scenario/pom.xml | 141 ++++++++++++ .../src/main/assembly/assembly.xml | 41 ++++ .../apm/testcase/feign/Application.java | 34 +++ .../feign/controller/CaseController.java | 51 +++++ .../feign/controller/RestController.java | 77 +++++++ .../feign/controller/RestRequest.java | 57 +++++ .../apm/testcase/feign/entity/User.java | 53 +++++ .../src/main/resources/application.yaml | 23 ++ .../src/main/resources/log4j2.xml | 30 +++ .../feign-scenario/support-version.list | 23 ++ 15 files changed, 785 insertions(+), 2 deletions(-) create mode 100644 test/plugin/scenarios/feign-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/feign-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/feign-scenario/configuration.yml create mode 100644 test/plugin/scenarios/feign-scenario/pom.xml create mode 100644 test/plugin/scenarios/feign-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java create mode 100644 test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/CaseController.java create mode 100644 test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestController.java create mode 100644 test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java create mode 100644 test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/entity/User.java create mode 100644 test/plugin/scenarios/feign-scenario/src/main/resources/application.yaml create mode 100644 test/plugin/scenarios/feign-scenario/src/main/resources/log4j2.xml create mode 100644 test/plugin/scenarios/feign-scenario/support-version.list diff --git a/Jenkinsfile-Agent-Test b/Jenkinsfile-Agent-Test index adebc0bc94..dae1d1b424 100755 --- a/Jenkinsfile-Agent-Test +++ b/Jenkinsfile-Agent-Test @@ -68,7 +68,7 @@ pipeline { } } - stage('Test Cases Report (136)') { + stage('Test Cases Report (144)') { steps { echo "Test Cases Report" } @@ -105,6 +105,12 @@ pipeline { stage('Group2') { stages { + stage('feign 9.0.0-9.5.1 (8)') { + steps { + sh 'bash test/plugin/run.sh feign-scenario' + } + } + stage('customize (1)') { steps { sh 'bash test/plugin/run.sh customize-scenario' diff --git a/docs/en/guides/Plugin-test.md b/docs/en/guides/Plugin-test.md index 80a47382e9..169f6ff9a8 100644 --- a/docs/en/guides/Plugin-test.md +++ b/docs/en/guides/Plugin-test.md @@ -619,9 +619,10 @@ apm-toolkit-trace | 1 | 87.00 jetty 9.x | 63 | 2043.00 netty-socketio 1.x | 4 | 117.00 -#### Group 2 (2119.991s) +#### Group 2 (2291.98s) scenario name | versions | elapsed time (sec) ---|---|--- +feign 9.0.0-9.5.1 | 8 | 172.00 customize | 1 | 85.64 postgresql 9.4.1207+ | 62 | 1820.29 canal 1.0.24-1.1.2 | 5 | 214.05 diff --git a/test/plugin/scenarios/feign-scenario/bin/startup.sh b/test/plugin/scenarios/feign-scenario/bin/startup.sh new file mode 100644 index 0000000000..671bec9f37 --- /dev/null +++ b/test/plugin/scenarios/feign-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/feign-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/feign-scenario/config/expectedData.yaml b/test/plugin/scenarios/feign-scenario/config/expectedData.yaml new file mode 100644 index 0000000000..570b9c4498 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/config/expectedData.yaml @@ -0,0 +1,202 @@ +# 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: + - {feign-scenario: nq 0} + instances: + - {feign-scenario: 1} + operationNames: + - feign-scenario: [/feign-scenario/update/1, /feign-scenario/get/1, /feign-scenario/create/, + /feign-scenario/case/feign-scenario, /feign-scenario/delete/1] + heartbeat: [] +segmentItems: +- applicationCode: feign-scenario + segmentSize: ge 1 + segments: + - segmentId: not null + spans: + - operationName: /feign-scenario/create/ + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/feign-scenario/create/'} + - {key: http.method, value: POST} + refs: + - {parentEndpointId: 0, parentEndpoint: /feign-scenario/case/feign-scenario, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: "${feign-scenario[4]}", + parentServiceInstanceId: nq 0, networkAddress: 'localhost:8080', entryEndpoint: /feign-scenario/case/feign-scenario, + entryServiceInstanceId: nq 0} + - segmentId: not null + spans: + - operationName: /feign-scenario/get/1 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/feign-scenario/get/1'} + - {key: http.method, value: GET} + refs: + - {parentEndpointId: 0, parentEndpoint: /feign-scenario/case/feign-scenario, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 2, parentTraceSegmentId: "${feign-scenario[4]}", + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /feign-scenario/case/feign-scenario, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /feign-scenario/update/1 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/feign-scenario/update/1'} + - {key: http.method, value: PUT} + refs: + - {parentEndpointId: 0, parentEndpoint: /feign-scenario/case/feign-scenario, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 3, parentTraceSegmentId: "${feign-scenario[4]}", + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /feign-scenario/case/feign-scenario, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /feign-scenario/delete/1 + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/feign-scenario/delete/1'} + - {key: http.method, value: DELETE} + refs: + - {parentEndpointId: 0, parentEndpoint: /feign-scenario/case/feign-scenario, networkAddressId: 0, + entryEndpointId: 0, refType: CrossProcess, parentSpanId: 4, parentTraceSegmentId: "${feign-scenario[4]}", + parentServiceInstanceId: 1, networkAddress: 'localhost:8080', entryEndpoint: /feign-scenario/case/feign-scenario, + entryServiceInstanceId: 1} + - segmentId: not null + spans: + - operationName: /feign-scenario/create/ + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 11 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: POST} + - {key: url, value: 'http://localhost:8080/feign-scenario/create/'} + - operationName: /feign-scenario/get/1 + operationId: 0 + parentSpanId: 0 + spanId: 2 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 11 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: GET} + - {key: url, value: 'http://localhost:8080/feign-scenario/get/1'} + - operationName: /feign-scenario/update/1 + operationId: 0 + parentSpanId: 0 + spanId: 3 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 11 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: PUT} + - {key: url, value: 'http://localhost:8080/feign-scenario/update/1'} + - operationName: /feign-scenario/delete/1 + operationId: 0 + parentSpanId: 0 + spanId: 4 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 11 + componentName: '' + isError: false + spanType: Exit + peer: localhost:8080 + peerId: 0 + tags: + - {key: http.method, value: DELETE} + - {key: url, value: 'http://localhost:8080/feign-scenario/delete/1'} + - operationName: /feign-scenario/case/feign-scenario + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + componentName: '' + isError: false + spanType: Entry + peer: '' + peerId: 0 + tags: + - {key: url, value: 'http://localhost:8080/feign-scenario/case/feign-scenario'} + - {key: http.method, value: GET} diff --git a/test/plugin/scenarios/feign-scenario/configuration.yml b/test/plugin/scenarios/feign-scenario/configuration.yml new file mode 100644 index 0000000000..0cfc4f6eef --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/configuration.yml @@ -0,0 +1,23 @@ +# 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/feign-scenario/case/feign-scenario +healthCheck: http://localhost:8080/feign-scenario/case/healthCheck +startScript: ./bin/startup.sh +framework: feign-scenario +environment: +dependencies: \ No newline at end of file diff --git a/test/plugin/scenarios/feign-scenario/pom.xml b/test/plugin/scenarios/feign-scenario/pom.xml new file mode 100644 index 0000000000..3a53ebd3b4 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/pom.xml @@ -0,0 +1,141 @@ + + + + + org.apache.skywalking.apm.testcase + feign-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + + 9.0.0 + 2.1.6.RELEASE + 2.6.2 + + + skywalking-feign-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 + + + jul-to-slf4j + org.slf4j + + + + + io.github.openfeign + feign-core + ${test.framework.version} + + + io.github.openfeign + feign-gson + ${test.framework.version} + + + com.google.code.gson + gson + + + + + com.google.code.gson + gson + ${gson.version} + + + + + feign-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/ + + + + + + + diff --git a/test/plugin/scenarios/feign-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/feign-scenario/src/main/assembly/assembly.xml new file mode 100644 index 0000000000..b47d121d91 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/feign-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java new file mode 100644 index 0000000000..db457d25b6 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/Application.java @@ -0,0 +1,34 @@ +/* + * 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.feign; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + + public static void main(String[] args) { + try { + SpringApplication.run(Application.class, args); + } catch (Exception e) { + // Never do this + } + } +} diff --git a/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/CaseController.java b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/CaseController.java new file mode 100644 index 0000000000..fe30ff962b --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/CaseController.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.feign.controller; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.skywalking.apm.testcase.feign.entity.User; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@RequestMapping("/case") +public class CaseController { + + private Logger logger = LogManager.getLogger(CaseController.class); + + @ResponseBody + @RequestMapping("/healthCheck") + public String healthcheck() { + return "Success"; + } + + @ResponseBody + @RequestMapping("/feign-scenario") + public String feignCase() { + RestRequest request = RestRequest.connect(); + request.createUser(1, "test"); + User user = request.getById(1); + logger.info("find Id{} user. User name is {} ", user.getId(), user.getUserName()); + request.updateUser(1, "testA"); + request.deleteUser(1); + return "success"; + } +} diff --git a/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestController.java b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestController.java new file mode 100644 index 0000000000..f3bdcb060c --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestController.java @@ -0,0 +1,77 @@ +/* + * 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.feign.controller; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import org.apache.skywalking.apm.testcase.feign.entity.User; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.util.UriComponentsBuilder; + +@Controller +public class RestController { + + private static final Map users = new ConcurrentHashMap<>(); + + @GetMapping(value = "/get/{id}") + @ResponseBody + private ResponseEntity getUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = users.get(id); + return ResponseEntity.ok(currentUser); + } + + @PostMapping(value = "/create/") + @ResponseBody + public ResponseEntity createUser(@RequestBody User user, + UriComponentsBuilder ucBuilder) throws InterruptedException { + users.put(user.getId(), user); + HttpHeaders headers = new HttpHeaders(); + headers.setLocation(ucBuilder.path("/user/{id}").buildAndExpand(user.getId()).toUri()); + return new ResponseEntity(headers, HttpStatus.CREATED); + } + + @PutMapping(value = "/update/{id}") + @ResponseBody + public ResponseEntity updateUser(@PathVariable("id") int id, + @RequestBody User user) throws InterruptedException { + User currentUser = new User(id, user.getUserName()); + return ResponseEntity.ok(currentUser); + } + + @DeleteMapping(value = "/delete/{id}") + @ResponseBody + public ResponseEntity deleteUser(@PathVariable("id") int id) throws InterruptedException { + User currentUser = users.get(id); + if (currentUser == null) { + return ResponseEntity.noContent().build(); + } + users.remove(id); + return ResponseEntity.noContent().build(); + } +} diff --git a/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java new file mode 100644 index 0000000000..918c7394b4 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/controller/RestRequest.java @@ -0,0 +1,57 @@ +/* + * 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.feign.controller; + +import feign.Body; +import feign.Feign; +import feign.Headers; +import feign.Logger; +import feign.Param; +import feign.RequestLine; +import feign.codec.Decoder; +import feign.gson.GsonDecoder; +import org.apache.skywalking.apm.testcase.feign.entity.User; + +public interface RestRequest { + + @RequestLine("GET /get/{id}") + User getById(@Param("id") int id); + + @RequestLine("POST /create/") + @Headers("Content-Type: application/json") + @Body("%7B\"id\": \"{id}\", \"userName\": \"{userName}\"%7D") + void createUser(@Param("id") int id, @Param("userName") String userName); + + @RequestLine("PUT /update/{id}") + @Headers("Content-Type: application/json") + @Body("%7B\"id\": \"{id}\", \"userName\": \"{userName}\"%7D") + User updateUser(@Param("id") int id, @Param("userName") String userName); + + @RequestLine("DELETE /delete/{id}") + void deleteUser(@Param("id") int id); + + static RestRequest connect() { + Decoder decoder = new GsonDecoder(); + return Feign.builder() + .decoder(decoder) + .logger(new Logger.ErrorLogger()) + .logLevel(Logger.Level.BASIC) + .target(RestRequest.class, "http://localhost:8080/feign-scenario"); + } +} diff --git a/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/entity/User.java b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/entity/User.java new file mode 100644 index 0000000000..37d40a402c --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/java/org/apache/skywalking/apm/testcase/feign/entity/User.java @@ -0,0 +1,53 @@ +/* + * 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.feign.entity; + +public class User { + + private int id; + private String userName; + + public User(int id) { + this.id = id; + } + + public User(int id, String userName) { + this.id = id; + this.userName = userName; + } + + public User() { + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } +} diff --git a/test/plugin/scenarios/feign-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/feign-scenario/src/main/resources/application.yaml new file mode 100644 index 0000000000..64bbba79e7 --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/resources/application.yaml @@ -0,0 +1,23 @@ +# +# 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 + servlet: + context-path: /feign-scenario +logging: + config: classpath:log4j2.xml diff --git a/test/plugin/scenarios/feign-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/feign-scenario/src/main/resources/log4j2.xml new file mode 100644 index 0000000000..9849ed5a8a --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/feign-scenario/support-version.list b/test/plugin/scenarios/feign-scenario/support-version.list new file mode 100644 index 0000000000..c86b5c7c7a --- /dev/null +++ b/test/plugin/scenarios/feign-scenario/support-version.list @@ -0,0 +1,23 @@ +# 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. +9.0.0 +9.1.0 +9.2.0 +9.3.0 +9.3.1 +9.4.0 +9.5.0 +9.5.1 -- GitLab