[jboss-svn-commits] JBossWS SVN: r1118 - in trunk/src: main/java/org/jboss/ws/xop test/java/org/jboss/test/ws/jaxrpc/xop/doclit

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 2 09:02:08 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-10-02 09:02:01 -0400 (Mon, 02 Oct 2006)
New Revision: 1118

Removed:
   trunk/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
   trunk/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
   trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java
   trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java
   trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java
Log:
merged MTOM revamp from branch 1.0

Deleted: trunk/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-10-02 13:01:38 UTC (rev 1117)
+++ trunk/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-10-02 13:02:01 UTC (rev 1118)
@@ -1,93 +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.ws.xop;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import javax.activation.DataSource;
-import org.jboss.xb.binding.JBossXBRuntimeException;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Id$</tt>
- */
-public class SimpleDataSource
-   implements DataSource
-{
-   public final byte[] bytes;
-   public final String contentType;
-
-   public SimpleDataSource(Object o, String contentType)
-   {
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      ObjectOutputStream oos = null;
-      try
-      {
-         oos = new ObjectOutputStream(baos);
-         oos.writeObject(o);
-      }
-      catch(IOException e)
-      {
-         throw new JBossXBRuntimeException("XOP failed to serialize object " + o + ": " + e.getMessage());
-      }
-      finally
-      {
-         if(oos != null)
-         {
-            try
-            {
-               oos.close();
-            }
-            catch(IOException e)
-            {
-            }
-         }
-      }
-      bytes = baos.toByteArray();
-
-      this.contentType = contentType;
-   }
-
-   public String getContentType()
-   {
-      return contentType;
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return new ByteArrayInputStream(bytes);
-   }
-
-   public String getName()
-   {
-      throw new UnsupportedOperationException("getName is not implemented.");
-   }
-
-   public OutputStream getOutputStream() throws IOException
-   {
-      throw new UnsupportedOperationException("getOutputStream is not implemented.");
-   }
-}

Deleted: trunk/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-10-02 13:01:38 UTC (rev 1117)
+++ trunk/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-10-02 13:02:01 UTC (rev 1118)
@@ -1,39 +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.ws.xop;
-
-import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter;
-import org.jboss.xb.binding.sunday.xop.XOPObject;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Aug 10, 2006
- */
-public class XOPValueAdapter implements ValueAdapter {
-   public Object cast(Object o, Class c) {
-
-      XOPObject xop = new XOPObject(o);
-      xop.setContentType(XOPContext.getContentTypeForClazz(c));      
-      return XOPContext.createDataHandler(xop);
-   }
-}

Deleted: trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java	2006-10-02 13:01:38 UTC (rev 1117)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsg.java	2006-10-02 13:02:01 UTC (rev 1118)
@@ -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: trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java	2006-10-02 13:01:38 UTC (rev 1117)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/PingMsgResponse.java	2006-10-02 13:02:01 UTC (rev 1118)
@@ -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;
-   }
-}

Deleted: trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java	2006-10-02 13:01:38 UTC (rev 1117)
+++ trunk/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPElementDoclitTestCase.java	2006-10-02 13:02:01 UTC (rev 1118)
@@ -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;
-   }
-}




More information about the jboss-svn-commits mailing list