Update Readme for JaxWS (#2190)

* Update Readme for JaxWS, add a test case for proxy invocation.

* Added copyright notice, removed test-main.

* Added copyright notice, removed test-main.

* codenarc
This commit is contained in:
Vladimir Šor 2021-02-04 12:59:47 +02:00 committed by GitHub
parent e2d0dd7d4c
commit 3764f63935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 1 deletions

View File

@ -339,6 +339,7 @@ These are the supported libraries and frameworks:
| [Hystrix](https://github.com/Netflix/Hystrix) | 1.4+ |
| [JAX-RS](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/package-summary.html) | 0.5+ |
| [JAX-RS Client](https://javaee.github.io/javaee-spec/javadocs/javax/ws/rs/client/package-summary.html) | 2.0+ |
| [JAX-WS](https://jakarta.ee/specifications/xml-web-services/2.3/apidocs/javax/xml/ws/package-summary.html) | 2.0+ (not including 3.x yet) |
| [JDBC](https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/package-summary.html) | Java 7+ |
| [Jedis](https://github.com/xetorthio/jedis) | 1.4+ |
| [JMS](https://javaee.github.io/javaee-spec/javadocs/javax/jms/package-summary.html) | 1.1+ |

View File

@ -5,7 +5,7 @@ muzzle {
group = "javax.xml.ws"
module = "jaxws-api"
versions = "[2.0,]"
skipVersions += '2.1-1' // contains broken dependency
skipVersions += ['2.1-1', '2.1EA2'] // contain broken dependencies
}
}

View File

@ -6,6 +6,7 @@
package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1
import io.opentelemetry.instrumentation.test.AgentTestRunner
import java.lang.reflect.Proxy
class JwsAnnotationsTest extends AgentTestRunner {
@ -49,4 +50,27 @@ class JwsAnnotationsTest extends AgentTestRunner {
})
}
def "WebService via proxy must have span attributes from actual implementation"() {
when:
WebServiceDefinitionInterface proxy =
Proxy.newProxyInstance(
WebServiceFromInterface.getClassLoader(),
[WebServiceDefinitionInterface] as Class[],
new ProxyInvocationHandler(new WebServiceFromInterface())) as WebServiceDefinitionInterface
proxy.partOfPublicInterface()
then:
proxy.getClass() != WebServiceFromInterface
assertTraces(1, {
trace(0, 1) {
span(0) {
name "WebServiceFromInterface.partOfPublicInterface"
attributes {
attribute('code.function', 'partOfPublicInterface')
attribute('code.namespace', 'io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1.WebServiceFromInterface')
}
}
}
})
}
}

View File

@ -0,0 +1,23 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package io.opentelemetry.javaagent.instrumentation.jaxws.jws.v1_1;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class ProxyInvocationHandler implements InvocationHandler {
WebServiceDefinitionInterface target;
public ProxyInvocationHandler(WebServiceFromInterface webServiceFromInterface) {
target = webServiceFromInterface;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return method.invoke(target, args);
}
}