Author: richard.opalka(a)jboss.com
Date: 2011-01-31 10:37:34 -0500 (Mon, 31 Jan 2011)
New Revision: 13654
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
Removed:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/saaj/
Log:
[JBPAPP-4564] refactoring test wrong package
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/InputStreamDataSource.java 2011-01-31
15:37:34 UTC (rev 13654)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.saaj.jbws3084;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public class InputStreamDataSource implements DataSource
+{
+ private InputStream is;
+
+ private String contentType;
+
+ private String name;
+
+ public InputStreamDataSource(InputStream is, String contentType, String name)
+ {
+ this.is = is;
+ this.contentType = contentType;
+ this.name = name;
+ }
+
+ @Override
+ public String getContentType()
+ {
+ return contentType;
+ }
+
+ @Override
+ public InputStream getInputStream() throws IOException
+ {
+ return is;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public OutputStream getOutputStream() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/JBWS3084TestCase.java 2011-01-31
15:37:34 UTC (rev 13654)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.saaj.jbws3084;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPMessage;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-3084] Enable control of chunked encoding when using SOAPConnection.
+ *
+ * @author sberyozk(a)redhat.com
+ */
+public class JBWS3084TestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS3084TestCase.class,
"saaj-soap-connection.war");
+ }
+
+ public void testSoapConnectionGet() throws Exception
+ {
+ final String serviceURL = "http://" + getServerHost() +
":8080/saaj-soap-connection/greetMe";
+ SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
+
+ SOAPConnection con = conFac.createConnection();
+ URL endpoint = new URL(serviceURL);
+ SOAPMessage response = con.get(endpoint);
+ QName greetMeResp = new
QName("http://www.jboss.org/jbossws/saaj",
"greetMeResponse");
+
+ Iterator<?> sayHiRespIterator =
response.getSOAPBody().getChildElements(greetMeResp);
+ SOAPElement soapElement = (SOAPElement) sayHiRespIterator.next();
+ assertNotNull(soapElement);
+
+ assertEquals(1, response.countAttachments());
+ }
+}
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceIface.java 2011-01-31
15:37:34 UTC (rev 13654)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.saaj.jbws3084;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://www.jboss.org/jbossws/saaj")
+public interface ServiceIface
+{
+ @WebMethod
+ String greetMe();
+}
Added:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java
(rev 0)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/saaj/jbws3084/ServiceImpl.java 2011-01-31
15:37:34 UTC (rev 13654)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.saaj.jbws3084;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.activation.DataHandler;
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.wsf.common.IOUtils;
+
+@WebService(portName = "SaajServicePort", serviceName =
"SaajService", wsdlLocation = "WEB-INF/wsdl/SaajService.wsdl",
targetNamespace = "http://www.jboss.org/jbossws/saaj", endpointInterface =
"org.jboss.test.ws.saaj.jbws3084.ServiceIface")
+public class ServiceImpl implements ServiceIface
+{
+ @Resource
+ private WebServiceContext context;
+
+ @SuppressWarnings("unchecked")
+ public String greetMe()
+ {
+ try
+ {
+ Map<String, DataHandler> outDataHandlers = (Map<String,
DataHandler>) context.getMessageContext().get(
+ MessageContext.OUTBOUND_MESSAGE_ATTACHMENTS);
+
+ final char[] content = new char[16 * 1024];
+ Arrays.fill(content, 'A');
+
+ DataHandler handler = new DataHandler(new InputStreamDataSource(new
ByteArrayInputStream(
+ new String(content).getBytes()), "text/plain", "1"));
+ outDataHandlers.put("1", handler);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ return "Greetings";
+ }
+}