Skip to content

Commit 3cf37dd

Browse files
lauritjaydeluca
andauthored
Convert jaxws tests to java (#12509)
Co-authored-by: Jay DeLuca <[email protected]>
1 parent 1c3a374 commit 3cf37dd

File tree

39 files changed

+792
-773
lines changed

39 files changed

+792
-773
lines changed

instrumentation/jaxws/jaxws-2.0-axis2-1.6/javaagent/src/test/groovy/Axis2JaxWsTest.groovy

-27
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.javaagent.instrumentation.axis2;
7+
8+
import io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.AbstractJaxWs2Test;
9+
import java.io.File;
10+
import java.io.IOException;
11+
import java.nio.charset.StandardCharsets;
12+
import org.apache.commons.io.FileUtils;
13+
import org.apache.commons.io.IOUtils;
14+
15+
class Axis2JaxWs2Test extends AbstractJaxWs2Test {
16+
static {
17+
try {
18+
updateConfiguration();
19+
} catch (IOException exception) {
20+
throw new IllegalStateException(exception);
21+
}
22+
}
23+
24+
private static void updateConfiguration() throws IOException {
25+
// read default configuration file inside axis2 jar
26+
String configuration =
27+
IOUtils.toString(
28+
Axis2JaxWs2Test.class.getClassLoader().getResourceAsStream("axis2.xml"),
29+
StandardCharsets.UTF_8);
30+
31+
// customize deployer so axis2 can find our services
32+
configuration =
33+
configuration.replace(
34+
"org.apache.axis2.jaxws.framework.JAXWSDeployer", CustomJaxWsDeployer.class.getName());
35+
configuration =
36+
configuration.replace(
37+
"<!--<parameter name=\"servicePath\">services</parameter>-->",
38+
"<parameter name=\"servicePath\">ws</parameter>");
39+
configuration =
40+
configuration.replace(
41+
"<parameter name=\"useGeneratedWSDLinJAXWS\">false</parameter>",
42+
"<parameter name=\"useGeneratedWSDLinJAXWS\">true</parameter>");
43+
configuration = configuration.replace("<module ref=\"addressing\"/>", "");
44+
45+
File configurationDirectory = new File("build/axis-conf/");
46+
configurationDirectory.mkdirs();
47+
FileUtils.writeStringToFile(
48+
new File(configurationDirectory, "axis2.xml"), configuration, StandardCharsets.UTF_8);
49+
}
50+
}

instrumentation/jaxws/jaxws-2.0-axis2-1.6/javaagent/src/test/java/test/CustomJaxWsDeployer.java instrumentation/jaxws/jaxws-2.0-axis2-1.6/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/axis2/CustomJaxWsDeployer.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
package test;
6+
package io.opentelemetry.javaagent.instrumentation.axis2;
77

8+
import io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.hello.HelloService;
9+
import io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.hello.HelloServiceImpl;
810
import java.io.File;
911
import java.util.ArrayList;
1012
import java.util.Arrays;
@@ -17,6 +19,7 @@ public class CustomJaxWsDeployer extends JAXWSDeployer {
1719
@SuppressWarnings("NonApiType") // errorprone bug that it doesn't recognize this is an override
1820
protected ArrayList<String> getClassesInWebInfDirectory(File file) {
1921
// help axis find our webservice classes
20-
return new ArrayList<>(Arrays.asList("hello.HelloService", "hello.HelloServiceImpl"));
22+
return new ArrayList<>(
23+
Arrays.asList(HelloService.class.getName(), HelloServiceImpl.class.getName()));
2124
}
2225
}

instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/AbstractJaxWsTest.groovy

-207
This file was deleted.

instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/hello/BaseHelloService.groovy

-16
This file was deleted.

instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/hello/HelloService.groovy

-24
This file was deleted.

instrumentation/jaxws/jaxws-2.0-common-testing/src/main/groovy/hello/HelloServiceImpl.groovy

-19
This file was deleted.

0 commit comments

Comments
 (0)