[jbossws-commits] JBossWS SVN: r6813 - in stack/native/trunk/src/test: resources/jaxws/samples/dar/WEB-INF/wsdl and 1 other directory.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Apr 30 13:49:41 EDT 2008


Author: alessio.soldano at jboss.com
Date: 2008-04-30 13:49:41 -0400 (Wed, 30 Apr 2008)
New Revision: 6813

Modified:
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClient.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java
   stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/Client.java
   stack/native/trunk/src/test/resources/jaxws/samples/dar/WEB-INF/wsdl/reply.wsdl
Log:
[JBWS-2030] Adding two test cases


Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClient.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClient.java	2008-04-30 17:48:08 UTC (rev 6812)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClient.java	2008-04-30 17:49:41 UTC (rev 6813)
@@ -52,6 +52,7 @@
 public class AddressingClient
 {
    protected DarEndpoint endpoint;
+   protected String replyToHost;
    
    private static AddressingBuilder BUILDER;
    private static final String WSA_TO = "http://org.jboss.test.ws.jaxws.samples.dar/server";
@@ -63,17 +64,18 @@
       BUILDER = AddressingBuilder.getAddressingBuilder();
    }
    
-   public AddressingClient(URL url)
+   public AddressingClient(URL url, String replyToHost)
    {
       DarService service = new DarService(url, new QName("http://org.jboss.ws/samples/dar", "DarService"));
       endpoint = service.getDarEndpointPort();
       ((StubExt)endpoint).setConfigName("Standard WSAddressing Client");
       ClientHelper.setUsernamePassword((BindingProvider)endpoint, "kermit", "thefrog");
+      this.replyToHost = replyToHost;
    }
    
    public void run(boolean asynch) throws Exception
    {
-      configureAddressingProperties((BindingProvider)endpoint, WSA_ACTION, WSA_TO, "http://localhost:8080/dar-client/replyTo");
+      configureAddressingProperties((BindingProvider)endpoint, WSA_ACTION, WSA_TO, "http://" + replyToHost + ":8080/dar-client/replyTo");
       DarRequest request = ClientHelper.getRequest();
       System.out.println(new Date() + " Sending request...");
       if (asynch)
@@ -92,7 +94,7 @@
    
    public void runOneway() throws Exception
    {
-      configureAddressingProperties((BindingProvider)endpoint, WSA_ACTION_ONEWAY, WSA_TO, "http://localhost:8080/dar-client/replyService");
+      configureAddressingProperties((BindingProvider)endpoint, WSA_ACTION_ONEWAY, WSA_TO, "http://" + replyToHost + ":8080/dar-client/replyService");
       DarRequest request = ClientHelper.getRequest();
       System.out.println(new Date() + " Sending request...");
       endpoint.onewayProcess(request);
@@ -115,7 +117,7 @@
       {
          if (args.length == 1)
          {
-            AddressingClient client = new AddressingClient(new URL(args[0]));
+            AddressingClient client = new AddressingClient(new URL(args[0]), "localhost");
             System.out.println("* Synchronous invocation: ");
             client.run(false);
             System.out.println("\n* Asynchronous invocation: ");

Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java	2008-04-30 17:48:08 UTC (rev 6812)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java	2008-04-30 17:49:41 UTC (rev 6813)
@@ -24,6 +24,7 @@
 //$Id$
 
 import java.net.URL;
+import java.util.Date;
 
 import junit.framework.Test;
 
@@ -32,6 +33,8 @@
 
 /**
  * DAR addressing client; invokes the DAR addressing endpoint (sync, asynch and oneway)
+ * (this is actually a weak test since we can't check if the 
+ * reply-to-service actually receives the response)
  *
  * @author Thomas.Diesler at jboss.org
  * @since 24-Nov-2005
@@ -40,27 +43,36 @@
 {
    public static Test suite()
    {
-      return new JBossWSTestSetup(AddressingClientTestCase.class, "jaxws-samples-dar.jar,jaxws-samples-dar-addressing-client.war");
+      return new JBossWSTestSetup(AddressingClientTestCase.class, "jaxws-samples-dar-addressing-client.war,jaxws-samples-dar-addressing.jar");
    }
 
    public void testSync() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/dar?wsdl");
-      AddressingClient client = new AddressingClient(wsdlURL);
-      //client.run(false);
+      AddressingClient client = new AddressingClient(wsdlURL, getServerHost());
+      Date start = new Date();
+      client.run(false);
+      Date stop = new Date();
+      assertTrue(stop.getTime() - start.getTime() > 3000);
    }
    
    public void testAsync() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/dar?wsdl");
-      AddressingClient client = new AddressingClient(wsdlURL);
-      //client.run(true);
+      AddressingClient client = new AddressingClient(wsdlURL, getServerHost());
+      Date start = new Date();
+      client.run(true);
+      Date stop = new Date();
+      assertTrue(stop.getTime() - start.getTime() > 3000);
    }
    
    public void testOneWay() throws Exception
    {
       URL wsdlURL = new URL("http://" + getServerHost() + ":8080/dar?wsdl");
-      AddressingClient client = new AddressingClient(wsdlURL);
-      //client.runOneway();
+      AddressingClient client = new AddressingClient(wsdlURL, getServerHost());
+      Date start = new Date();
+      client.runOneway();
+      Date stop = new Date();
+      assertTrue(stop.getTime() - start.getTime() < 3000);
    }
 }

Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/Client.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/Client.java	2008-04-30 17:48:08 UTC (rev 6812)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/dar/Client.java	2008-04-30 17:49:41 UTC (rev 6813)
@@ -52,7 +52,7 @@
       ClientHelper.setUsernamePassword((BindingProvider)endpoint, "kermit", "thefrog");
    }
    
-   public void run(boolean asynch) throws Exception
+   public DarResponse run(boolean asynch) throws Exception
    {
       DarRequest request = ClientHelper.getRequest();
       System.out.println(new Date() + " Sending request...");
@@ -69,6 +69,7 @@
       }
       System.out.println(new Date() + " Response received: "+darResponse);
       ClientHelper.printResponse(darResponse);
+      return darResponse;
    }
    
    public static void main(String[] args)

Modified: stack/native/trunk/src/test/resources/jaxws/samples/dar/WEB-INF/wsdl/reply.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/samples/dar/WEB-INF/wsdl/reply.wsdl	2008-04-30 17:48:08 UTC (rev 6812)
+++ stack/native/trunk/src/test/resources/jaxws/samples/dar/WEB-INF/wsdl/reply.wsdl	2008-04-30 17:49:41 UTC (rev 6813)
@@ -48,7 +48,8 @@
  </binding>
  <service name="DarReplyService">
   <port binding="tns:DarReplyEndpointBinding" name="DarReplyEndpointPort">
-   <soap:address location="http://localhost.localdomain:8080/dar-client/replyService"/>
+   <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
+   <!-- <soap:address location="http://localhost.localdomain:8080/dar-client/replyService"/> -->
   </port>
  </service>
 </definitions>




More information about the jbossws-commits mailing list