Author: richard.opalka(a)jboss.com
Date: 2009-10-07 04:04:49 -0400 (Wed, 07 Oct 2009)
New Revision: 10844
Removed:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/attachment.txt
Modified:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/endpoints/Endpoint1Impl.java
Log:
[JBWS-2753] providing test case
Modified:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java
===================================================================
---
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java 2009-10-07
07:35:24 UTC (rev 10843)
+++
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/UsecasesTestCase.java 2009-10-07
08:04:49 UTC (rev 10844)
@@ -22,14 +22,15 @@
package org.jboss.test.ws.jaxws.endpoint.jse;
import java.io.BufferedReader;
-import java.io.File;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.URL;
import javax.activation.DataHandler;
-import javax.activation.FileDataSource;
+import javax.activation.DataSource;
import javax.xml.namespace.QName;
import javax.xml.ws.Endpoint;
import javax.xml.ws.Service;
@@ -41,6 +42,7 @@
import org.jboss.test.ws.jaxws.endpoint.jse.endpoints.Endpoint1Impl;
import org.jboss.test.ws.jaxws.endpoint.jse.endpoints.DHRequest;
import org.jboss.test.ws.jaxws.endpoint.jse.endpoints.DHResponse;
+import org.jboss.ws.Constants;
import org.jboss.wsf.test.JBossWSTest;
/**
@@ -50,13 +52,24 @@
*/
public final class UsecasesTestCase extends JBossWSTest
{
- private static String fs = System.getProperty("file.separator");
- private static File attachmentFile = JBossWSTest.getResourceFile("jaxws" +
fs + "endpoint" + fs + "attachment.txt");
private static WebServiceFeature[] mtomEnabled = new WebServiceFeature[] { new
MTOMFeature(true) };
private static int port1 = 8871;
private static int port2 = 8872;
+
+
+@Override
+ protected void setUp() throws Exception
+ {
+ System.setProperty(Constants.HTTP_KEEP_ALIVE, "false");
+ }
+ @Override
+ protected void tearDown() throws Exception
+ {
+ System.getProperties().remove(Constants.HTTP_KEEP_ALIVE);
+ }
+
public void testTwoPorts() throws Exception
{
String publishURL1 = "http://" + getServerHost() + ":" + port1
+ "/jaxws-endpoint1";
@@ -185,8 +198,32 @@
{
Endpoint1Iface port = this.getProxy(publishURL, mtomEnabled);
- FileDataSource fds = new FileDataSource(attachmentFile);
- DataHandler dh = new DataHandler(fds);
+ final InputStream is = new ByteArrayInputStream("some
string".getBytes());
+ DataSource ds = new DataSource()
+ {
+
+ public String getContentType()
+ {
+ return "text/plain";
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return is;
+ }
+
+ public String getName()
+ {
+ return "unspecified";
+ }
+
+ public OutputStream getOutputStream() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ DataHandler dh = new DataHandler(ds);
DHResponse response = port.echoDataHandler(new DHRequest(dh));
assertNotNull(response);
Modified:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/endpoints/Endpoint1Impl.java
===================================================================
---
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/endpoints/Endpoint1Impl.java 2009-10-07
07:35:24 UTC (rev 10843)
+++
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/endpoint/jse/endpoints/Endpoint1Impl.java 2009-10-07
08:04:49 UTC (rev 10844)
@@ -22,15 +22,12 @@
package org.jboss.test.ws.jaxws.endpoint.jse.endpoints;
import java.io.IOException;
-import java.io.InputStream;
import javax.activation.DataHandler;
import javax.jws.WebService;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.soap.MTOM;
-import org.jboss.logging.Logger;
-
/**
* Service implementation.
*
@@ -46,7 +43,6 @@
public class Endpoint1Impl implements Endpoint1Iface
{
- private Logger log = Logger.getLogger(Endpoint1Impl.class);
private int count;
public String echo(String input)
@@ -71,13 +67,14 @@
try
{
- log.info("Content type: " + dataHandler.getContentType());
- Object dataContent = dataHandler.getContent();
- log.info("Content class: " + dataContent);
- if ( dataContent instanceof InputStream )
+ if (!dataHandler.getContentType().equals("text/plain"))
{
- ((InputStream)dataContent).close();
+ throw new WebServiceException("Wrong content type");
}
+ if (!dataHandler.getContent().equals("some string"))
+ {
+ throw new WebServiceException("Wrong data");
+ }
}
catch (IOException e)
{
Deleted:
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/attachment.txt
===================================================================
---
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/attachment.txt 2009-10-07
07:35:24 UTC (rev 10843)
+++
stack/native/branches/ropalka/modules/testsuite/native-tests/src/test/resources/jaxws/endpoint/attachment.txt 2009-10-07
08:04:49 UTC (rev 10844)
@@ -1 +0,0 @@
-This is the file content
\ No newline at end of file
Show replies by date