Author: richard.opalka(a)jboss.com
Date: 2008-04-10 05:19:02 -0400 (Thu, 10 Apr 2008)
New Revision: 6316
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/Helper.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractSecuredOneWayTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAddressableOneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAnonymousOneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAddressableOneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAnonymousOneWayTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractSecuredReqResTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAddressableReqResTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAnonymousReqResTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAddressableReqResTestCase.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAnonymousReqResTestCase.java
Log:
[JBWS-2097] refactoring - using reflection for jboss specific client configuration
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/Helper.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/Helper.java 2008-04-10
08:59:04 UTC (rev 6315)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/Helper.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -21,18 +21,16 @@
*/
package org.jboss.test.ws.jaxws.wsrm;
+import java.lang.reflect.Method;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.addressing.AddressingProperties;
import javax.xml.ws.addressing.JAXWSAConstants;
-
import org.jboss.ws.extensions.addressing.AddressingClientUtil;
/**
- * Test helper
+ * WS-RM Tests helper
*
* @author richard.opalka(a)jboss.com
- *
- * @since Oct 29, 2007
*/
public final class Helper
{
@@ -42,11 +40,29 @@
// no instances
}
+ /**
+ * Setup addressing SOAP headers for specified proxy
+ * @param proxy
+ * @param wsaAction
+ * @param serviceURL
+ */
public static void setAddrProps(Object proxy, String wsaAction, String serviceURL)
{
BindingProvider bp = (BindingProvider)proxy;
AddressingProperties props = AddressingClientUtil.createAnonymousProps(wsaAction,
serviceURL);
bp.getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
props);
}
-
+
+ /**
+ * Invokes method using java reflection api
+ * @throws Exception if some reflection related problem occurs
+ */
+ public static Object invokeMethodUsingReflection(String ifaceName, Object object,
String methodName, Class<?>[] parametersSignature, Object[] parameters)
+ throws Exception
+ {
+ Object castedObject = Class.forName(ifaceName).cast(object);
+ Method castedObjectMethod = castedObject.getClass().getMethod(methodName,
parametersSignature);
+ return castedObjectMethod.invoke(castedObject, parameters);
+ }
+
}
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractOneWayTest.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -21,15 +21,12 @@
*/
package org.jboss.test.ws.jaxws.wsrm.oneway;
-import static org.jboss.test.ws.jaxws.wsrm.Helper.*;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.invokeMethodUsingReflection;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.setAddrProps;
import java.net.URL;
-
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.extensions.wsrm.api.RMProvider;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.test.ws.jaxws.wsrm.services.OneWayServiceIface;
@@ -37,8 +34,6 @@
* Reliable JBoss WebService client invoking one way methods
*
* @author richard.opalka(a)jboss.com
- *
- * @since Aug 22, 2007
*/
public abstract class RMAbstractOneWayTest extends JBossWSTest
{
@@ -54,7 +49,16 @@
URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
proxy = (OneWayServiceIface)service.getPort(OneWayServiceIface.class);
- ((StubExt)proxy).setConfigName(getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml");
+ if (isIntegrationNative())
+ {
+ // set up client config to be used - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.core.StubExt",
+ proxy, "setConfigName",
+ new Class[] { String.class, String.class },
+ new Object[] {getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml"}
+ );
+ }
}
public void testOneWayMethods() throws Exception
@@ -65,7 +69,16 @@
proxy.method2("Hello World");
setAddrProps(proxy, "http://useless/action3", serviceURL);
proxy.method3(new String[] {"Hello","World"});
- ((RMProvider)proxy).closeSequence(); // this is optional operation
+ if (isIntegrationNative())
+ {
+ // force close sequence - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.extensions.wsrm.api.RMProvider",
+ proxy, "closeSequence",
+ new Class[] {},
+ new Object[] {}
+ );
+ }
}
public static String getClasspath()
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractSecuredOneWayTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractSecuredOneWayTest.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAbstractSecuredOneWayTest.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -21,24 +21,19 @@
*/
package org.jboss.test.ws.jaxws.wsrm.oneway;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.invokeMethodUsingReflection;
import static org.jboss.test.ws.jaxws.wsrm.Helper.setAddrProps;
import java.net.URL;
-
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
-
import org.jboss.test.ws.jaxws.wsrm.services.SecuredOneWayServiceIface;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.extensions.wsrm.api.RMProvider;
import org.jboss.wsf.test.JBossWSTest;
/**
* Secure Reliable JBoss WebService client invoking one way methods
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public abstract class RMAbstractSecuredOneWayTest extends JBossWSTest
{
@@ -54,7 +49,16 @@
URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
proxy =
(SecuredOneWayServiceIface)service.getPort(SecuredOneWayServiceIface.class);
- ((StubExt)proxy).setConfigName(getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml");
+ if (isIntegrationNative())
+ {
+ // set up client config to be used - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.core.StubExt",
+ proxy, "setConfigName",
+ new Class[] { String.class, String.class },
+ new Object[] {getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml"}
+ );
+ }
}
public void testOneWayMethods() throws Exception
@@ -65,7 +69,16 @@
proxy.method2("Hello World");
setAddrProps(proxy, "http://useless/action3", serviceURL);
proxy.method3(new String[] {"Hello","World"});
- ((RMProvider)proxy).closeSequence(); // this is optional operation
+ if (isIntegrationNative())
+ {
+ // force close sequence - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.extensions.wsrm.api.RMProvider",
+ proxy, "closeSequence",
+ new Class[] {},
+ new Object[] {}
+ );
+ }
}
public static String getClasspath()
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAddressableOneWayTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAddressableOneWayTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAddressableOneWayTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.oneway;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Addressable version of one way WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Nov 28, 2007
*/
public final class RMAddressableOneWayTestCase extends RMAbstractOneWayTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAnonymousOneWayTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAnonymousOneWayTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMAnonymousOneWayTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.oneway;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Anonymous version of one way WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Nov 28, 2007
*/
public final class RMAnonymousOneWayTestCase extends RMAbstractOneWayTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAddressableOneWayTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAddressableOneWayTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAddressableOneWayTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.oneway;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Secured addressable version of one way WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public class RMSecuredAddressableOneWayTestCase extends RMAbstractSecuredOneWayTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAnonymousOneWayTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAnonymousOneWayTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/oneway/RMSecuredAnonymousOneWayTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.oneway;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Secured anonymous version of one way WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public class RMSecuredAnonymousOneWayTestCase extends RMAbstractSecuredOneWayTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractReqResTest.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -21,7 +21,8 @@
*/
package org.jboss.test.ws.jaxws.wsrm.reqres;
-import static org.jboss.test.ws.jaxws.wsrm.Helper.*;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.invokeMethodUsingReflection;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.setAddrProps;
import java.net.URL;
import java.util.concurrent.Executor;
@@ -29,24 +30,17 @@
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
-
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.test.ws.jaxws.wsrm.services.ReqResServiceIface;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.extensions.wsrm.api.RMProvider;
-
/**
* Reliable JBoss WebService client invoking req/res methods
*
* @author richard.opalka(a)jboss.com
- *
- * @since Aug 22, 2007
*/
public abstract class RMAbstractReqResTest extends JBossWSTest
{
@@ -78,10 +72,19 @@
Service service = Service.create(wsdlURL, serviceName);
service.setExecutor(testExecutor);
proxy = (ReqResServiceIface)service.getPort(ReqResServiceIface.class);
- ((StubExt)proxy).setConfigName(getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml");
+ if (isIntegrationNative())
+ {
+ // set up client config to be used - uses jbossws specific API via
reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.core.StubExt",
+ proxy, "setConfigName",
+ new Class[] { String.class, String.class },
+ new Object[] {getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml"}
+ );
+ }
}
}
-
+
public void testSynchronousInvocation() throws Exception
{
doReliableMessageExchange(proxy, InvocationType.SYNC);
@@ -157,7 +160,16 @@
invokeWebServiceMethod(invocationType);
setAddrProps(proxy, "http://useless/action", serviceURL);
invokeWebServiceMethod(invocationType);
- ((RMProvider)proxyObject).closeSequence(); // this is optional operation
+ if (isIntegrationNative())
+ {
+ // force close sequence - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.extensions.wsrm.api.RMProvider",
+ proxyObject, "closeSequence",
+ new Class[] {},
+ new Object[] {}
+ );
+ }
}
public static String getClasspath()
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractSecuredReqResTest.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractSecuredReqResTest.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAbstractSecuredReqResTest.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.ws.jaxws.wsrm.reqres;
+import static org.jboss.test.ws.jaxws.wsrm.Helper.invokeMethodUsingReflection;
import static org.jboss.test.ws.jaxws.wsrm.Helper.setAddrProps;
import java.net.URL;
@@ -29,23 +30,17 @@
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-
import javax.xml.namespace.QName;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Response;
import javax.xml.ws.Service;
-
import org.jboss.test.ws.jaxws.wsrm.services.SecuredReqResServiceIface;
-import org.jboss.ws.core.StubExt;
-import org.jboss.ws.extensions.wsrm.api.RMProvider;
import org.jboss.wsf.test.JBossWSTest;
/**
* Secured reliable JBoss WebService client invoking req/res methods
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public abstract class RMAbstractSecuredReqResTest extends JBossWSTest
{
@@ -77,7 +72,16 @@
Service service = Service.create(wsdlURL, serviceName);
service.setExecutor(testExecutor);
proxy =
(SecuredReqResServiceIface)service.getPort(SecuredReqResServiceIface.class);
- ((StubExt)proxy).setConfigName(getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml");
+ if (isIntegrationNative())
+ {
+ // set up client config to be used - uses jbossws specific API via
reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.core.StubExt",
+ proxy, "setConfigName",
+ new Class[] { String.class, String.class },
+ new Object[] {getConfigName(),
"META-INF/wsrm-jaxws-client-config.xml"}
+ );
+ }
}
}
@@ -156,7 +160,16 @@
invokeWebServiceMethod(invocationType);
setAddrProps(proxy, "http://useless/action", serviceURL);
invokeWebServiceMethod(invocationType);
- ((RMProvider)proxyObject).closeSequence(); // this is optional operation
+ if (isIntegrationNative())
+ {
+ // force close sequence - uses jbossws specific API via reflection
+ invokeMethodUsingReflection(
+ "org.jboss.ws.extensions.wsrm.api.RMProvider",
+ proxyObject, "closeSequence",
+ new Class[] {},
+ new Object[] {}
+ );
+ }
}
public static String getClasspath()
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAddressableReqResTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAddressableReqResTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAddressableReqResTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.reqres;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Addressable version of request reply WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Nov 28, 2007
*/
public final class RMAddressableReqResTestCase extends RMAbstractReqResTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAnonymousReqResTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAnonymousReqResTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMAnonymousReqResTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.reqres;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Anonymous version of request reply WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Nov 28, 2007
*/
public final class RMAnonymousReqResTestCase extends RMAbstractReqResTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAddressableReqResTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAddressableReqResTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAddressableReqResTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.reqres;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Secured addressable version of request reply WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public class RMSecuredAddressableReqResTestCase extends RMAbstractSecuredReqResTest
{
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAnonymousReqResTestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAnonymousReqResTestCase.java 2008-04-10
08:59:04 UTC (rev 6315)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/wsrm/reqres/RMSecuredAnonymousReqResTestCase.java 2008-04-10
09:19:02 UTC (rev 6316)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.wsrm.reqres;
import junit.framework.Test;
-
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* Secured anonymous version of request reply WS-RM message exchange
*
* @author richard.opalka(a)jboss.com
- *
- * @since Dec 17, 2007
*/
public class RMSecuredAnonymousReqResTestCase extends RMAbstractSecuredReqResTest
{