[jbossws-commits] JBossWS SVN: r3561 - in branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common: jbws1692 and 1 other directory.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Wed Jun 13 07:51:02 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-06-13 07:51:02 -0400 (Wed, 13 Jun 2007)
New Revision: 3561
Added:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/JBWS1692TestCase.java
Log:
javadoc
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/JBWS1692TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/JBWS1692TestCase.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/JBWS1692TestCase.java 2007-06-13 11:51:02 UTC (rev 3561)
@@ -0,0 +1,81 @@
+/*
+ * 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.common.jbws1692;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * SOAPElement.importNode() not supported
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1692
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 13-Jun-2006
+ */
+public class JBWS1692TestCase extends JBossWSTest
+{
+ public void testImportNode() throws Exception
+ {
+ MessageFactory factory = MessageFactory.newInstance();
+ File soapreqfile = new File("resources/common/jbws1692/soap-request-template.xml");
+ SOAPMessage msg = factory.createMessage(null, new FileInputStream(soapreqfile));
+
+ // Get the node that needs to be imported
+ Node someNode = getNode("resources/common/jbws1692/import-node.xml");
+
+ // Import the node
+ Node importedNode = msg.getSOAPPart().getOwnerDocument().importNode(someNode, true);
+
+ // Append the node to the first child
+ msg.getSOAPBody().getFirstChild().appendChild(importedNode);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ msg.writeTo(baos);
+ String resXML = new String(baos.toByteArray());
+ assertTrue("Invalid response: " + resXML, resXML.indexOf("<a xmlns='urn:custom'><b:Request xmlns:b='urn:custom-ns'/></a>") > 0);
+ }
+
+ private Node getNode(String xmlFile) throws Exception
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setIgnoringComments(true);
+
+ File requestFile = new File(xmlFile);
+ FileInputStream fis = new FileInputStream(requestFile);
+
+ Document doc = factory.newDocumentBuilder().parse(fis);
+ NodeList nodes = doc.getElementsByTagNameNS("urn:custom-ns", "Request");
+ return nodes.item(0);
+ }
+}
\ No newline at end of file
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/common/jbws1692/JBWS1692TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbossws-commits
mailing list