Author: heiko.braun(a)jboss.com
Date: 2007-05-23 06:50:19 -0400 (Wed, 23 May 2007)
New Revision: 3207
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpoint.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpointImpl.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
Removed:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
Modified:
branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
Log:
Split swaref samples into bare and wrapped tests
Modified: branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-23
10:49:42 UTC (rev 3206)
+++ branches/jbossws-2.0/jbossws-tests/ant-import/build-samples-jaxws.xml 2007-05-23
10:50:19 UTC (rev 3207)
@@ -179,7 +179,8 @@
<!-- jaxws-samples-swaref -->
<jar jarfile="${tests.output.dir}/libs/jaxws-samples-swaref.jar">
<fileset dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/samples/swaref/Doc*.class"/>
+ <include name="org/jboss/test/ws/jaxws/samples/swaref/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/samples/swaref/*Test*.class"/>
</fileset>
</jar>
Copied:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpoint.java
(from rev 3194,
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java)
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpoint.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpoint.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -0,0 +1,18 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import javax.jws.WebService;
+import javax.jws.WebMethod;
+import javax.jws.soap.SOAPBinding;
+import javax.ejb.Remote;
+
+@WebService(name="BareEndpoint")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle =
SOAPBinding.ParameterStyle.BARE)
+@Remote
+public interface BareEndpoint
+{
+ @WebMethod
+ void submitAttachment(DocumentPayload payload);
+
+ @WebMethod
+ DocumentPayload retrieveAttachment();
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpointImpl.java
(from rev 3194,
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java)
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpointImpl.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpointImpl.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -0,0 +1,33 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import org.jboss.ws.annotation.WebContext;
+
+import javax.jws.WebService;
+import javax.ejb.Stateless;
+import javax.activation.DataHandler;
+import java.io.IOException;
+
+@Stateless
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.swaref.BareEndpoint")
+@WebContext(contextRoot = "jaxws-swaref")
+public class BareEndpointImpl implements BareEndpoint
+{
+
+ public void submitAttachment(DocumentPayload payload)
+ {
+ try
+ {
+ System.out.println("Got '" + payload.getData().getContent()
+"'");
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public DocumentPayload retrieveAttachment()
+ {
+ DataHandler data = new DataHandler("Server data",
"text/plain");
+ return new DocumentPayload(data);
+ }
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/BareEndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java 2007-05-23
10:49:42 UTC (rev 3206)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpoint.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -1,18 +0,0 @@
-package org.jboss.test.ws.jaxws.samples.swaref;
-
-import javax.jws.WebService;
-import javax.jws.WebMethod;
-import javax.jws.soap.SOAPBinding;
-import javax.ejb.Remote;
-
-@WebService(name="DocLitEndpoint")
-@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle =
SOAPBinding.ParameterStyle.BARE)
-@Remote
-public interface DocLitEndpoint
-{
- @WebMethod
- void submitAttachment(DocumentPayload payload);
-
- @WebMethod
- DocumentPayload retrieveAttachment();
-}
Deleted:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java 2007-05-23
10:49:42 UTC (rev 3206)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/DocLitEndpointImpl.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -1,22 +0,0 @@
-package org.jboss.test.ws.jaxws.samples.swaref;
-
-import javax.jws.WebService;
-import javax.ejb.Stateless;
-import javax.activation.DataHandler;
-
-@Stateless
-@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.swaref.DocLitEndpoint")
-public class DocLitEndpointImpl implements DocLitEndpoint
-{
-
- public void submitAttachment(DocumentPayload payload)
- {
- System.out.println("Retrieved " + payload.getData().getContentType());
- }
-
- public DocumentPayload retrieveAttachment()
- {
- DataHandler data = new DataHandler("Plain text attachment",
"text/plain");
- return new DocumentPayload(data);
- }
-}
Modified:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java 2007-05-23
10:49:42 UTC (rev 3206)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/SWARefTestCase.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -16,35 +16,48 @@
*/
public class SWARefTestCase extends JBossWSTest
{
- private String endpointURL = "http://" + getServerHost() +
":9090/DocLitEndpointImplService/DocLitEndpointImpl";
+ private String bareEndpointURL = "http://" + getServerHost() +
":8080/jaxws-swaref/BareEndpointImpl";
+ private String wrappedEndpointURL = "http://" + getServerHost() +
":8080/jaxws-swaref/WrappedEndpointImpl";
+ private QName bareServiceQName = new
QName("http://swaref.samples.jaxws.ws.test.jboss.org/",
"BareEndpointImplService");
+ private QName wrappedServiceQName = new
QName("http://swaref.samples.jaxws.ws.test.jboss.org/",
"WrappedEndpointImplService");
+
+ private static DataHandler data = new DataHandler("Client data",
"text/plain");
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(SWARefTestCase.class,
"jaxws-samples-swaref.jar");
}
- public void testSubmitAttachment() throws Exception {
- DataHandler data = new DataHandler("Client data",
"text/plain");
+ public void testSubmitAttachment() throws Exception
+ {
+ Service service = Service.create(new URL(bareEndpointURL +"?wsdl"),
bareServiceQName);
+ BareEndpoint port = service.getPort(BareEndpoint.class);
+ port.submitAttachment(new DocumentPayload(data));
+ }
- System.out.println(endpointURL);
-
- Service service = Service.create(new URL(endpointURL+"?wsdl"), new
QName("http://swaref.samples.jaxws.ws.test.jboss.org/","Do...);
- DocLitEndpoint port = service.getPort(DocLitEndpoint.class);
+ public void testRetrieveAttachment() throws Exception {
+ Service service = Service.create(new URL(bareEndpointURL +"?wsdl"),
bareServiceQName);
+ BareEndpoint port = service.getPort(BareEndpoint.class);
+ DocumentPayload response = port.retrieveAttachment();
+ assertTrue(response.getData().getContent().equals("Server data"));
+ }
+ public void testWrappedEndpoint() throws Exception
+ {
+ Service service = Service.create(new URL(wrappedEndpointURL+"?wsdl"),
wrappedServiceQName);
+ WrappedEndpoint port = service.getPort(WrappedEndpoint.class);
+
// tweak endpoint URL
BindingProvider provider = (BindingProvider)port;
provider.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
- endpointURL
+ wrappedEndpointURL
);
- // disable chunked encoding
- ((StubExt)port).setConfigName("HTTP 1.0 Client");
+ DocumentPayload response = port.myTest(new DocumentPayload(data), "Hello
world");
+ assertTrue(response.getData().getContent().equals("Server data"));
- port.submitAttachment(new DocumentPayload(data));
}
- public void testRetrieveAttachment() throws Exception {
- // TODO: implement
- }
}
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -0,0 +1,19 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import org.jboss.ws.annotation.WebContext;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.ejb.Remote;
+import java.rmi.RemoteException;
+
+@Remote
+@WebService
+public interface WrappedEndpoint
+{
+ /* (non-Javadoc)
+ * @see org.jboss.ws.test.TestService#myTest(javax.activation.DataHandler)
+ */
+ @WebMethod
+ DocumentPayload myTest(DocumentPayload dhw, String test) throws RemoteException;
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
===================================================================
---
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
(rev 0)
+++
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java 2007-05-23
10:50:19 UTC (rev 3207)
@@ -0,0 +1,89 @@
+package org.jboss.test.ws.jaxws.samples.swaref;
+
+import org.jboss.ws.annotation.WebContext;
+
+import javax.activation.DataHandler;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.ejb.Stateless;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.rmi.RemoteException;
+
+@Stateless
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.samples.swaref.WrappedEndpoint")
+@WebContext(contextRoot = "jaxws-swaref")
+public class WrappedEndpointImpl implements WrappedEndpoint
+{
+ /* (non-Javadoc)
+ * @see org.jboss.ws.test.TestService#myTest(javax.activation.DataHandler)
+ */
+ @WebMethod
+ public DocumentPayload myTest(DocumentPayload dhw, String test) throws
RemoteException
+ {
+ DataHandler dh;
+
+ try {
+ System.out.println("[TestServiceImpl] ---> Dans le service");
+
+ // récupère la pièce attachée
+ if (dhw != null && dhw.getData() != null) {
+ dh=dhw.getData();
+ dumpDH(dh);
+ }
+ else
+ {
+ System.out.println("[TestServiceImpl] ---> Le DataHandler est
NULL.");
+ }
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ dh = new DataHandler("Server data", "text/plain") ;
+
+ try{
+ System.out.println("[TestServiceImpl] ---> Le DataHandler
returned.");
+ dumpDH(dh);
+ }
+ catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return new DocumentPayload(dh);
+ }
+
+
+
+
+ private static void dumpDH(DataHandler in_dh) throws Exception
+ {
+ InputStream is = in_dh.getInputStream();
+ if (is != null) {
+
+ System.out.println("[TestServiceImpl] ---> in_dh START : ");
+ System.out.println("[TestServiceImpl] ---> in_dh START : ");
+ System.out.println("[TestServiceImpl] ---> in_dh START : ");
+
+ // récupère le contenu du fichier
+ BufferedReader in = new BufferedReader(new InputStreamReader(is));
+ String ligne="";
+ ligne = in.readLine();
+ while (ligne != null)
+ {
+ System.out.println(ligne);
+ ligne = in.readLine();
+ }
+ in.close();
+ System.out.println("[TestServiceImpl] ---> END.");
+ System.out.println("[TestServiceImpl] ---> END.");
+ System.out.println("[TestServiceImpl] ---> END.");
+ }
+ else
+ {
+ System.out.println("[TestServiceImpl] ---> in_dh inputstream is
null.");
+ }
+
+ }
+}
Property changes on:
branches/jbossws-2.0/jbossws-tests/src/java/org/jboss/test/ws/jaxws/samples/swaref/WrappedEndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF