Author: heiko.braun(a)jboss.com
Date: 2008-02-19 08:21:42 -0500 (Tue, 19 Feb 2008)
New Revision: 5732
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferService.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferServiceImpl.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/JBWS2000TestCase.java
Modified:
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
Log:
Added jbws2000 test case
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-19 13:01:07 UTC (rev
5731)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-19 13:21:42 UTC (rev
5732)
@@ -605,7 +605,15 @@
<exclude
name="org/jboss/test/ws/jaxws/jbws1904/*TestCase.class"/>
</fileset>
</jar>
-
+
+ <!-- jaxws-jbws2000 -->
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws2000.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2000/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/jbws2000/*TestCase.class"/>
+ </fileset>
+ </jar>
+
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/libs/jaxws-namespace.war"
webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferService.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferService.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferService.java 2008-02-19
13:21:42 UTC (rev 5732)
@@ -0,0 +1,17 @@
+package org.jboss.test.ws.jaxws.jbws2000;
+
+
+import javax.activation.DataHandler;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.BindingType;
+
+@WebService(name = "FileTransferService", targetNamespace =
"http://service.mtom.test.net/")
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
+@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
+public interface FileTransferService {
+ @WebMethod
+ boolean transferFile(String fileName, DataHandler contents);
+
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferServiceImpl.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferServiceImpl.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferServiceImpl.java 2008-02-19
13:21:42 UTC (rev 5732)
@@ -0,0 +1,50 @@
+package org.jboss.test.ws.jaxws.jbws2000;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+
+@Stateless
+@WebService(
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws2000.FileTransferService",
+ name = "FileTransfer",
+ targetNamespace = "http://service.mtom.test.net/"
+)
+public class FileTransferServiceImpl implements FileTransferService {
+
+ public boolean transferFile(String fileName, DataHandler contents) {
+ final List<File> tempFiles = new ArrayList<File>();
+ final File deploymentTempDirectory = getTempDirectory();
+ try {
+ FileOutputStream fileOutputStream = null;
+ try {
+ final File outputFile = new File(deploymentTempDirectory, fileName);
+
+ System.out.println("Write file '"+fileName+"' to dir
" + deploymentTempDirectory);
+
+ fileOutputStream = new FileOutputStream(outputFile);
+ contents.writeTo(fileOutputStream);
+ tempFiles.add(outputFile);
+ } finally {
+ if (fileOutputStream != null) {
+ fileOutputStream.close();
+ }
+ }
+
+ return true;
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to schedule deployment", e);
+ }
+ }
+
+ private File getTempDirectory() {
+ final File deploymentTempDirectory = new
File(System.getProperty("java.io.tmpdir"),
Long.toString(System.currentTimeMillis()));
+ deploymentTempDirectory.mkdir();
+ return deploymentTempDirectory;
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/FileTransferServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/JBWS2000TestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/JBWS2000TestCase.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/JBWS2000TestCase.java 2008-02-19
13:21:42 UTC (rev 5732)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws2000;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.activation.DataHandler;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.jboss.test.ws.jaxws.samples.xop.doclit.GeneratorDataSource;
+
+/**
+ *
+ */
+public class JBWS2000TestCase extends JBossWSTest
+{
+
+ private static FileTransferService port;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS2000TestCase.class,
"jaxws-jbws2000.jar");
+ }
+
+ protected void setUp() throws Exception
+ {
+ if (port == null)
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws2000/FileTransferServiceImpl?wsdl");
+ QName serviceName = new
QName("http://service.mtom.test.net/",
"FileTransferServiceImplService");
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(FileTransferService.class);
+ }
+ }
+
+ public void testFileTransfer() throws Exception
+ {
+ DataHandler dh = new DataHandler(
+ new GeneratorDataSource(1024*1204)
+ );
+
+ boolean success = port.transferFile("JBWS2000.data", dh);
+ assertTrue("Failed to transfer file", success);
+ }
+
+}
\ No newline at end of file
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws2000/JBWS2000TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF