Author: darran.lofthouse(a)jboss.com
Date: 2008-07-18 18:57:58 -0400 (Fri, 18 Jul 2008)
New Revision: 7862
Modified:
stack/native/branches/dlofthouse/JBWS-2187/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2187/JBWS2187TestCase.java
Log:
Three tests to expose the different ways ports conflict.
Modified:
stack/native/branches/dlofthouse/JBWS-2187/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2187/JBWS2187TestCase.java
===================================================================
---
stack/native/branches/dlofthouse/JBWS-2187/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2187/JBWS2187TestCase.java 2008-07-18
17:01:37 UTC (rev 7861)
+++
stack/native/branches/dlofthouse/JBWS-2187/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/jbws2187/JBWS2187TestCase.java 2008-07-18
22:57:58 UTC (rev 7862)
@@ -48,31 +48,67 @@
return new JBossWSTestSetup(JBWS2187TestCase.class,
"jaxws-jbws2187.war");
}
- public void testGetPort() throws Exception
+ public void testSetBothPorts() throws Exception
{
Service service = getService();
+ TestEndpoint original = service.getPort(TestEndpoint.class);
- TestEndpoint port = service.getPort(TestEndpoint.class);
+ setConfigName(original);
+ performTest(original, 1);
- File config =
getResourceFile("jaxws/jbws2187/META-INF/jbws2187-client-config.xml");
- ((StubExt)port).setConfigName("JBWS2187 Config",
config.getAbsolutePath());
+ TestEndpoint subsequent = service.getPort(TestEndpoint.class);
- TestHandler.clear();
- assertEquals("Av it", port.echo("Av it"));
- assertEquals("Call Count", 1, TestHandler.getCallCount());
+ setConfigName(subsequent);
+ performTest(subsequent, 1);
- TestHandler.clear();
- port = service.getPort(TestEndpoint.class);
- ((StubExt)port).setConfigName("JBWS2187 Config",
config.getAbsolutePath());
- assertEquals("Av it", port.echo("Av it"));
- assertEquals("Call Count", 1, TestHandler.getCallCount());
+ performTest(original, 1);
+ }
+ public void testSetFirstPort() throws Exception
+ {
+ Service service = getService();
+ TestEndpoint original = service.getPort(TestEndpoint.class);
+
+ setConfigName(original);
+ performTest(original, 1);
+
+ TestEndpoint subsequent = service.getPort(TestEndpoint.class);
+
+ //setConfigName(subsequent);
+ performTest(subsequent, 0);
+
+ performTest(original, 1);
+ }
+
+ public void testSetSecondPort() throws Exception
+ {
+ Service service = getService();
+ TestEndpoint original = service.getPort(TestEndpoint.class);
+
+ //setConfigName(original);
+ performTest(original, 0);
+
+ TestEndpoint subsequent = service.getPort(TestEndpoint.class);
+
+ setConfigName(subsequent);
+ performTest(subsequent, 1);
+
+ performTest(original, 0);
+ }
+
+ void performTest(TestEndpoint port, int expected) throws Exception
+ {
TestHandler.clear();
- port = service.getPort(TestEndpoint.class);
assertEquals("Av it", port.echo("Av it"));
- assertEquals("Call Count", 0, TestHandler.getCallCount());
+ assertEquals("Call Count", expected, TestHandler.getCallCount());
}
+ void setConfigName(TestEndpoint port)
+ {
+ File config =
getResourceFile("jaxws/jbws2187/META-INF/jbws2187-client-config.xml");
+ ((StubExt)port).setConfigName("JBWS2187 Config",
config.getAbsolutePath());
+ }
+
Service getService() throws Exception
{
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws2187?wsdl");
Show replies by date