Skip to content

Commit

Permalink
Convert jaxws tests to java (#12509)
Browse files Browse the repository at this point in the history
Co-authored-by: Jay DeLuca <[email protected]>
  • Loading branch information
laurit and jaydeluca authored Oct 24, 2024
1 parent 1c3a374 commit 3cf37dd
Show file tree
Hide file tree
Showing 39 changed files with 792 additions and 773 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.javaagent.instrumentation.axis2;

import io.opentelemetry.javaagent.instrumentation.jaxws.v2_0.AbstractJaxWs2Test;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

class Axis2JaxWs2Test extends AbstractJaxWs2Test {
static {
try {
updateConfiguration();
} catch (IOException exception) {
throw new IllegalStateException(exception);
}
}

private static void updateConfiguration() throws IOException {
// read default configuration file inside axis2 jar
String configuration =
IOUtils.toString(
Axis2JaxWs2Test.class.getClassLoader().getResourceAsStream("axis2.xml"),
StandardCharsets.UTF_8);

// customize deployer so axis2 can find our services
configuration =
configuration.replace(
"org.apache.axis2.jaxws.framework.JAXWSDeployer", CustomJaxWsDeployer.class.getName());
configuration =
configuration.replace(
"<!--<parameter name=\"servicePath\">services</parameter>-->",
"<parameter name=\"servicePath\">ws</parameter>");
configuration =
configuration.replace(
"<parameter name=\"useGeneratedWSDLinJAXWS\">false</parameter>",
"<parameter name=\"useGeneratedWSDLinJAXWS\">true</parameter>");
configuration = configuration.replace("<module ref=\"addressing\"/>", "");

File configurationDirectory = new File("build/axis-conf/");
configurationDirectory.mkdirs();
FileUtils.writeStringToFile(
new File(configurationDirectory, "axis2.xml"), configuration, StandardCharsets.UTF_8);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

package test;
package io.opentelemetry.javaagent.instrumentation.axis2;

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

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3cf37dd

Please sign in to comment.