Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert jaxws tests to java #12509

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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
Loading