Author: alessio.soldano(a)jboss.com
Date: 2008-05-22 05:49:08 -0400 (Thu, 22 May 2008)
New Revision: 7132
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java
Log:
[JBWS-2030] Making AddressingClientTestCase more strict
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java 2008-05-22
09:30:44 UTC (rev 7131)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/samples/dar/AddressingClientTestCase.java 2008-05-22
09:49:08 UTC (rev 7132)
@@ -26,21 +26,24 @@
import java.net.URL;
import java.util.Date;
+import javax.management.ObjectName;
+
import junit.framework.Test;
+import org.jboss.wsf.common.ObjectNameFactory;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
/**
* 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(a)jboss.org
* @since 24-Nov-2005
*/
public class AddressingClientTestCase extends JBossWSTest
{
+ private static final int TEST_RUN_TIME = 6000;
+
public static Test suite()
{
return new JBossWSTestSetup(AddressingClientTestCase.class,
"jaxws-samples-dar-addressing-client.war,jaxws-samples-dar-addressing.jar");
@@ -53,7 +56,7 @@
Date start = new Date();
client.run(false);
Date stop = new Date();
- assertTrue(stop.getTime() - start.getTime() > 3000);
+ assertTrue(stop.getTime() - start.getTime() > TEST_RUN_TIME / 2);
}
public void testAsync() throws Exception
@@ -63,16 +66,25 @@
Date start = new Date();
client.run(true);
Date stop = new Date();
- assertTrue(stop.getTime() - start.getTime() > 3000);
+ assertTrue(stop.getTime() - start.getTime() > TEST_RUN_TIME / 2);
}
public void testOneWay() throws Exception
{
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/dar?wsdl");
+ long count = getRequestCount("dar-client", "ReplyService");
AddressingClient client = new AddressingClient(wsdlURL, getServerHost());
Date start = new Date();
client.runOneway();
Date stop = new Date();
- assertTrue(stop.getTime() - start.getTime() < 3000);
+ assertTrue(stop.getTime() - start.getTime() < TEST_RUN_TIME / 2);
+ Thread.sleep(TEST_RUN_TIME);
+ assertEquals(count + 1, getRequestCount("dar-client",
"ReplyService"));
}
+
+ private long getRequestCount(String context, String endpoint) throws Exception
+ {
+ ObjectName oname = ObjectNameFactory.create("jboss.ws:context=" + context
+ ",endpoint=" + endpoint);
+ return (Long)getServer().getAttribute(oname, "RequestCount");
+ }
}
Show replies by date