[jboss-svn-commits] JBossWS SVN: r1035 - branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 25 10:23:38 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-09-25 10:23:36 -0400 (Mon, 25 Sep 2006)
New Revision: 1035

Added:
   branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java
Log:
separate MTOM test cases from doc/lit and rpc/lit

Added: branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java	2006-09-25 14:23:22 UTC (rev 1034)
+++ branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java	2006-09-25 14:23:36 UTC (rev 1035)
@@ -0,0 +1,82 @@
+/*
+* 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.jaxrpc.xop.doclit;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
+import org.jboss.ws.utils.IOUtils;
+import org.jboss.ws.jaxrpc.StubExt;
+
+import javax.activation.DataHandler;
+import javax.xml.rpc.Stub;
+import java.io.File;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 25, 2006
+ */
+public abstract class XOPBase extends JBossWSTest {
+
+   protected TestService_PortType port;
+
+   public void testRequestResponseOptimized() throws Exception {
+
+       DataHandler dh = new DataHandler("Another plain text attachment", "text/plain");
+       byte[] bytesIn = IOUtils.convertToBytes(dh);
+       PingMsgResponse value = port.ping(new PingMsg("1|1", bytesIn));
+       assertNotNull("Return value was null", value);
+       byte[] bytesOut = value.getXopContent();
+       assertNotNull("Returned xopContent was null", bytesOut);
+       assertEquals("Content length doesn't match", bytesIn.length, bytesOut.length);
+    }
+
+   public void testResponseOptimized() throws Exception {
+
+      byte[] bytesIn = XOPTestSupport.getBytesFromFile(new File("resources/jaxrpc/samples/mtom/attach.jpeg"));
+
+      // disable MTOM
+      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+      PingMsgResponse value = port.ping(new PingMsg("0|1", bytesIn));
+      assertNotNull("Return value was null",value);
+      byte[] bytesOut = value.getXopContent();
+      assertNotNull("Return xopContent was null", bytesOut);
+      assertEquals("Content length doesn't match", bytesIn.length, bytesOut.length);
+   }
+
+   public void testRequestOptimized() throws Exception {
+
+      byte[] bytesIn = XOPTestSupport.getBytesFromFile(new File("resources/jaxrpc/samples/mtom/attach.jpeg"));
+
+      // reusing the stub means cleaning the previous state
+      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.TRUE);
+
+      PingMsgResponse value = port.ping(new PingMsg("1|0", bytesIn));
+      assertNotNull("Return value was null",value);
+      byte[] bytesOut = value.getXopContent();
+      assertNotNull("Return xopContent was null", bytesOut);
+      assertEquals("Content length doesn't match", bytesIn.length, bytesOut.length);
+   }
+}


Property changes on: branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-svn-commits mailing list