antelder 2003/01/02 02:40:41
Modified: java/test/docStyle ZipCodeAxisTest.java
Log:
Add another testcase for wrapped document style calls to test using both wrapped and
unwrapped parts.
Revision Changes Path
1.6 +60 -7 xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java
Index: ZipCodeAxisTest.java
===================================================================
RCS file: /home/cvs/xml-axis-wsif/java/test/docStyle/ZipCodeAxisTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ZipCodeAxisTest.java 13 Dec 2002 12:17:52 -0000 1.5
+++ ZipCodeAxisTest.java 2 Jan 2003 10:40:40 -0000 1.6
@@ -115,21 +115,21 @@
TestUtilities.setUpExtensionsAndProviders();
}
- public void testDynamicAxisNW() {
- doitDynNW("ZipCodeResolverSoap", "axis");
- }
public void testDynamicAxis() {
doitDyn("ZipCodeResolverSoap", "axis");
}
-
+ public void testDynamicAxisWrapped() {
+ doitDynWrapped("ZipCodeResolverSoap", "axis");
+ }
public void testStubsAxis() {
doitStub("ZipCodeResolverSoap", "axis");
}
-
+ public void testStubsAxisWrapped() {
+ doitStubWrapped("ZipCodeResolverSoap", "axis");
+ }
public void testMessagingAxis() {
doitMessaging("ZipCodeResolverSoap", "axis");
}
-
public void testDyn() {
doitStub("ZipCodeResolverSoapJMS", "axis");
}
@@ -184,7 +184,7 @@
}
}
- private void doitDynNW(String portName, String protocol) {
+ private void doitDynWrapped(String portName, String protocol) {
if (portName.toUpperCase().indexOf("JMS") != -1
&& !TestUtilities.areWeTesting("jms"))
return;
@@ -274,6 +274,59 @@
String zipcode = stub.ShortZipCode( "9999", "607 Trinity", "Austin",
"TX" );
assertTrue("wrong zipcode: " + zipcode + "!!",
"78701".equals(zipcode));
+
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ assertTrue(
+ "AddressBookTest("
+ + portName
+ + ") caught exception "
+ + ex.getLocalizedMessage(),
+ false);
+ }
+ }
+
+ private void doitStubWrapped(String portName, String protocol) {
+ if (portName.toUpperCase().indexOf("JMS") != -1
+ && !TestUtilities.areWeTesting("jms"))
+ return;
+
+ TestUtilities.setProviderForProtocol(protocol);
+
+ try {
+ WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
+ WSIFService service =
+ factory.getService(
+ wsdlLocation,
+ null,
+ null,
+ "http://webservices.eraserver.net/",
+ "ZipCodeResolverSoap");
+
+ //TODO: its a bug that these mapTypes are needed with wrapped operation
stubs
+ service.mapType(
+ new javax.xml.namespace.QName(
+ "http://webservices.eraserver.net/",
+ "ShortZipCode"),
+ ShortZipCode.class );
+ service.mapType(
+ new javax.xml.namespace.QName(
+ "http://webservices.eraserver.net/",
+ "ShortZipCodeResponse"),
+ ShortZipCodeResponse.class );
+
+ ShortZipCode zc = new ShortZipCode();
+ zc.setAccessCode("9999");
+ zc.setAddress("607 Trinity");
+ zc.setCity("Austin");
+ zc.setState("TX");
+
+ docStyle.zipCodeNW.ZipCodeResolverSoap stub =
(docStyle.zipCodeNW.ZipCodeResolverSoap) service.getStub(portName,
docStyle.zipCodeNW.ZipCodeResolverSoap.class);
+
+ ShortZipCodeResponse zcResp = stub.shortZipCode(zc);
+
+ String s = zcResp.getShortZipCodeResult();
+ assertTrue("wrong zipcode: " + s + "!!", "78701".equals(s));
} catch (Exception ex) {
ex.printStackTrace();