[jboss-svn-commits] JBossWS SVN: r1105 - in branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop: . doclit rpclit shared

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 2 06:54:08 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-10-02 06:53:58 -0400 (Mon, 02 Oct 2006)
New Revision: 1105

Added:
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestServiceImpl.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_PortType.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_Service.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPBase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPHandlerTestCase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPTestCase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsg.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsgResponse.java
Removed:
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java
Modified:
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestServiceImpl.java
   branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestService_PortType.java
Log:
extended XOP test cases

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,52 @@
+/*
+* 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;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.FileInputStream;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 22, 2006
+ */
+public class XOPTestSupport {
+
+   public static byte[] getBytesFromFile(File file) throws IOException {
+      InputStream is = new FileInputStream(file);
+
+      long length = file.length();
+      byte[] bytes = new byte[(int)length];
+
+      int offset = 0;
+      int numRead = 0;
+      while (offset < bytes.length
+          && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
+         offset += numRead;
+      }
+
+      is.close();
+      return bytes;
+   }
+}


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

Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/InlineHandler.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -1,22 +1,46 @@
+/*
+* 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 javax.xml.namespace.QName;
+import org.jboss.logging.Logger;
+import org.jboss.ws.soap.NameImpl;
+
 import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
 import javax.xml.rpc.handler.MessageContext;
 import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPMessage;
 
-import org.jboss.logging.Logger;
-import org.jboss.ws.soap.NameImpl;
-
 /**
  * @author Heiko Braun <heiko.braun at jboss.com>
- * @since Jun 16, 2006
+ * @version $Id$
+ * @since Sep 25, 2006
  */
 public class InlineHandler extends GenericHandler
 {
+   HandlerInfo config;
 
    private static Logger log = Logger.getLogger(InlineHandler.class);
 
@@ -25,6 +49,10 @@
       return new QName[0];
    }
 
+   public void init(HandlerInfo config) {
+      this.config = config;
+   }
+
    public boolean handleRequest(MessageContext messageContext)
    {
       dumpMessage(messageContext);
@@ -52,7 +80,7 @@
       }
       catch (Exception e)
       {
-         log.error(e);
+         log.error("Failed to access inline XOP values", e);
       }
    }
 }

Deleted: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -1,35 +0,0 @@
-/*  
- * JBoss, the OpenSource EJB server
- * Distributable under LGPL license. See terms of license at gnu.org. 
- */
-//Auto Generated by jbossws - Please do not edit!!!
-
-
-package org.jboss.test.ws.jaxrpc.xop.doclit;
-
-import javax.activation.DataHandler;
-
-public class PingMsg
-{
-   protected String message;
-   protected DataHandler xopContent;
-
-   public PingMsg(){}
-
-   public PingMsg(String message, DataHandler dataHandler){
-      this.message=message;
-      this.xopContent = dataHandler;
-   }
-
-   public java.lang.String getMessage() { return message ;}
-
-   public void setMessage(java.lang.String message){ this.message=message; }
-
-   public DataHandler getXopContent() {
-      return xopContent;
-   }
-
-   public void setXopContent(DataHandler xopContent) {
-      this.xopContent = xopContent;
-   }
-}

Deleted: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -1,31 +0,0 @@
-/*
- * JBoss, the OpenSource EJB server
- * Distributable under LGPL license. See terms of license at gnu.org.
- */
-//Auto Generated by jbossws - Please do not edit!!!
-
-
-package org.jboss.test.ws.jaxrpc.xop.doclit;
-
-import javax.activation.DataHandler;
-
-
-public class  PingMsgResponse
-{
-   protected DataHandler xopContent;
-
-   public PingMsgResponse(){
-   }
-
-   public PingMsgResponse(DataHandler dataHandler) {
-      this.xopContent = dataHandler;
-   }
-
-   public DataHandler getXopContent() {
-      return xopContent;
-   }
-
-   public void setXopContent(DataHandler xopContent) {
-      this.xopContent = xopContent;
-   }
-}

Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestServiceImpl.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestServiceImpl.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestServiceImpl.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -1,13 +1,29 @@
 package org.jboss.test.ws.jaxrpc.xop.doclit;
 
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.StubExt;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.test.ws.jaxrpc.xop.shared.MTOMServiceBase;
+
 import java.rmi.RemoteException;
+import java.util.StringTokenizer;
 
 /**
+ * MTOM test service impl.
+ * The 'message' param value determines wether or not the response
+ * should be XOP encoded or not.
+ *
  * @author Heiko Braun, <heiko at openj.net>
  * @since 11-Apr-2006
  */
-public class TestServiceImpl implements TestService_PortType {
-    public PingMsgResponse ping(PingMsg pingMsg) throws RemoteException {
-        return new PingMsgResponse(pingMsg.getXopContent());
-    }
+public class TestServiceImpl extends MTOMServiceBase implements TestService_PortType {
+
+   public PingMsgResponse ping(PingMsg pingMsg) throws RemoteException {
+
+      toggleXOP(pingMsg.getMessage());
+      return new PingMsgResponse(pingMsg.getXopContent());
+      
+   }
 }

Modified: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestService_PortType.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestService_PortType.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/TestService_PortType.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -5,8 +5,7 @@
 //Auto Generated by jbossws - Please do not edit!!!
 
 package org.jboss.test.ws.jaxrpc.xop.doclit;
-public interface  TestService_PortType extends java.rmi.Remote
+public interface TestService_PortType extends java.rmi.Remote
 {
-
-  public org.jboss.test.ws.jaxrpc.xop.doclit.PingMsgResponse  ping(org.jboss.test.ws.jaxrpc.xop.doclit.PingMsg pingMsg) throws  java.rmi.RemoteException;
+   public org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse  ping(org.jboss.test.ws.jaxrpc.xop.shared.PingMsg pingMsg) throws  java.rmi.RemoteException;
 }

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPBase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -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/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

Deleted: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -1,123 +0,0 @@
-/*
- * 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;
-
-// $Id: xop.doclitTestCase.java 275 2006-05-04 21:36:29Z jason.greene at jboss.com $
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.activation.DataHandler;
-import javax.naming.InitialContext;
-import javax.xml.rpc.Service;
-import javax.xml.rpc.Stub;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.jaxrpc.StubExt;
-import org.jboss.xb.binding.SimpleTypeBindings;
-
-/**
- *
- * @author Heiko.Braun at jboss.org
- * @since 11-Nov-2005
- */
-public class XOPElementDoclitTestCase extends JBossWSTest
-{
-   private static TestService_PortType port;
-
-   public static Test suite()
-   {
-      return JBossWSTestSetup.newTestSetup(XOPElementDoclitTestCase.class, "jaxrpc-xop-doclit.war, jaxrpc-xop-doclit-client.jar");
-   }
-
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      if (port == null)
-      {
-         InitialContext iniCtx = getInitialContext();
-         Service service = (Service)iniCtx.lookup("java:comp/env/service/TestService");
-         port = (TestService_PortType)service.getPort(TestService_PortType.class);
-      }
-
-      //((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8081/jaxrpc-xop-doclit");
-   }
-
-
-   public void testPingMsgInlined() throws Exception {
-
-      DataHandler dh = new DataHandler("Another plain text attachment", "text/plain");
-      PingMsgResponse value = port.ping(new PingMsg("Some text message", dh));
-      assertNotNull("Return value was null", value);
-      assertNotNull("Returned xopContent was null", value.getXopContent());
-      assertTrue("Wrong java type returned", (value.getXopContent()) instanceof DataHandler);
-
-      // check inline values
-      ByteArrayOutputStream bout = new ByteArrayOutputStream();
-      dh.writeTo(bout);
-
-      byte[] imageBytes = bout.toByteArray();
-      String expected = SimpleTypeBindings.marshalBase64(imageBytes);
-
-      String was = (String)((Stub) port)._getProperty("xop.inline.value");
-      System.out.println("FIXME: JBWS-1169");
-      //assertNotNull("base64 value not found", was);
-      //assertEquals(expected, was);
-   }
-
-   public void testMTOMDisabled() throws Exception {
-
-      byte[] bytes = getBytesFromFile(new File("resources/jaxrpc/samples/mtom/attach.jpeg"));
-      DataHandler dh = new DataHandler(new ByteArrayInputStream(bytes), "application/octet-stream");
-
-      // force disable MTOM
-      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
-
-      PingMsgResponse value = port.ping(new PingMsg("Some text message", dh));
-      assertNotNull("Return value was null",value);
-      assertNotNull("Return image was null", value.getXopContent());
-   } 
-
-   public static byte[] getBytesFromFile(File file) throws IOException {
-      InputStream is = new FileInputStream(file);
-
-      long length = file.length();
-      byte[] bytes = new byte[(int)length];
-
-      int offset = 0;
-      int numRead = 0;
-      while (offset < bytes.length
-          && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
-         offset += numRead;
-      }
-
-      is.close();
-      return bytes;
-   }
-}

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,67 @@
+/*
+* 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 junit.framework.Test;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.ws.utils.IOUtils;
+import org.jboss.ws.jaxrpc.StubExt;
+
+import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.Stub;
+import javax.activation.DataHandler;
+import java.io.File;
+
+/**
+ * Test MTOM functionality with jaxrpc-handlers in place.<br>
+ * This basically determines wether XB needs to handle base64 values directly
+ * or uses callbacks to XOPMarshaller/Unmarshaller.
+ *
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 22, 2006
+ */
+public class XOPHandlerTestCase extends XOPBase  {
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(XOPHandlerTestCase.class, "jaxrpc-xop-doclit_handler.war, jaxrpc-xop-doclit_handler-client.jar");
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      if (port == null)
+      {
+         InitialContext iniCtx = getInitialContext();
+         Service service = (Service)iniCtx.lookup("java:comp/env/service/XOPHandlerTestCase");
+         port = (TestService_PortType)service.getPort(TestService_PortType.class);
+      }
+
+      //((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8081/jaxrpc-xop-doclit_handler");
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,67 @@
+/*
+ * 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;
+
+// $Id$
+
+import junit.framework.Test;
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.ws.jaxrpc.StubExt;
+import org.jboss.ws.utils.IOUtils;
+
+import javax.activation.DataHandler;
+import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.Stub;
+import java.io.File;
+
+/**
+ * Test MTOM functionaly without any jaxrpc handlers in place.
+ *
+ * @author Heiko.Braun at jboss.org
+ * @since Sep 22, 2006
+ */
+public class XOPTestCase extends XOPBase {
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(XOPTestCase.class, "jaxrpc-xop-doclit.war, jaxrpc-xop-doclit-client.jar");
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      if (port == null)
+      {
+         InitialContext iniCtx = getInitialContext();
+         Service service = (Service)iniCtx.lookup("java:comp/env/service/XOPTestCase");
+         port = (TestService_PortType)service.getPort(TestService_PortType.class);
+      }
+
+      //((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8081/jaxrpc-xop-doclit");
+   }
+
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/InlineHandler.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,65 @@
+package org.jboss.test.ws.jaxrpc.xop.rpclit;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.soap.NameImpl;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
+import javax.xml.rpc.handler.MessageContext;
+import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @since Jun 16, 2006
+ */
+public class InlineHandler extends GenericHandler
+{
+   HandlerInfo config;
+
+   private static Logger log = Logger.getLogger(InlineHandler.class);
+
+   public QName[] getHeaders()
+   {
+      return new QName[0];
+   }
+
+   public void init(HandlerInfo config) {
+      this.config = config;
+   }
+
+   public boolean handleRequest(MessageContext messageContext)
+   {
+      dumpMessage(messageContext, "parameters");
+      return true;
+   }
+
+   public boolean handleResponse(MessageContext messageContext)
+   {
+      dumpMessage(messageContext, "result");
+      return true;
+   }
+
+   private void dumpMessage(MessageContext messageContext, String parentName)
+   {
+      try
+      {
+         SOAPMessage soapMessage = ((SOAPMessageContext)messageContext).getMessage();
+         SOAPBody soapBody = soapMessage.getSOAPBody();
+
+         SOAPElement bodyElement = (SOAPElement)soapBody.getChildElements().next();
+         SOAPElement wrapper = (SOAPElement)bodyElement.getChildElements(new NameImpl(parentName)).next();
+         SOAPElement xopElement = (SOAPElement)wrapper.getChildElements(new NameImpl("xopContent")).next();
+         String base64Value = xopElement.getValue();
+         log.debug("base64Value: " + base64Value);
+         messageContext.setProperty("xop.inline.value", base64Value);
+      }
+      catch (Exception e)
+      {
+         // ingore, happens when simple types are send
+      }
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestServiceImpl.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestServiceImpl.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestServiceImpl.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,32 @@
+package org.jboss.test.ws.jaxrpc.xop.rpclit;
+
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.jaxrpc.StubExt;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.test.ws.jaxrpc.xop.shared.MTOMServiceBase;
+
+import java.rmi.RemoteException;
+import java.util.StringTokenizer;
+
+/**
+ * @author Heiko Braun, <heiko at openj.net>
+ * @since 11-Apr-2006
+ */
+public class TestServiceImpl extends MTOMServiceBase implements TestService_PortType {
+
+   public PingMsgResponse pingComplex(PingMsg pingMsg) throws RemoteException {
+
+      String message = pingMsg.getMessage();      
+      toggleXOP(message);
+
+      return new PingMsgResponse(pingMsg.getXopContent());
+   }
+
+   public byte[] pingSimple(String parameters, byte[] xopContent) throws RemoteException { 
+      toggleXOP(parameters);
+      return xopContent;
+   }
+
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_PortType.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_PortType.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_PortType.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,12 @@
+/*  
+ * JBoss, the OpenSource EJB server
+ * Distributable under LGPL license. See terms of license at gnu.org. 
+ */
+//Auto Generated by jbossws - Please do not edit!!!
+
+package org.jboss.test.ws.jaxrpc.xop.rpclit;
+public interface TestService_PortType extends java.rmi.Remote
+{
+   public org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse pingComplex(org.jboss.test.ws.jaxrpc.xop.shared.PingMsg pingMsg) throws java.rmi.RemoteException;
+   public byte[] pingSimple(String parameters, byte[] xopContent) throws java.rmi.RemoteException;
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_Service.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_Service.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/TestService_Service.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,17 @@
+/*  
+* JBoss, the OpenSource EJB server
+* Distributable under LGPL license. See terms of license at gnu.org.
+*/
+
+//Auto Generated by jbossws - Please do not edit!!!
+
+package org.jboss.test.ws.jaxrpc.xop.rpclit;
+
+
+import javax.xml.rpc.ServiceException;
+
+
+public interface  TestService_Service extends  javax.xml.rpc.Service
+{
+   public org.jboss.test.ws.jaxrpc.xop.rpclit.TestService_PortType getTestServicePort() throws ServiceException;
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPBase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPBase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPBase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,103 @@
+/*
+* 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.rpclit;
+
+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;
+import java.util.StringTokenizer;
+
+/**
+ * @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);
+      requestComplex(new PingMsg("1|1", bytesIn));
+
+   }
+
+   public void testResponseOptimized() throws Exception {
+
+      byte[] bytesIn = XOPTestSupport.getBytesFromFile(new File("resources/jaxrpc/samples/mtom/attach.jpeg"));
+      requestComplex(new PingMsg("0|1", bytesIn));
+
+   }
+
+   public void testRequestOptimized() throws Exception {
+
+      byte[] bytesIn = XOPTestSupport.getBytesFromFile(new File("resources/jaxrpc/samples/mtom/attach.jpeg"));
+      requestComplex(new PingMsg("1|0", bytesIn));
+
+   }
+
+   private void requestComplex(PingMsg payload) throws Exception
+   {
+      StringTokenizer tok =new StringTokenizer(payload.getMessage(), "|");
+      boolean mtomEnabled = tok.nextToken().equals("1");
+      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.valueOf(mtomEnabled));
+
+      PingMsgResponse value = port.pingComplex(payload);
+      assertNotNull("Return value was null",value);
+      byte[] bytesOut = value.getXopContent();
+      assertNotNull("Return xopContent was null", bytesOut);
+      assertEquals("Content length doesn't match", payload.getXopContent().length, bytesOut.length);
+   }
+
+   public void testSimpleTypesOptimized() throws Exception
+   {
+      DataHandler dh = new DataHandler("Simple type plain text attachment", "text/plain");
+      byte[] bytesIn = IOUtils.convertToBytes(dh);
+      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.TRUE);
+      byte[] bytesOut = port.pingSimple("s1|s1", bytesIn);
+
+      assertNotNull("Return xopContent was null", bytesOut);
+      assertEquals("Content length doesn't match", bytesIn.length, bytesOut.length);
+   }
+
+   public void testSimpleTypesResponseOptimized() throws Exception
+   {
+      DataHandler dh = new DataHandler("Simple type plain text attachment", "text/plain");
+      byte[] bytesIn = IOUtils.convertToBytes(dh);
+      ((Stub)port)._setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
+      byte[] bytesOut = port.pingSimple("s0|s1", bytesIn);
+
+      assertNotNull("Return xopContent was null", bytesOut);
+      assertEquals("Content length doesn't match", bytesIn.length, bytesOut.length);
+
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPHandlerTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPHandlerTestCase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPHandlerTestCase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,63 @@
+/*
+* 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.rpclit;
+
+import junit.framework.Test;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.ws.utils.IOUtils;
+import org.jboss.ws.jaxrpc.StubExt;
+
+import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.Stub;
+import javax.activation.DataHandler;
+import java.io.File;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 22, 2006
+ */
+public class XOPHandlerTestCase extends XOPBase  {   
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(XOPHandlerTestCase.class, "jaxrpc-xop-rpclit_handler.war, jaxrpc-xop-rpclit_handler-client.jar");
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      if (port == null)
+      {
+         InitialContext iniCtx = getInitialContext();
+         Service service = (Service)iniCtx.lookup("java:comp/env/service/XOPHandlerTestCaseRPC");
+         port = (TestService_PortType)service.getPort(TestService_PortType.class);
+      }
+
+      //((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8081/jaxrpc-xop-rpclit_handler");
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPTestCase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPTestCase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/rpclit/XOPTestCase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,66 @@
+/*
+ * 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.rpclit;
+
+// $Id$
+
+import junit.framework.Test;
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.test.ws.jaxrpc.xop.XOPTestSupport;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsg;
+import org.jboss.test.ws.jaxrpc.xop.shared.PingMsgResponse;
+import org.jboss.ws.jaxrpc.StubExt;
+import org.jboss.ws.utils.IOUtils;
+
+import javax.activation.DataHandler;
+import javax.naming.InitialContext;
+import javax.xml.rpc.Service;
+import javax.xml.rpc.Stub;
+import java.io.File;
+
+/**
+ *
+ * @author Heiko.Braun at jboss.org
+ * @since 11-Nov-2005
+ */
+public class XOPTestCase extends XOPBase {
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(XOPTestCase.class, "jaxrpc-xop-rpclit.war, jaxrpc-xop-rpclit-client.jar");
+   }
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+      if (port == null)
+      {
+         InitialContext iniCtx = getInitialContext();
+         Service service = (Service)iniCtx.lookup("java:comp/env/service/XOPTestCaseRPC");
+         port = (TestService_PortType)service.getPort(TestService_PortType.class);
+      }
+
+      //((Stub)port)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8081/jaxrpc-xop-rpclit");
+   }
+
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/MTOMServiceBase.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,48 @@
+/*
+* 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.shared;
+
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.soap.MessageContextAssociation;
+import org.jboss.ws.jaxrpc.StubExt;
+
+import java.util.StringTokenizer;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 25, 2006
+ */
+public class MTOMServiceBase {
+   protected void toggleXOP(String message) {
+      StringTokenizer tok = new StringTokenizer(message, "|");
+      String requestOptimized = tok.nextToken();
+      String responseOptimized = tok.nextToken();
+      System.out.println(requestOptimized+"|"+responseOptimized);
+
+      if(responseOptimized.equals("0"))
+      {
+         CommonMessageContext ctx = MessageContextAssociation.peekMessageContext();
+         ctx.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+      }
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsg.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsg.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsg.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,32 @@
+/*  
+ * JBoss, the OpenSource EJB server
+ * Distributable under LGPL license. See terms of license at gnu.org. 
+ */
+//Auto Generated by jbossws - Please do not edit!!!
+
+package org.jboss.test.ws.jaxrpc.xop.shared;
+
+public class PingMsg
+{
+   protected String message;
+   protected byte[] xopContent;
+
+   public PingMsg(){}
+
+   public PingMsg(String message, byte[] dataHandler){
+      this.message=message;
+      this.xopContent = dataHandler;
+   }
+
+   public java.lang.String getMessage() { return message ;}
+
+   public void setMessage(java.lang.String message){ this.message=message; }
+
+   public byte[] getXopContent() {
+      return xopContent;
+   }
+
+   public void setXopContent(byte[] xopContent) {
+      this.xopContent = xopContent;
+   }
+}


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

Added: branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsgResponse.java
===================================================================
--- branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsgResponse.java	2006-10-02 10:52:52 UTC (rev 1104)
+++ branches/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/shared/PingMsgResponse.java	2006-10-02 10:53:58 UTC (rev 1105)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, the OpenSource EJB server
+ * Distributable under LGPL license. See terms of license at gnu.org.
+ */
+//Auto Generated by jbossws - Please do not edit!!!
+
+
+package org.jboss.test.ws.jaxrpc.xop.shared;
+
+public class  PingMsgResponse
+{
+   protected byte[] xopContent;
+
+   public PingMsgResponse(){
+   }
+
+   public PingMsgResponse(byte[] dataHandler) {
+      this.xopContent = dataHandler;
+   }
+
+   public byte[] getXopContent() {
+      return xopContent;
+   }
+
+   public void setXopContent(byte[] xopContent) {
+      this.xopContent = xopContent;
+   }
+}


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




More information about the jboss-svn-commits mailing list