[jboss-svn-commits] JBossWS SVN: r1031 - in 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
Fri Sep 22 18:22:57 EDT 2006
Author: heiko.braun at jboss.com
Date: 2006-09-22 18:22:54 -0400 (Fri, 22 Sep 2006)
New Revision: 1031
Added:
branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java
branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java
branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java
Log:
separate config for xop and jaxrpc handlers
Added: branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java 2006-09-22 22:22:41 UTC (rev 1030)
+++ branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java 2006-09-22 22:22:54 UTC (rev 1031)
@@ -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/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/XOPTestSupport.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java 2006-09-22 22:22:41 UTC (rev 1030)
+++ branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPHandlerTestCase.java 2006-09-22 22:22:54 UTC (rev 1031)
@@ -0,0 +1,113 @@
+/*
+* 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.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 JBossWSTest {
+
+ private static TestService_PortType port;
+
+ 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");
+ }
+
+ public void testRequestResponseOptimizedHandler() throws Exception {
+
+ System.out.println("FIXME: JBWS-1169");
+
+ /*
+ DataHandler dh = new DataHandler("Another plain text attachment", "text/plain");
+ 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");
+ assertNotNull("base64 value not found", was);
+ assertEquals(expected, was);
+ */
+ }
+
+ public void testRequestResponseOptimized() throws Exception {
+
+ DataHandler dh = new DataHandler("Another plain text attachment", "text/plain");
+ PingMsgResponse value = port.ping(new PingMsg("1|1", IOUtils.convertToBytes(dh)));
+ assertNotNull("Return value was null", value);
+ assertNotNull("Returned xopContent was null", value.getXopContent());
+ }
+
+ public void testResponseOptimized() throws Exception {
+
+ byte[] bytes = 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", bytes));
+ assertNotNull("Return value was null",value);
+ assertNotNull("Return xopContent was null", value.getXopContent());
+ }
+
+ public void testRequestOptimized() throws Exception {
+
+ byte[] bytes = 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", bytes));
+ assertNotNull("Return value was null",value);
+ assertNotNull("Return xopContent was null", value.getXopContent());
+ }
+
+}
Property changes on: branches/hbraun/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/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java 2006-09-22 22:22:41 UTC (rev 1030)
+++ branches/hbraun/jbossws-1.0/src/test/java/org/jboss/test/ws/jaxrpc/xop/doclit/XOPTestCase.java 2006-09-22 22:22:54 UTC (rev 1031)
@@ -0,0 +1,98 @@
+/*
+ * 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.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 JBossWSTest
+{
+ private static TestService_PortType port;
+
+ 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");
+ }
+
+ public void testRequestResponseOptimized() throws Exception {
+
+ DataHandler dh = new DataHandler("Another plain text attachment", "text/plain");
+ PingMsgResponse value = port.ping(new PingMsg("1|1", IOUtils.convertToBytes(dh)));
+ assertNotNull("Return value was null", value);
+ assertNotNull("Returned xopContent was null", value.getXopContent());
+ }
+
+ public void testResponseOptimized() throws Exception {
+
+ byte[] bytes = 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", bytes));
+ assertNotNull("Return value was null",value);
+ assertNotNull("Return xopContent was null", value.getXopContent());
+ }
+
+ public void testRequestOptimized() throws Exception {
+
+ byte[] bytes = 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", bytes));
+ assertNotNull("Return value was null",value);
+ assertNotNull("Return xopContent was null", value.getXopContent());
+ }
+
+}
Property changes on: branches/hbraun/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
More information about the jboss-svn-commits
mailing list