[wise-commits] wise SVN: r538 - in core/trunk/integration-testsuite/common/src/test: resources and 1 other directory.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Tue Mar 19 13:02:42 EDT 2013


Author: alessio.soldano at jboss.com
Date: 2013-03-19 13:02:41 -0400 (Tue, 19 Mar 2013)
New Revision: 538

Added:
   core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl
Modified:
   core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java
Log:
[WISE-190] Adding testcase


Modified: core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java
===================================================================
--- core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java	2013-02-27 01:03:54 UTC (rev 537)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/basic/WiseIntegrationBasicTest.java	2013-03-19 17:02:41 UTC (rev 538)
@@ -22,6 +22,8 @@
 package org.jboss.wise.test.integration.basic;
 
 import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.util.Map;
 
@@ -30,6 +32,7 @@
 import org.jboss.wise.core.client.WSMethod;
 import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
 import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.wise.core.exception.InvocationException;
 import org.jboss.wise.core.test.WiseTest;
 import org.junit.AfterClass;
 import org.junit.Assert;
@@ -61,11 +64,47 @@
 	Assert.assertTrue(bos.toString().contains("<arg0>from-wise-client</arg0>"));
 	InvocationResult result = method.invoke(args, null);
 	Map<String, Object> res = result.getMapRequestAndResult(null, null);
+	@SuppressWarnings("unchecked")
 	Map<String, Object> test = (Map<String, Object>) res.get("results");
 	client.close();
 	Assert.assertEquals("from-wise-client", test.get("result"));
     }
 
+    @Test
+    public void shouldAllowOverridingTargetEndpoint() throws Exception {
+
+	final File targetDir = new File("target", "test-classes");
+	URL wsdlURL = new File(targetDir, "basic-local.wsdl").toURI().toURL();
+
+	WSDynamicClientBuilder clientBuilder = WSDynamicClientFactory.getJAXWSClientBuilder();
+	WSDynamicClient client = clientBuilder.tmpDir("target/temp/wise").verbose(true).keepSource(true).wsdlURL(wsdlURL
+		.toString()).build();
+	WSMethod method = client.getWSMethod("HelloService", "HelloWorldBeanPort", "echo");
+	Map<String, Object> args = new java.util.HashMap<String, Object>();
+	args.put("arg0", "from-wise-client");
+	ByteArrayOutputStream bos = new ByteArrayOutputStream();
+	method.writeRequestPreview(args, bos);
+	Assert.assertTrue(bos.toString().contains("<arg0>from-wise-client</arg0>"));
+	
+	InvocationResult result;
+	try {
+	    result = method.invoke(args, null);
+	    Assert.fail("Invocation should have failed because of invalid target endpoint address");
+	} catch (InvocationException ie) {
+	    //expected
+	    Assert.assertTrue(ie.getCause().getCause() instanceof InvocationTargetException);
+	}
+	
+	method.getEndpoint().setTargetUrl(getServerHostAndPort() + "/basic/HelloWorld");
+	result = method.invoke(args, null);
+	
+	Map<String, Object> res = result.getMapRequestAndResult(null, null);
+	@SuppressWarnings("unchecked")
+	Map<String, Object> test = (Map<String, Object>) res.get("results");
+	client.close();
+	Assert.assertEquals("from-wise-client", test.get("result"));
+    }
+
     @AfterClass
     public static void tearDown() throws Exception {
 	try {

Added: core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl
===================================================================
--- core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl	                        (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/resources/basic-local.wsdl	2013-03-19 17:02:41 UTC (rev 538)
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<wsdl:definitions name="HelloService" targetNamespace="http://www.javalinux.it/helloworld" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.javalinux.it/helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+  <wsdl:types>
+<xs:schema elementFormDefault="unqualified" targetNamespace="http://www.javalinux.it/helloworld" version="1.0" xmlns:tns="http://www.javalinux.it/helloworld" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="echo" type="tns:echo"/>
+<xs:element name="echoResponse" type="tns:echoResponse"/>
+<xs:complexType name="echo">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+<xs:complexType name="echoResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="echoResponse">
+    <wsdl:part element="tns:echoResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="echo">
+    <wsdl:part element="tns:echo" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="HelloWorldInterface">
+    <wsdl:operation name="echo">
+      <wsdl:input message="tns:echo" name="echo">
+    </wsdl:input>
+      <wsdl:output message="tns:echoResponse" name="echoResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloWorldInterface">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="echo">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="echo">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="echoResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="HelloService">
+    <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloWorldBeanPort">
+      <soap:address location="http://replace.me:8976/foo/bar"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file



More information about the wise-commits mailing list