Skip to content

Commit

Permalink
Update Readme for JaxWS (#2190)
Browse files Browse the repository at this point in the history
* Update Readme for JaxWS, add a test case for proxy invocation.

* Added copyright notice, removed test-main.

* Added copyright notice, removed test-main.

* codenarc
  • Loading branch information
vovencij committed Feb 4, 2021
1 parent e2d0dd7 commit 3764f63
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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')
}
}
}
})
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 3764f63

Please sign in to comment.