Author: richard_opalka
Date: 2007-07-01 17:20:12 -0400 (Sun, 01 Jul 2007)
New Revision: 3776
Modified:
branches/ropalka/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wsrx/RXTestCase.java
Log:
creating first test scenarios
Modified:
branches/ropalka/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wsrx/RXTestCase.java
===================================================================
---
branches/ropalka/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wsrx/RXTestCase.java 2007-07-01
21:14:33 UTC (rev 3775)
+++
branches/ropalka/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/samples/wsrx/RXTestCase.java 2007-07-01
21:20:12 UTC (rev 3776)
@@ -1,14 +1,21 @@
package org.jboss.test.ws.jaxws.samples.wsrx;
import java.io.File;
+import java.net.URI;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
+import javax.xml.ws.addressing.AddressingBuilder;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.addressing.JAXWSAConstants;
import junit.framework.Test;
+import org.jboss.ws.extensions.addressing.AddressingClientUtil;
+import org.jboss.ws.extensions.rx.Sequence;
+import org.jboss.ws.extensions.rx.RXProvider;
import org.jboss.wsf.spi.test.JBossWSTest;
import org.jboss.wsf.spi.test.JBossWSTestSetup;
@@ -21,8 +28,15 @@
public class RXTestCase extends JBossWSTest
{
private String targetNS = "http://www.jboss.org/wsrx/";
+ private String serviceURL;
private static RXService port;
+
+ private static final AddressingBuilder addressingBuilder;
+
+ static {
+ addressingBuilder = AddressingBuilder.getAddressingBuilder();
+ }
public static Test suite()
{
@@ -38,22 +52,81 @@
Service service = Service.create(wsdlURL, serviceName);
port = service.getPort(RXService.class);
+ serviceURL = "http://"+getServerHost()+":8080/"; // TODO: it
seems that this URL is incorrect - debug it!
((BindingProvider)port).getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- "http://"+getServerHost()+":8080/" // TODO: it seems
that this URL is incorrect - debug it!
+ serviceURL
);
}
}
- public void testOneWay() throws Exception {
- System.out.println("FIXME: write RX one way usecase test");
- //port.oneWay("Hello world!");
+ public void testScenario1_anonymousOneWay() throws Exception {
+ System.out.println("FIXME: make this usecase to work");
+ if (true) return;
+
+ Sequence sequence = RXProvider.newSequence(port);
+ sequence.create(); // create new sequence - only one sequence can exist at time on
one stub
+ port.oneWay("first");
+ port.oneWay("second");
+ sequence.lastMessage();
+ sequence.requestAck();
+ port.oneWay("third");
+ while(!sequence.acknowledged()) {
+ System.out.println("doing something else");
+ }
+ sequence.terminate();
}
- public void testReqResp() throws Exception {
- System.out.println("FIXME: write RX req resp usecase test");
- //System.out.println(port.reqResp("Hello world!"));
+ public void testScenario2_notAnonymousOneWay() throws Exception {
+ System.out.println("FIXME: make this usecase to work");
+ if (true) return;
+
+ Sequence sequence = RXProvider.newSequence(port);
+ sequence.create(); // create new sequence - only one sequence can exist at time on
one stub
+ String soapAction = "http://www.jboss.org/wsrx/action/oneWay";
+ String replyTo = "http://localhost:8080/wsa10/replyTo";
+ setAddressingProperties(soapAction, replyTo);
+ port.oneWay("first");
+ setAddressingProperties(soapAction, replyTo);
+ port.oneWay("second");
+ sequence.lastMessage();
+ sequence.requestAck();
+ setAddressingProperties(soapAction, replyTo);
+ port.oneWay("third");
+ while(!sequence.acknowledged()) {
+ System.out.println("doing something else");
+ }
+ sequence.terminate();
}
+
+ private void setAddressingProperties(String soapAction, String replyTo) {
+ AddressingProperties requestProps =
+ AddressingClientUtil.createDefaultProps(soapAction, serviceURL);
+ requestProps.setMessageID(AddressingClientUtil.createMessageID());
+ requestProps.setReplyTo(addressingBuilder.newEndpointReference(new URI(replyTo)));
+ setRequestProperties((BindingProvider)port, requestProps);
+ }
+
+ public void testScenario3_requestResponse() throws Exception {
+ System.out.println("FIXME: make this usecase to work");
+ if (true) return;
+
+ Sequence sequence = RXProvider.newSequence(port);
+ sequence.create(); // create new sequence - only one sequence can exist at time on
one stub
+ System.out.println(port.reqResp("first"));
+ System.out.println(port.reqResp("second"));
+ sequence.lastMessage();
+ sequence.requestAck();
+ System.out.println(port.reqResp("third"));
+ while(!sequence.acknowledged()) {
+ System.out.println("doing something else");
+ }
+ sequence.terminate();
+ }
+ private void setRequestProperties(BindingProvider bp, AddressingProperties props) {
+ bp.getRequestContext().put(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND,
props);
+ }
+
}
Show replies by date