[jbossws-commits] JBossWS SVN: r4766 - framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Oct 15 09:33:40 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-10-15 09:33:39 -0400 (Mon, 15 Oct 2007)
New Revision: 4766

Added:
   framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/FakeInputStream.java
   framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/GeneratorDataSource.java
Modified:
   framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java
Log:
Added JBWS-1856 test case

Added: framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/FakeInputStream.java
===================================================================
--- framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/FakeInputStream.java	                        (rev 0)
+++ framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/FakeInputStream.java	2007-10-15 13:33:39 UTC (rev 4766)
@@ -0,0 +1,62 @@
+/*
+ * 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.samples.xop.doclit;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+public class FakeInputStream extends InputStream
+{
+   private long size;
+
+   public FakeInputStream(long size)
+   {
+      this.size = size;
+   }
+
+   public int read(byte[] b, int off, int len) throws IOException
+   {
+      if (len < 1)
+         return 0;
+
+      if (size == 0)
+         return -1;
+
+      int ret = (int)Math.min(size, len);
+      Arrays.fill(b, off, off + ret, (byte)1);
+      size -= ret;
+
+      return ret;
+   }
+
+   public int read() throws IOException
+   {
+      if (size > 0)
+      {
+         size--;
+         return 1;
+      }
+
+      return -1;
+   }
+}


Property changes on: framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/FakeInputStream.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/GeneratorDataSource.java
===================================================================
--- framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/GeneratorDataSource.java	                        (rev 0)
+++ framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/GeneratorDataSource.java	2007-10-15 13:33:39 UTC (rev 4766)
@@ -0,0 +1,58 @@
+/*
+ * 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.samples.xop.doclit;
+
+import javax.activation.DataSource;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Arrays;
+
+public class GeneratorDataSource implements DataSource
+{
+   private long size;
+
+   public GeneratorDataSource(long size)
+   {
+      this.size = size;
+   }
+
+   public String getContentType()
+   {
+      return "application/octet-stream";
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      return new FakeInputStream(size);
+   }
+
+   public String getName()
+   {
+      return null;
+   }
+
+   public OutputStream getOutputStream() throws IOException
+   {
+      return null;
+   }
+}
\ No newline at end of file


Property changes on: framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/GeneratorDataSource.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java
===================================================================
--- framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java	2007-10-15 10:00:03 UTC (rev 4765)
+++ framework/trunk/src/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/XOPBase.java	2007-10-15 13:33:39 UTC (rev 4766)
@@ -133,6 +133,24 @@
       assertTrue(response.getData() instanceof Source);
    }
    
+   public void testAttachmentpartSwap() throws Exception
+   {
+      getBinding().setMTOMEnabled(true);
+
+      DataHandler dh = new DataHandler( new GeneratorDataSource(1024*128) );
+      DHResponse response = getPort().echoDataHandler(new DHRequest(dh));
+      assertNotNull(response);
+      assertNotNull(response.getDataHandler().getContent());
+
+      File tmpDir = new File(System.getProperty("jboss.home")+"/server/default/tmp/jbossws");
+      assertTrue("Temp dir doesn't exist", tmpDir.exists());
+
+      for(String fileName : tmpDir.list())
+      {
+         assertTrue("Attachment part swap file does still exist: "+fileName, fileName.indexOf("JBossWSattachment") == -1);
+      }
+   }
+
    protected Object getContent(DataHandler dh) throws IOException
    {
       Object content = dh.getContent();




More information about the jbossws-commits mailing list