You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/01/28 18:11:16 UTC
svn commit: r1780726 -
/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java
Author: veithen
Date: Sat Jan 28 18:11:16 2017
New Revision: 1780726
URL: http://svn.apache.org/viewvc?rev=1780726&view=rev
Log:
Make ServiceClient instances created by ClientHelper configurable.
Modified:
axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java
Modified: axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java?rev=1780726&r1=1780725&r2=1780726&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java (original)
+++ axis/axis2/java/core/trunk/modules/testutils/src/main/java/org/apache/axis2/testutils/ClientHelper.java Sat Jan 28 18:11:16 2017
@@ -25,7 +25,7 @@ import org.apache.axis2.context.Configur
import org.apache.axis2.context.ConfigurationContextFactory;
import org.junit.rules.ExternalResource;
-public final class ClientHelper extends ExternalResource {
+public class ClientHelper extends ExternalResource {
private final AbstractAxis2Server server;
private final String repositoryPath;
private ConfigurationContext configurationContext;
@@ -40,25 +40,31 @@ public final class ClientHelper extends
}
@Override
- protected void before() throws Throwable {
+ protected final void before() throws Throwable {
configurationContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(repositoryPath);
}
@Override
- protected void after() {
+ protected final void after() {
configurationContext = null;
}
- public ServiceClient createServiceClient(String serviceName) throws AxisFault {
+ public final ServiceClient createServiceClient(String serviceName) throws Exception {
ServiceClient serviceClient = new ServiceClient(configurationContext, null);
serviceClient.getOptions().setTo(server.getEndpointReference(serviceName));
+ configureServiceClient(serviceClient);
return serviceClient;
}
- public <T extends Stub> T createStub(Class<T> type, String serviceName) throws Exception {
- return type
+ public final <T extends Stub> T createStub(Class<T> type, String serviceName) throws Exception {
+ T stub = type
.getConstructor(ConfigurationContext.class, String.class)
.newInstance(configurationContext, server.getEndpoint(serviceName));
+ configureServiceClient(stub._getServiceClient());
+ return stub;
+ }
+
+ protected void configureServiceClient(ServiceClient serviceClient) throws Exception {
}
}