From 6e0a244482e880200660638cb48ec13fdeccfd29 Mon Sep 17 00:00:00 2001 From: zifeihan Date: Thu, 26 Nov 2020 17:18:55 +0800 Subject: [PATCH] Add the plugin for Apache CXF 3.x (#5887) --- .github/workflows/plugins-test.2.yaml | 1 + CHANGES.md | 1 + .../trace/component/ComponentsDefine.java | 2 + .../apm-sdk-plugin/cxf-3.x-plugin/pom.xml | 53 ++++++++ .../MessageSenderInterceptorInterceptor.java | 105 +++++++++++++++ ...ssageSenderInterceptorInstrumentation.java | 74 +++++++++++ .../AsyncInvokeConstructorInterceptor.java | 36 +++++ .../server/AsyncInvokeMethodInterceptor.java | 72 ++++++++++ ...viceInvokerInterceptorInstrumentation.java | 93 +++++++++++++ .../src/main/resources/skywalking-plugin.def | 18 +++ apm-sniffer/apm-sdk-plugin/pom.xml | 1 + .../service-agent/java-agent/Plugin-list.md | 3 +- .../java-agent/Supported-list.md | 1 + .../main/resources/component-libraries.yml | 3 + .../scenarios/cxf-scenario/bin/startup.sh | 21 +++ .../cxf-scenario/config/expectedData.yaml | 90 +++++++++++++ .../scenarios/cxf-scenario/configuration.yml | 22 +++ test/plugin/scenarios/cxf-scenario/pom.xml | 125 ++++++++++++++++++ .../src/main/assembly/assembly.xml | 41 ++++++ .../apm/testcase/cxf/Application.java | 37 ++++++ .../apm/testcase/cxf/CxfConfig.java | 67 ++++++++++ .../cxf/controller/CaseController.java | 54 ++++++++ .../apm/testcase/cxf/entity/User.java | 62 +++++++++ .../apm/testcase/cxf/service/UserService.java | 34 +++++ .../testcase/cxf/service/UserServiceImpl.java | 49 +++++++ .../src/main/resources/application.yaml | 23 ++++ .../src/main/resources/log4j2.xml | 30 +++++ .../cxf-scenario/support-version.list | 21 +++ 28 files changed, 1138 insertions(+), 1 deletion(-) create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/pom.xml create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/MessageSenderInterceptorInterceptor.java create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/define/MessageSenderInterceptorInstrumentation.java create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeConstructorInterceptor.java create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeMethodInterceptor.java create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/define/ServiceInvokerInterceptorInstrumentation.java create mode 100644 apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/resources/skywalking-plugin.def create mode 100644 test/plugin/scenarios/cxf-scenario/bin/startup.sh create mode 100644 test/plugin/scenarios/cxf-scenario/config/expectedData.yaml create mode 100644 test/plugin/scenarios/cxf-scenario/configuration.yml create mode 100644 test/plugin/scenarios/cxf-scenario/pom.xml create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/assembly/assembly.xml create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/Application.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/CxfConfig.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/controller/CaseController.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/entity/User.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserService.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserServiceImpl.java create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/resources/application.yaml create mode 100644 test/plugin/scenarios/cxf-scenario/src/main/resources/log4j2.xml create mode 100644 test/plugin/scenarios/cxf-scenario/support-version.list diff --git a/.github/workflows/plugins-test.2.yaml b/.github/workflows/plugins-test.2.yaml index 71c13eec9..3d7595e21 100644 --- a/.github/workflows/plugins-test.2.yaml +++ b/.github/workflows/plugins-test.2.yaml @@ -66,6 +66,7 @@ jobs: - spring-tx-scenario - struts2.3-scenario - struts2.5-scenario + - cxf-scenario steps: - uses: actions/checkout@v2 with: diff --git a/CHANGES.md b/CHANGES.md index e7da55d0a..426240143 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Release Notes. * Add the plugin for mssql-jdbc 6.x -> 9.x. * Fix the default ignore mechanism isn't accurate enough bug. * Add the plugin for spring-kafka 1.3.x. +* Add the plugin for Apache CXF 3.x. #### OAP-Backend * Add the `@SuperDataset` annotation for BrowserErrorLog. diff --git a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java index acdd5a8d2..e719b6918 100755 --- a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java +++ b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java @@ -190,4 +190,6 @@ public class ComponentsDefine { public static final OfficialComponent DBCP = new OfficialComponent(103, "dbcp"); public static final OfficialComponent MSSQL_JDBC_DRIVER = new OfficialComponent(104, "mssql-jdbc-driver"); + + public static final OfficialComponent APACHE_CXF = new OfficialComponent(105, "Apache-CXF"); } diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/pom.xml new file mode 100644 index 000000000..c725cbcf0 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/pom.xml @@ -0,0 +1,53 @@ + + + + + apm-sdk-plugin + org.apache.skywalking + 8.3.0-SNAPSHOT + + 4.0.0 + + apm-cxf-3.x-plugin + jar + + cxf-3.x-plugin + http://maven.apache.org + + + UTF-8 + 3.1.9 + + + + + org.apache.cxf + cxf-rt-frontend-jaxws + ${cxf.version} + provided + + + org.apache.cxf + cxf-rt-transports-http + ${cxf.version} + provided + + + + \ No newline at end of file diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/MessageSenderInterceptorInterceptor.java b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/MessageSenderInterceptorInterceptor.java new file mode 100644 index 000000000..ae8bddfc0 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/MessageSenderInterceptorInterceptor.java @@ -0,0 +1,105 @@ +/* + * 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.plugin.cxf.v3.client; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.apache.cxf.message.Message; +import org.apache.cxf.service.model.MessageInfo; +import org.apache.cxf.transport.http.Address; +import org.apache.skywalking.apm.agent.core.context.CarrierItem; +import org.apache.skywalking.apm.agent.core.context.ContextCarrier; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.context.tag.Tags; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; + +/** + * Used to intercept client requests and transparently transmit trace header and other information + */ +public class MessageSenderInterceptorInterceptor implements InstanceMethodsAroundInterceptor { + @Override + public void beforeMethod(final EnhancedInstance objInst, + final Method method, + final Object[] allArguments, + final Class[] argumentsTypes, + final MethodInterceptResult result) throws Throwable { + Message message = (Message) allArguments[0]; + final String httpRequestMethod = (String) message.get(Message.HTTP_REQUEST_METHOD); + final MessageInfo messageInfo = (MessageInfo) message.get("org.apache.cxf.service.model.MessageInfo"); + final Address address = (Address) message.get("http.connection.address"); + + if (null == httpRequestMethod || null == messageInfo || null == address) { + return; + } + final String operationName = generateOperationName(messageInfo, address); + AbstractSpan span = ContextManager.createExitSpan(operationName, address.getURI().getAuthority()); + + ContextCarrier contextCarrier = new ContextCarrier(); + ContextManager.inject(contextCarrier); + span.setComponent(ComponentsDefine.APACHE_CXF); + Tags.HTTP.METHOD.set(span, httpRequestMethod); + Tags.URL.set(span, generateRequestURL(messageInfo, address)); + SpanLayer.asRPCFramework(span); + + //Set trace headers. + Map protocolHeaders = (Map) message.get(Message.PROTOCOL_HEADERS); + + CarrierItem next = contextCarrier.items(); + while (next.hasNext()) { + next = next.next(); + List headerList = new ArrayList<>(1); + headerList.add(next.getHeadValue()); + protocolHeaders.put(next.getHeadKey(), headerList); + } + } + + private String generateOperationName(MessageInfo messageInfo, Address address) { + return address.getURI().getPath() + "/" + messageInfo.getOperation().getInputName(); + } + + private String generateRequestURL(MessageInfo messageInfo, Address address) { + return address.getString() + "/" + messageInfo.getOperation().getInputName(); + } + + @Override + public Object afterMethod(final EnhancedInstance objInst, + final Method method, + final Object[] allArguments, + final Class[] argumentsTypes, + final Object ret) throws Throwable { + ContextManager.stopSpan(); + return ret; + } + + @Override + public void handleMethodException(final EnhancedInstance objInst, + final Method method, + final Object[] allArguments, + final Class[] argumentsTypes, + final Throwable t) { + ContextManager.activeSpan().log(t); + } +} diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/define/MessageSenderInterceptorInstrumentation.java b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/define/MessageSenderInterceptorInstrumentation.java new file mode 100644 index 000000000..adcf6b47b --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/client/define/MessageSenderInterceptorInstrumentation.java @@ -0,0 +1,74 @@ +/* + * 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.plugin.cxf.v3.client.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.named; +import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +public class MessageSenderInterceptorInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + /** + * Enhance class. + */ + private static final String ENHANCE_CLASS = "org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor"; + + /** + * Intercept class. + */ + private static final String METHODS_INTERCEPT_CLASS = "org.apache.skywalking.apm.plugin.cxf.v3.client.MessageSenderInterceptorInterceptor"; + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[0]; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("handleMessage"); + } + + @Override + public String getMethodsInterceptor() { + return METHODS_INTERCEPT_CLASS; + } + + @Override + public boolean isOverrideArgs() { + return false; + } + } + }; + } +} diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeConstructorInterceptor.java b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeConstructorInterceptor.java new file mode 100644 index 000000000..b0960469d --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeConstructorInterceptor.java @@ -0,0 +1,36 @@ +/* + * 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.plugin.cxf.v3.server; + +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceConstructorInterceptor; + +/** + * Capture a snapshot for cross-thread propagation. + */ +public class AsyncInvokeConstructorInterceptor implements InstanceConstructorInterceptor { + + @Override + public void onConstruct(final EnhancedInstance objInst, final Object[] allArguments) { + if (ContextManager.isActive()) { + objInst.setSkyWalkingDynamicField(ContextManager.capture()); + } + } +} diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeMethodInterceptor.java b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeMethodInterceptor.java new file mode 100644 index 000000000..1a020c4d9 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/AsyncInvokeMethodInterceptor.java @@ -0,0 +1,72 @@ +/* + * 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.plugin.cxf.v3.server; + +import java.lang.reflect.Method; +import org.apache.skywalking.apm.agent.core.context.ContextManager; +import org.apache.skywalking.apm.agent.core.context.ContextSnapshot; +import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan; +import org.apache.skywalking.apm.agent.core.context.trace.SpanLayer; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult; +import org.apache.skywalking.apm.network.trace.component.ComponentsDefine; + +/** + * Create a new span and associate the existing link. + */ +public class AsyncInvokeMethodInterceptor implements InstanceMethodsAroundInterceptor { + + @Override + public void beforeMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments, + final Class[] argumentsTypes, final MethodInterceptResult result) { + + AbstractSpan span = ContextManager.createLocalSpan("/CXF/AsyncInvoke"); + span.setComponent(ComponentsDefine.APACHE_CXF); + SpanLayer.asRPCFramework(span); + + final Object storedField = objInst.getSkyWalkingDynamicField(); + if (storedField != null) { + final ContextSnapshot contextSnapshot = (ContextSnapshot) storedField; + ContextManager.continued(contextSnapshot); + } + + } + + @Override + public Object afterMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments, + final Class[] argumentsTypes, final Object ret) { + + final Object storedField = objInst.getSkyWalkingDynamicField(); + if (storedField != null) { + ContextManager.stopSpan(); + } + + return ret; + } + + @Override + public void handleMethodException(final EnhancedInstance objInst, final Method method, final Object[] allArguments, + final Class[] argumentsTypes, final Throwable t) { + + if (ContextManager.isActive()) { + ContextManager.activeSpan().log(t); + } + } +} diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/define/ServiceInvokerInterceptorInstrumentation.java b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/define/ServiceInvokerInterceptorInstrumentation.java new file mode 100644 index 000000000..bc1f2aceb --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/cxf/v3/server/define/ServiceInvokerInterceptorInstrumentation.java @@ -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. + * + */ + +package org.apache.skywalking.apm.plugin.cxf.v3.server.define; + +import net.bytebuddy.description.method.MethodDescription; +import net.bytebuddy.matcher.ElementMatcher; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint; +import org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine; +import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch; + +import static net.bytebuddy.matcher.ElementMatchers.any; +import static net.bytebuddy.matcher.ElementMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArguments; +import static org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName; + +public class ServiceInvokerInterceptorInstrumentation extends ClassInstanceMethodsEnhancePluginDefine { + + /** + * Enhance class. + */ + private static final String ENHANCE_CLASS = "org.apache.cxf.interceptor.ServiceInvokerInterceptor$1"; + + /** + * Constructor intercept class. + */ + private static final String CONSTRUCTOR_INTERCEPTOR = "org.apache.skywalking.apm.plugin.cxf.v3.server.AsyncInvokeConstructorInterceptor"; + + /** + * method intercept class. + */ + private static final String METHOD_INTERCEPTOR = "org.apache.skywalking.apm.plugin.cxf.v3.server.AsyncInvokeMethodInterceptor"; + + @Override + protected ClassMatch enhanceClass() { + return byName(ENHANCE_CLASS); + } + + @Override + public ConstructorInterceptPoint[] getConstructorsInterceptPoints() { + return new ConstructorInterceptPoint[] { + new ConstructorInterceptPoint() { + @Override + public ElementMatcher getConstructorMatcher() { + return any(); + } + + @Override + public String getConstructorInterceptor() { + return CONSTRUCTOR_INTERCEPTOR; + } + } + }; + } + + @Override + public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() { + return new InstanceMethodsInterceptPoint[] { + new InstanceMethodsInterceptPoint() { + @Override + public ElementMatcher getMethodsMatcher() { + return named("run").and(takesArguments(0)); + } + + @Override + public String getMethodsInterceptor() { + return METHOD_INTERCEPTOR; + } + + @Override + public boolean isOverrideArgs() { + return false; + } + } + }; + } +} diff --git a/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/resources/skywalking-plugin.def b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/resources/skywalking-plugin.def new file mode 100644 index 000000000..b90a326b4 --- /dev/null +++ b/apm-sniffer/apm-sdk-plugin/cxf-3.x-plugin/src/main/resources/skywalking-plugin.def @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +apache-cxf-3.x=org.apache.skywalking.apm.plugin.cxf.v3.client.define.MessageSenderInterceptorInstrumentation +apache-cxf-3.x=org.apache.skywalking.apm.plugin.cxf.v3.server.define.ServiceInvokerInterceptorInstrumentation \ No newline at end of file diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml b/apm-sniffer/apm-sdk-plugin/pom.xml index 898d02d6b..042f25573 100644 --- a/apm-sniffer/apm-sdk-plugin/pom.xml +++ b/apm-sniffer/apm-sdk-plugin/pom.xml @@ -106,6 +106,7 @@ dbcp-2.x-plugin mssql-jtds-1.x-plugin mssql-jdbc-plugin + cxf-3.x-plugin pom diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md b/docs/en/setup/service-agent/java-agent/Plugin-list.md index 5702dcf4e..04feebf87 100644 --- a/docs/en/setup/service-agent/java-agent/Plugin-list.md +++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md @@ -111,4 +111,5 @@ - xxl-job-2.x - zookeeper-3.4.x - mssql-jtds-1.x -- mssql-jdbc \ No newline at end of file +- mssql-jdbc +- apache-cxf-3.x \ No newline at end of file diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md b/docs/en/setup/service-agent/java-agent/Supported-list.md index e9a2386ae..a6a3f38d1 100644 --- a/docs/en/setup/service-agent/java-agent/Supported-list.md +++ b/docs/en/setup/service-agent/java-agent/Supported-list.md @@ -54,6 +54,7 @@ metrics based on the tracing data. * [Finagle](https://github.com/twitter/finagle) 6.44.0 -> 20.1.0 (6.25.0 -> 6.44.0 not tested) * [Brpc-Java](https://github.com/baidu/brpc-java) 2.3.7 -> 2.5.3 * [Thrift](https://github.com/apache/thrift/tree/master/lib/java) 0.10.0 -> 0.12.0 + * [Apache CXF](https://github.com/apache/cxf) 3.x * MQ * [RocketMQ](https://github.com/apache/rocketmq) 4.x * [Kafka](http://kafka.apache.org) 0.11.0.0 -> 1.0 diff --git a/oap-server/server-bootstrap/src/main/resources/component-libraries.yml b/oap-server/server-bootstrap/src/main/resources/component-libraries.yml index 206cb8970..872c86573 100755 --- a/oap-server/server-bootstrap/src/main/resources/component-libraries.yml +++ b/oap-server/server-bootstrap/src/main/resources/component-libraries.yml @@ -344,6 +344,9 @@ dbcp: mssql-jdbc-driver: id: 104 languages: Java +Apache-CXF: + id: 105 + languages: Java # .NET/.NET Core components # [3000, 4000) for C#/.NET only diff --git a/test/plugin/scenarios/cxf-scenario/bin/startup.sh b/test/plugin/scenarios/cxf-scenario/bin/startup.sh new file mode 100644 index 000000000..6eb95d81f --- /dev/null +++ b/test/plugin/scenarios/cxf-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/cxf-scenario.jar & \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/config/expectedData.yaml b/test/plugin/scenarios/cxf-scenario/config/expectedData.yaml new file mode 100644 index 000000000..e196ba19f --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/config/expectedData.yaml @@ -0,0 +1,90 @@ +# 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: cxf-scenario + segmentSize: ge 4 + segments: + - segmentId: not null + spans: + - operationName: /cxf-scenario/soap/user + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: url, value: 'http://localhost:8080/cxf-scenario/soap/user'} + - {key: http.method, value: POST} + refs: + - {parentEndpoint: /cxf-scenario/case/cxf-scenario, networkAddress: 'localhost:8080', + refType: CrossProcess, parentSpanId: 1, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: cxf-scenario, traceId: not null} + - segmentId: not null + spans: + - operationName: /CXF/AsyncInvoke + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: RPCFramework + startTime: nq 0 + endTime: nq 0 + componentId: 105 + isError: false + spanType: Local + peer: '' + skipAnalysis: 'false' + refs: + - {parentEndpoint: /cxf-scenario/soap/user, networkAddress: '', refType: CrossThread, + parentSpanId: 0, parentTraceSegmentId: not null, + parentServiceInstance: not null, parentService: cxf-scenario, traceId: not null} + - segmentId: not null + spans: + - operationName: /cxf-scenario/soap/user/getUser + operationId: 0 + parentSpanId: 0 + spanId: 1 + spanLayer: RPCFramework + startTime: nq 0 + endTime: nq 0 + componentId: 105 + isError: false + spanType: Exit + peer: localhost:8080 + skipAnalysis: false + tags: + - {key: http.method, value: POST} + - {key: url, value: 'http://localhost:8080/cxf-scenario/soap/user/getUser'} + - operationName: /cxf-scenario/case/cxf-scenario + operationId: 0 + parentSpanId: -1 + spanId: 0 + spanLayer: Http + startTime: nq 0 + endTime: nq 0 + componentId: 1 + isError: false + spanType: Entry + peer: '' + skipAnalysis: false + tags: + - {key: url, value: 'http://localhost:8080/cxf-scenario/case/cxf-scenario'} + - {key: http.method, value: GET} \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/configuration.yml b/test/plugin/scenarios/cxf-scenario/configuration.yml new file mode 100644 index 000000000..067eb0fe3 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/configuration.yml @@ -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. + +type: jvm +entryService: http://localhost:8080/cxf-scenario/case/cxf-scenario +healthCheck: http://localhost:8080/cxf-scenario/case/healthCheck +startScript: ./bin/startup.sh +environment: +dependencies: \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/pom.xml b/test/plugin/scenarios/cxf-scenario/pom.xml new file mode 100644 index 000000000..29565144e --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/pom.xml @@ -0,0 +1,125 @@ + + + + + org.apache.skywalking.apm.testcase + cxf-scenario + 1.0.0 + jar + + 4.0.0 + + + UTF-8 + 1.8 + + 3.1.9 + ${test.framework.version} + + 2.1.6.RELEASE + + + skywalking-cxf-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.apache.cxf + cxf-rt-frontend-jaxws + ${test.framework.version} + + + org.apache.cxf + cxf-rt-transports-http + ${test.framework.version} + + + + + cxf-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/ + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/src/main/assembly/assembly.xml b/test/plugin/scenarios/cxf-scenario/src/main/assembly/assembly.xml new file mode 100644 index 000000000..6f712382f --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/assembly/assembly.xml @@ -0,0 +1,41 @@ + + + + + zip + + + + + ./bin + 0775 + + + + + + ${project.build.directory}/cxf-scenario.jar + ./libs + 0775 + + + diff --git a/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/Application.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/Application.java new file mode 100644 index 000000000..287654b82 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/Application.java @@ -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 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.cxf; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.bind.annotation.RestController; + +@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/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/CxfConfig.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/CxfConfig.java new file mode 100644 index 000000000..f54fb60fb --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/CxfConfig.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.apache.skywalking.apm.testcase.cxf; + +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.Executor; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import javax.xml.ws.Endpoint; +import org.apache.cxf.Bus; +import org.apache.cxf.bus.spring.SpringBus; +import org.apache.cxf.jaxws.EndpointImpl; +import org.apache.cxf.transport.servlet.CXFServlet; +import org.apache.skywalking.apm.testcase.cxf.service.UserService; +import org.apache.skywalking.apm.testcase.cxf.service.UserServiceImpl; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.Ordered; + +@Configuration +public class CxfConfig { + + private final Executor executor = new ThreadPoolExecutor(2, 2, 60, TimeUnit.SECONDS, new ArrayBlockingQueue(100)); + + @Bean + public ServletRegistrationBean servletRegistrationBean() { + ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/soap/*"); + bean.setLoadOnStartup(1); + bean.setOrder(Ordered.LOWEST_PRECEDENCE); + return bean; + } + + @Bean(name = Bus.DEFAULT_BUS_ID) + public SpringBus springBus() { + return new SpringBus(); + } + + @Bean + public UserService userService() { + return new UserServiceImpl(); + } + + @Bean + public Endpoint endpoint() { + EndpointImpl endpoint = new EndpointImpl(springBus(), userService()); + endpoint.setExecutor(executor); + endpoint.publish("/user"); + return endpoint; + } +} diff --git a/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/controller/CaseController.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/controller/CaseController.java new file mode 100644 index 000000000..6a7c6f679 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/controller/CaseController.java @@ -0,0 +1,54 @@ +/* + * 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.cxf.controller; + +import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/case") +public class CaseController { + + private static final Logger LOGGER = LoggerFactory.getLogger(CaseController.class); + + @ResponseBody + @RequestMapping("/healthCheck") + public String healthCheck() { + return "Success"; + } + + @ResponseBody + @RequestMapping("/cxf-scenario") + public String cxfCase() { + try { + JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); + org.apache.cxf.endpoint.Client client = dcf.createClient( + "http://localhost:8080/cxf-scenario/soap/user?wsdl"); + Object[] objects = client.invoke("getUser", 1L); + LOGGER.info(objects[0].toString()); + } catch (Exception e) { + LOGGER.error("", e); + } + return "success"; + } +} diff --git a/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/entity/User.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/entity/User.java new file mode 100644 index 000000000..f9ba063e6 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/entity/User.java @@ -0,0 +1,62 @@ +/* + * 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.cxf.entity; + +import java.io.Serializable; +import java.util.Date; + +public class User implements Serializable { + private static final long serialVersionUID = -5939599230753662529L; + private Long userId; + private String username; + private Date gmtCreate; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public Date getGmtCreate() { + return gmtCreate; + } + + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + @Override + public String toString() { + return "User{" + + "userId=" + userId + + ", username='" + username + '\'' + + ", gmtCreate=" + gmtCreate + + '}'; + } +} diff --git a/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserService.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserService.java new file mode 100644 index 000000000..d077bc52c --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserService.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.cxf.service; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import org.apache.skywalking.apm.testcase.cxf.entity.User; + +@WebService +public interface UserService { + + @WebMethod + String getName(@WebParam(name = "userId") Long userId); + + @WebMethod + User getUser(Long userId); +} diff --git a/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserServiceImpl.java b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserServiceImpl.java new file mode 100644 index 000000000..7c186d495 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/java/org/apache/skywalking/apm/testcase/cxf/service/UserServiceImpl.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.cxf.service; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import javax.jws.WebService; +import org.apache.skywalking.apm.testcase.cxf.entity.User; + +@WebService +public class UserServiceImpl implements UserService { + private Map userMap = new HashMap(); + + public UserServiceImpl() { + User user = new User(); + user.setUserId(1L); + user.setUsername("skywalking"); + user.setGmtCreate(new Date()); + userMap.put(user.getUserId(), user); + } + + @Override + public String getName(Long userId) { + return "hello" + userId; + } + + @Override + public User getUser(Long userId) { + return userMap.get(userId); + } + +} diff --git a/test/plugin/scenarios/cxf-scenario/src/main/resources/application.yaml b/test/plugin/scenarios/cxf-scenario/src/main/resources/application.yaml new file mode 100644 index 000000000..6070bf4f3 --- /dev/null +++ b/test/plugin/scenarios/cxf-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: /cxf-scenario +logging: + config: classpath:log4j2.xml \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/src/main/resources/log4j2.xml b/test/plugin/scenarios/cxf-scenario/src/main/resources/log4j2.xml new file mode 100644 index 000000000..9849ed5a8 --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/src/main/resources/log4j2.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plugin/scenarios/cxf-scenario/support-version.list b/test/plugin/scenarios/cxf-scenario/support-version.list new file mode 100644 index 000000000..1d93afafb --- /dev/null +++ b/test/plugin/scenarios/cxf-scenario/support-version.list @@ -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 +# "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.0.9 +3.1.9 +3.2.7 +3.3.5 +3.4.1 \ No newline at end of file