[jboss-svn-commits] JBL Code SVN: r29427 - in labs/jbossesb/trunk: product/rosetta/src/org/jboss/internal/soa/esb/util and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Sep 22 04:09:20 EDT 2009
Author: kevin.conner at jboss.com
Date: 2009-09-22 04:09:19 -0400 (Tue, 22 Sep 2009)
New Revision: 29427
Added:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Element.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/IdentitySAXHandler.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Node.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Text.java
Removed:
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Element.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/IdentitySAXHandler.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Node.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Text.java
Modified:
labs/jbossesb/trunk/product/.classpath
labs/jbossesb/trunk/product/build-distr.xml
labs/jbossesb/trunk/product/build.xml
labs/jbossesb/trunk/product/ivy.xml
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/util/XMLHelperUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/StringUtils.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/util/BindingsTransformUnitTest.java
labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
Log:
Removed xmlunit from codebase: JBESB-2833
Modified: labs/jbossesb/trunk/product/.classpath
===================================================================
--- labs/jbossesb/trunk/product/.classpath 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/.classpath 2009-09-22 08:09:19 UTC (rev 29427)
@@ -131,6 +131,5 @@
<classpathentry kind="lib" path="tools/console/lib/hsqldb.jar"/>
<classpathentry kind="var" path="ESB_ROOT/testlib/junit-4.1.jar"/>
<classpathentry kind="var" path="ESB_ROOT/testlib/mockejb.jar"/>
- <classpathentry kind="var" path="ESB_ROOT/testlib/xmlunit-1.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/build-distr.xml 2009-09-22 08:09:19 UTC (rev 29427)
@@ -151,7 +151,6 @@
<fileset dir="${lib.dir}" includes="slf4j-*.jar"/>
<fileset dir="${lib.dir}" includes="freemarker-*.jar"/>
- <fileset dir="${lib.dir}" includes="xmlunit-*.jar"/>
<!-- smooks -->
<fileset dir="${lib.dir}" includes="milyn-*.jar,freemarker-*.jar,jackson-lgpl-*.jar,ognl-*.jar,stringtemplate-*.jar,xpp3_min-*.jar"/>
<fileset dir="${lib.ext.dir}" includes="opencsv-*.jar"/>
Modified: labs/jbossesb/trunk/product/build.xml
===================================================================
--- labs/jbossesb/trunk/product/build.xml 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/build.xml 2009-09-22 08:09:19 UTC (rev 29427)
@@ -257,7 +257,7 @@
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="xbean-*.jar jbossall-client*.jar hibernate*.jar log4j-*.jar milyn-*.jar commons-httpclient-*.jar mail*.jar"/>
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="jboss-metadata-*.jar activation-*.jar bsf-*.jar commons-io-*.jar dom4j-*.jar jboss-dependency-*.jar"/>
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="jboss-deployers-client-spi-*.jar jboss-deployers-spi-*.jar jboss-deployers-structure-spi-*.jar"/>
- <fileset dir="${org.jboss.esb.internal.dest}/lib" includes="jboss-kernel-*.jar jgroups-*.jar jboss-system-*.jar stringtemplate-*.jar xmlunit-*.jar"/>
+ <fileset dir="${org.jboss.esb.internal.dest}/lib" includes="jboss-kernel-*.jar jgroups-*.jar jboss-system-*.jar stringtemplate-*.jar"/>
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="xercesImpl-*.jar jboss-4*.jar jaxb-api-*.jar jboss-deployers-core-spi-*.jar"/>
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="stax-api*.jar jboss-vfs-*.jar jboss-deployers-vfs-spi-*.jar mvel-*.jar bsh-*.jar groovy-all-*.jar mina-core-*.jar"/>
<fileset dir="${org.jboss.esb.internal.dest}/lib" includes="javassist-*.jar jboss-cache-*.jar commons-codec-*.jar quartz-*.jar jsch-*.jar ognl-*.jar"/>
Modified: labs/jbossesb/trunk/product/ivy.xml
===================================================================
--- labs/jbossesb/trunk/product/ivy.xml 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/ivy.xml 2009-09-22 08:09:19 UTC (rev 29427)
@@ -102,9 +102,6 @@
<dependency org="sun-jaxws" name="jaxws-rt" rev="2.1.1"/>
<dependency org="sun-jaxb" name="jaxb-xjc" rev="2.1.4"/>
- <!-- xmlunit -->
- <dependency org="xmlunit" name="xmlunit" rev="1.2"/>
-
<!-- JBoss Microcontainer dependencies -->
<dependency org="org.jboss.deployers" name="jboss-deployers-vfs-spi" rev="2.0.7.GA">
<exclude org="jboss" module="jboss-vfs"/>
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Element.java (from rev 29324, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Element.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Element.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Element.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.util;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.Attributes;
+
+/**
+ * Simple class representing an element.
+ * This is used to compare XML documents.
+ *
+ * @author Kevin Conner
+ */
+public class Element implements Node
+{
+ /**
+ * The QName comparator.
+ */
+ private static final Comparator<QName> QNAME_COMPARATOR = new QNameComparator() ;
+
+ /**
+ * The name of the element.
+ */
+ private final QName name ;
+ /**
+ * Associated attributes.
+ */
+ private final Map<QName, String> attributes = new TreeMap<QName, String>(QNAME_COMPARATOR) ;
+ /**
+ * Children.
+ */
+ private final List<Node> children = new ArrayList<Node>() ;
+
+ /**
+ * Construct the element.
+ * @param namespaceURI The namespace for the element.
+ * @param localName The local name of the element.
+ * @param attributes The associated attributes.
+ */
+ Element(final String namespaceURI, final String localName, final Attributes attributes)
+ {
+ name = new QName(namespaceURI, localName) ;
+ final int numAttributes = attributes.getLength() ;
+ for(int count = 0 ; count < numAttributes ; count++)
+ {
+ final String attrNamespaceURI = attributes.getURI(count) ;
+ final String attrLocalName = attributes.getLocalName(count) ;
+ final String attrValue = attributes.getValue(count) ;
+
+ this.attributes.put(new QName(attrNamespaceURI, attrLocalName), attrValue) ;
+ }
+ }
+
+ /**
+ * Add a child node.
+ * @param child The child node.
+ */
+ void addChild(final Node child)
+ {
+ children.add(child) ;
+ }
+
+ /**
+ * Check for equality.
+ * @param obj the object to test against.
+ */
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (obj == null)
+ {
+ return false ;
+ }
+
+ if (obj == this)
+ {
+ return true ;
+ }
+
+ if (obj instanceof Element)
+ {
+ final Element rhs = (Element)obj ;
+ return (name.equals(rhs.name) && attributes.equals(rhs.attributes) &&
+ children.equals(rhs.children)) ;
+ }
+
+ return false ;
+ }
+
+ /**
+ * The QName comparator class.
+ * @author kevin
+ */
+ private static final class QNameComparator implements Comparator<QName>
+ {
+ /**
+ * Compare the QNames.
+ * @param name1 The first QName.
+ * @param name2 The second QName.
+ * @return
+ */
+ public int compare(final QName name1, final QName name2)
+ {
+ final int uriComparator = name1.getNamespaceURI().compareTo(name2.getNamespaceURI()) ;
+ if (uriComparator != 0)
+ {
+ return uriComparator ;
+ }
+ return name1.getLocalPart().compareTo(name2.getLocalPart());
+ }
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/IdentitySAXHandler.java (from rev 29324, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/IdentitySAXHandler.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/IdentitySAXHandler.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/IdentitySAXHandler.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Simple SAX parser creating an identity document for the incoming XML.
+ * Any leading and trailing whitespace is ignored in the document as are
+ * namespace prefixes.
+ *
+ * @author Kevin Conner
+ */
+public class IdentitySAXHandler extends DefaultHandler
+{
+ /**
+ * The root element.
+ */
+ private Element rootElement ;
+ /**
+ * The current element.
+ */
+ private Element currentElement ;
+ /**
+ * The stack of working elements.
+ */
+ private List<Element> stack = new ArrayList<Element>() ;
+ /**
+ * The current text value.
+ */
+ private StringBuilder currentText = new StringBuilder() ;
+
+ @Override
+ public void startElement(final String uri, final String localName,
+ final String name, final Attributes attributes)
+ throws SAXException
+ {
+ checkText() ;
+
+ final Element element = new Element(uri, localName, attributes) ;
+ if (rootElement == null)
+ {
+ rootElement = element ;
+ }
+
+ if (currentElement != null)
+ {
+ currentElement.addChild(element) ;
+ stack.add(currentElement) ;
+ }
+ currentElement = element ;
+ }
+
+ @Override
+ public void endElement(final String uri, final String localName,
+ final String name)
+ throws SAXException
+ {
+ checkText() ;
+
+ final int lastIndex = (stack.size() - 1) ;
+ if (lastIndex < 0)
+ {
+ currentElement = null ;
+ }
+ else
+ {
+ currentElement = stack.remove(lastIndex) ;
+ }
+ }
+
+ @Override
+ public void characters(final char[] ch, final int start, final int length)
+ throws SAXException
+ {
+ currentText.append(ch, start, length) ;
+ }
+
+ private void checkText()
+ {
+ final int textLength = currentText.length() ;
+ if (textLength > 0)
+ {
+ int start = 0 ;
+ while((start < textLength) && isXMLWhitespace(currentText.charAt(start)))
+ {
+ start++ ;
+ }
+
+ int end = textLength-1 ;
+ while((end >= start) && isXMLWhitespace(currentText.charAt(end)))
+ {
+ end-- ;
+ }
+
+ if (start <= end)
+ {
+ currentElement.addChild(new Text(currentText.substring(start, end+1))) ;
+ }
+ currentText.setLength(0) ;
+ currentText.trimToSize() ;
+ }
+ }
+
+ private boolean isXMLWhitespace(final char ch)
+ {
+ return ((ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n')) ;
+ }
+
+ public Element getRootElement()
+ {
+ return rootElement ;
+ }
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Node.java (from rev 29324, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Node.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Node.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Node.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.util;
+
+/**
+ * Simple Node tagging XML nodes.
+ *
+ * @author Kevin Conner
+ */
+public interface Node
+{
+}
Copied: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Text.java (from rev 29324, labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Text.java)
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Text.java (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/Text.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.internal.soa.esb.util;
+
+
+/**
+ * Simple class representing a text element.
+ * This is used to compare XML documents.
+ *
+ * @author Kevin Conner
+ */
+public class Text implements Node
+{
+ /**
+ * The text content.
+ */
+ private final String text ;
+
+ /**
+ * Construct the text element.
+ * @param text The text value.
+ */
+ Text(final String text)
+ {
+ this.text = text ;
+ }
+
+ /**
+ * Check for equality.
+ * @param obj the object to test against.
+ */
+ @Override
+ public boolean equals(final Object obj)
+ {
+ if (obj == null)
+ {
+ return false ;
+ }
+
+ if (obj == this)
+ {
+ return true ;
+ }
+
+ if (obj instanceof Text)
+ {
+ final Text rhs = (Text)obj ;
+ return (text.equals(rhs.text)) ;
+ }
+
+ return false ;
+ }
+}
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/XMLHelper.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -33,6 +33,9 @@
import java.net.URL;
import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
@@ -50,6 +53,7 @@
import org.jboss.soa.esb.util.ClassUtil;
import org.jboss.util.StringPropertyReplacer;
import org.w3c.dom.ls.LSResourceResolver;
+import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
@@ -318,6 +322,77 @@
return false ;
}
+ /**
+ * Compare the specified contents as XML.
+ * @param content1 The first content.
+ * @param content2 The second content.
+ * @return true if equals, false otherwise.
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static boolean compareXMLContent(final InputStream content1, final InputStream content2)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ return compareXMLContent(new InputSource(content1), new InputSource(content2)) ;
+ }
+
+ /**
+ * Compare the specified contents as XML.
+ * @param content1 The first content.
+ * @param content2 The second content.
+ * @return true if equals, false otherwise.
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static boolean compareXMLContent(final String content1, final String content2)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ return compareXMLContent(new StringReader(content1), new StringReader(content2)) ;
+ }
+
+ /**
+ * Compare the specified contents as XML.
+ * @param content1 The first content.
+ * @param content2 The second content.
+ * @return true if equals, false otherwise.
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static boolean compareXMLContent(final Reader content1, final Reader content2)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ return compareXMLContent(new InputSource(content1), new InputSource(content2)) ;
+ }
+
+ /**
+ * Compare the specified contents as XML.
+ * @param content1 The first content.
+ * @param content2 The second content.
+ * @return true if equals, false otherwise.
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static boolean compareXMLContent(final InputSource content1, final InputSource content2)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ final SAXParserFactory parserFactory = SAXParserFactory.newInstance() ;
+ parserFactory.setNamespaceAware(true) ;
+
+ final SAXParser parser = parserFactory.newSAXParser() ;
+
+ final IdentitySAXHandler handler1 = new IdentitySAXHandler() ;
+ parser.parse(content1, handler1) ;
+
+ final IdentitySAXHandler handler2 = new IdentitySAXHandler() ;
+ parser.parse(content2, handler2) ;
+
+ return (handler1.getRootElement().equals(handler2.getRootElement())) ;
+ }
+
private static SchemaFactory newSchemaFactory()
{
return SchemaFactory.newInstance( "http://www.w3.org/2001/XMLSchema" );
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/webservice/ESBContractGenerator.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -54,6 +54,7 @@
import javax.wsdl.extensions.soap.SOAPOperation;
import javax.wsdl.factory.WSDLFactory;
import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
@@ -61,7 +62,7 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import org.custommonkey.xmlunit.XMLUnit;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.Service;
import org.jboss.soa.esb.dom.YADOMUtil;
@@ -177,7 +178,7 @@
return sw.toString();
}
- private static void addSchema(Types types, Element xsdElement, Set<String> schemasAdded) throws SAXException, IOException, TransformerException {
+ private static void addSchema(Types types, Element xsdElement, Set<String> schemasAdded) throws SAXException, IOException, TransformerException, ParserConfigurationException {
if (add(xsdElement, schemasAdded))
{
SchemaImpl schemaImpl = new SchemaImpl();
@@ -201,7 +202,7 @@
return ClassUtil.getResourceAsStream(resource, ESBContractGenerator.class);
}
- private static boolean add(final Element schemaElement, final Set<String> schemasAdded) throws SAXException, IOException, TransformerException
+ private static boolean add(final Element schemaElement, final Set<String> schemasAdded) throws SAXException, IOException, TransformerException, ParserConfigurationException
{
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
@@ -215,20 +216,25 @@
}
else
{
- XMLUnit.setIgnoreWhitespace(true);
+ boolean addSchema = true ;
for (String existingType : schemasAdded)
{
- if (!XMLUnit.compareXML(existingType, newType).identical())
+ if (XMLHelper.compareXMLContent(existingType, newType))
{
- return schemasAdded.add(newType);
+ addSchema = false ;
+ break ;
}
}
+ if (addSchema)
+ {
+ return schemasAdded.add(newType);
+ }
}
return false;
}
- private static Message addMessage(Definition def, Element element, String msgName, String partName, int nsSuffixCounter, Set<String> schemasAdded) throws SAXException, IOException, TransformerException {
+ private static Message addMessage(Definition def, Element element, String msgName, String partName, int nsSuffixCounter, Set<String> schemasAdded) throws SAXException, IOException, TransformerException, ParserConfigurationException {
String schemaNs = YADOMUtil
.getAttribute(element, "targetNamespace", "");
addSchema(def.getTypes(), element, schemasAdded);
@@ -251,7 +257,7 @@
private static void addFaultMessage(final List<Message> faultMessages,
Definition def, Element element, String msgName, String partName,
- int nsSuffixCounter, Set<String> schemasAdded) throws SAXException, IOException, TransformerException {
+ int nsSuffixCounter, Set<String> schemasAdded) throws SAXException, IOException, TransformerException, ParserConfigurationException {
String schemaNs = YADOMUtil
.getAttribute(element, "targetNamespace", "");
addSchema(def.getTypes(), element, schemasAdded);
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/listeners/war/WebDeploymentArchiveUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -22,41 +22,35 @@
package org.jboss.internal.soa.esb.listeners.war;
import junit.framework.TestCase;
-import freemarker.template.TemplateException;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.xml.sax.SAXException;
-import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.jboss.soa.esb.util.ClassUtil;
-import java.io.StringReader;
-import java.io.InputStreamReader;
-import java.io.IOException;
-
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class WebDeploymentArchiveUnitTest extends TestCase {
- public void test_empty() throws TemplateException, IOException, SAXException {
+ public void test_empty() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
String webXML = modelArch.getWebXML();
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("empty.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("empty.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_plain_servlet() throws TemplateException, IOException, SAXException {
+ public void test_plain_servlet() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
servlet.getUrlMappings().add("/x/*");
String webXML = modelArch.getWebXML();
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("plain_servlet.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("plain_servlet.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_plain_servlet_and_filter() throws TemplateException, IOException, SAXException {
+ public void test_plain_servlet_and_filter() throws Exception{
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
@@ -66,12 +60,11 @@
new Filter("servletXFilter", "com.acme.XServletFilter", servlet);
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("plain_servlet_and_filter.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("plain_servlet_and_filter.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_with_method_constraints_no_roles() throws TemplateException, IOException, SAXException {
+ public void test_with_method_constraints_no_roles() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
SecurityConstraints securityConstraints = new SecurityConstraints(servlet);
@@ -83,12 +76,11 @@
securityConstraints.getProtectedMethods().add("DELETE");
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_method_constraints_no_roles.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_method_constraints_no_roles.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_with_role_constraints_no_methods() throws TemplateException, IOException, SAXException {
+ public void test_with_role_constraints_no_methods() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
SecurityConstraints securityConstraints = new SecurityConstraints(servlet);
@@ -99,12 +91,11 @@
securityConstraints.getAllowedRoles().add("accountant");
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_role_constraints_no_methods.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_role_constraints_no_methods.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_with_role_constraints_no_methods_with_guarantee() throws TemplateException, IOException, SAXException {
+ public void test_with_role_constraints_no_methods_with_guarantee() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
Servlet servlet = new Servlet("servletX", "com.acme.XServlet", modelArch.getWebModel());
SecurityConstraints securityConstraints = new SecurityConstraints(servlet);
@@ -117,40 +108,35 @@
securityConstraints.setTransportGuarantee("INTEGRAL");
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_role_constraints_no_methods_with_guarantee.xml")), new StringReader(webXML));
+ String expected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_role_constraints_no_methods_with_guarantee.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expected, webXML)) ;
}
- public void test_with_authmethod() throws TemplateException, IOException, SAXException, ConfigurationException {
+ public void test_with_authmethod() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
modelArch.getWebModel().setAuthMethod("BASIC");
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authmethod_webxml.xml")), new StringReader(webXML));
+ String webExpected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_authmethod_webxml.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(webExpected, webXML)) ;
String jbossWebXML = modelArch.getJBossWebXML();
- //System.out.println(jbossWebXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authmethod_jbosswebxml.xml")), new StringReader(jbossWebXML));
+ String jbossWebExpected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_authmethod_jbosswebxml.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(jbossWebExpected, jbossWebXML)) ;
}
- public void test_with_authdomain() throws TemplateException, IOException, SAXException, ConfigurationException {
+ public void test_with_authdomain() throws Exception {
WebDeploymentArchive modelArch = new WebDeploymentArchive("testarch.esb");
modelArch.getWebModel().setAuthDomain("java:/jaas/JBossWS");
String webXML = modelArch.getWebXML();
- //System.out.println(webXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authdomain_webxml.xml")), new StringReader(webXML));
+ String webExpected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_authdomain_webxml.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(webExpected, webXML)) ;
String jbossWebXML = modelArch.getJBossWebXML();
- //System.out.println(jbossWebXML);
- XMLUnit.setIgnoreWhitespace(true);
- XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("with_authdomain_jbosswebxml.xml")), new StringReader(jbossWebXML));
+ String jbossWebExpected = StreamUtils.readStreamString(ClassUtil.getResourceAsStream("with_authdomain_jbosswebxml.xml", getClass()), "UTF-8") ;
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(jbossWebExpected, jbossWebXML)) ;
}
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/util/XMLHelperUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/util/XMLHelperUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/internal/soa/esb/util/XMLHelperUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -35,7 +35,6 @@
import junit.framework.JUnit4TestAdapter;
import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.testutils.StringUtils;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -71,7 +70,7 @@
final String expectedContents = StreamUtils.getResourceAsString("replaceSystemProperties_expected.xml", encoding) ;
- final boolean match = StringUtils.compareXMLContent(expectedContents, contents) ;
+ final boolean match = XMLHelper.compareXMLContent(expectedContents, contents) ;
assertTrue("System property replacement", match) ;
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/converters/ObjectToXStreamUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -22,21 +22,17 @@
package org.jboss.soa.esb.actions.converters;
-import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
-
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
-import org.custommonkey.xmlunit.XMLUnit;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.jboss.soa.esb.actions.ActionProcessingException;
import org.jboss.soa.esb.actions.TestBean;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
-import org.xml.sax.SAXException;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
@@ -128,7 +124,7 @@
assertTrue( xml.contains( "TomsClass xmlns=\"" + ns ));
}
- public void test_with_alias() throws ActionProcessingException, SAXException, IOException {
+ public void test_with_alias() throws Exception {
XStreamConfigBuilder builder = new XStreamConfigBuilder();
builder.alias("TomsClass", TestBean.class.getName());
ObjectToXStream objectToXStream = new ObjectToXStream(builder.build());
@@ -139,10 +135,10 @@
String expectedXml = "<TomsClass><name>Tom</name><phone>1234</phone></TomsClass>";
String actualXml = (String) message.getBody().get();
- assertXMLEqual(expectedXml, actualXml);
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expectedXml, actualXml));
}
- public void test_with_fieldAlias() throws ActionProcessingException, SAXException, IOException {
+ public void test_with_fieldAlias() throws Exception {
XStreamConfigBuilder builder = new XStreamConfigBuilder();
builder.alias("TomsClass", TestBean.class.getName());
builder.fieldAlias("firstName", TestBean.class, "name");
@@ -154,10 +150,10 @@
String expectedXml = "<TomsClass><firstName>Tom</firstName><phone>1234</phone></TomsClass>";
String actualXml = (String) message.getBody().get();
- assertXMLEqual(expectedXml, actualXml);
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expectedXml, actualXml));
}
- public void test_with_implicitCollection() throws ActionProcessingException, SAXException, IOException {
+ public void test_with_implicitCollection() throws Exception {
XStreamConfigBuilder builder = new XStreamConfigBuilder();
builder.classAlias("TomsClass");
builder.implicitCollection(TestBean.class.getName(), "addresses", "address", String.class.getName());
@@ -175,10 +171,10 @@
String expectedXml = "<TomsClass><name>Tom</name><phone>1234</phone><address>street1</address><address>street2</address></TomsClass>";
String actualXml = (String) message.getBody().get();
- assertXMLEqual(expectedXml, actualXml);
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expectedXml, actualXml));
}
- public void test_with_converter() throws ActionProcessingException, SAXException, IOException {
+ public void test_with_converter() throws Exception {
XStreamConfigBuilder builder = new XStreamConfigBuilder();
builder.classAlias("comments");
builder.incomingType(Comment.class.getName());
@@ -193,12 +189,6 @@
String expectedXml = "<comments><comment>some comment</comment></comments>";
String actualXml = (String) message.getBody().get();
- assertXMLEqual(expectedXml, actualXml);
+ assertTrue("XML comparison", XMLHelper.compareXMLContent(expectedXml, actualXml));
}
-
- public void setUp()
- {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/transformation/xslt/XsltActionUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -41,9 +41,8 @@
import junit.framework.JUnit4TestAdapter;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.custommonkey.xmlunit.XMLUnit;
import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.actions.ActionLifecycleException;
import org.jboss.soa.esb.actions.ActionProcessingException;
@@ -51,7 +50,6 @@
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -66,18 +64,13 @@
private static final String TEST_XSL_1 = PACKAGE_PATH + "/test1.xsl";
private static final String TEST_XML_1 = PACKAGE_PATH + "/example1.xml";
- @BeforeClass public static void before()
- {
- XMLUnit.setIgnoreWhitespace(true);
- }
-
@Test (expected = ConfigurationException.class)
public void shouldThrowIfNoTemplateIsConfigured() throws ConfigurationException
{
new XsltAction(new ConfigTree("xslttest"));
}
- @Test public void processXsltString() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
+ @Test public void processXsltString() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().templateFile(TEST_XSL_1).resultType(ResultType.STRING).build());
action.initialise();
@@ -88,7 +81,8 @@
message.getBody().add(xml);
Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", (String) processed.getBody().get()));
}
@Test public void extractFeatures() throws ConfigurationException, ActionProcessingException, ActionLifecycleException, SAXException, IOException
@@ -140,7 +134,7 @@
assertEquals(MockUriResolver.class.getName(), resolver.getClass().getName());
}
- @Test public void processFileSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processFileSource() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
action.initialise();
@@ -151,10 +145,10 @@
message.getBody().add(xmlFile);
final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", (String) processed.getBody().get()));
}
- @Test public void processStringSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processStringSource() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
action.initialise();
@@ -164,10 +158,10 @@
message.getBody().add(xml);
final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", (String) processed.getBody().get()));
}
- @Test public void processInputStreamSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processInputStreamSource() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
action.initialise();
@@ -177,15 +171,15 @@
message.getBody().add(inputStream);
final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", (String) processed.getBody().get()));
}
- @Test public void processReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processReaderSource() throws Exception
{
processOneReaderSource();
}
- @Test public void processMultipleReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processMultipleReaderSource() throws Exception
{
for (int i = 0; i < 100; i++)
{
@@ -193,7 +187,7 @@
}
}
- private void processOneReaderSource() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ private void processOneReaderSource() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.STRING).templateFile(TEST_XSL_1).build());
action.initialise();
@@ -204,10 +198,10 @@
message.getBody().add(streamSource);
final Message processed = action.process(message);
- XMLAssert.assertXMLEqual("<xxx/>", (String) processed.getBody().get());
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", (String) processed.getBody().get()));
}
- @Test public void processSourceResult() throws ConfigurationException, ActionLifecycleException, ActionProcessingException, SAXException, IOException
+ @Test public void processSourceResult() throws Exception
{
final XsltAction action = new XsltAction(new ConfigBuilder().resultType(ResultType.SOURCERESULT).templateFile(TEST_XSL_1).build());
action.initialise();
@@ -224,7 +218,7 @@
Object object = processed.getBody().get();
assertTrue(object instanceof StreamResult);
- XMLAssert.assertXMLEqual("<xxx/>", ((StreamResult) processed.getBody().get()).getWriter().toString());
+ assertTrue("XML Comparison", XMLHelper.compareXMLContent("<xxx/>", ((StreamResult) processed.getBody().get()).getWriter().toString()));
}
public static class MockUriResolver implements URIResolver
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/listeners/ScheduledListenerUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -29,13 +29,13 @@
import junit.framework.JUnit4TestAdapter;
import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
import org.jboss.soa.esb.schedule.SchedulingException;
import org.jboss.soa.esb.testutils.ESBConfigUtil;
-import org.jboss.soa.esb.testutils.StringUtils;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -51,7 +51,7 @@
String actualListenerConfig = configUtil.getListenerConfig("simple-schedule-listener").toXml();
String expectedListenerConfig = StreamUtils.readStreamString(getClass().getResourceAsStream("scheduled-listener-config-configtree.xml"), "UTF-8");
- assertTrue("Service configuration", StringUtils.compareXMLContent(expectedListenerConfig, actualListenerConfig));
+ assertTrue("Service configuration", XMLHelper.compareXMLContent(expectedListenerConfig, actualListenerConfig));
}
@Test
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/schedule/SchedulingUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -21,12 +21,12 @@
import junit.framework.TestCase;
import org.jboss.soa.esb.testutils.ESBConfigUtil;
-import org.jboss.soa.esb.testutils.StringUtils;
import org.jboss.soa.esb.parameters.ParamRepositoryException;
import org.jboss.soa.esb.ConfigurationException;
import org.jboss.soa.esb.mock.MockAction;
import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
import org.jboss.internal.soa.esb.util.StreamUtils;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.xml.sax.SAXException;
import java.io.UnsupportedEncodingException;
@@ -52,7 +52,7 @@
ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream("config-01.xml"));
String expected = StreamUtils.readStreamString(getClass().getResourceAsStream("expected-config-01-listener.xml"), "UTF-8");
- assertTrue("Service Config", StringUtils.compareXMLContent(expected, configUtil.getListenerConfig("simple-schedule-listener").toString()));
+ assertTrue("Service Config", XMLHelper.compareXMLContent(expected, configUtil.getListenerConfig("simple-schedule-listener").toString()));
}
public void test_simple_schedule_01() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Element.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Element.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Element.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.soa.esb.testutils;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.xml.namespace.QName;
-
-import org.xml.sax.Attributes;
-
-/**
- * Simple class representing an element.
- * This is used to compare XML documents.
- *
- * @author Kevin Conner
- */
-public class Element implements Node
-{
- /**
- * The QName comparator.
- */
- private static final Comparator<QName> QNAME_COMPARATOR = new QNameComparator() ;
-
- /**
- * The name of the element.
- */
- private final QName name ;
- /**
- * Associated attributes.
- */
- private final Map<QName, String> attributes = new TreeMap<QName, String>(QNAME_COMPARATOR) ;
- /**
- * Children.
- */
- private final List<Node> children = new ArrayList<Node>() ;
-
- /**
- * Construct the element.
- * @param namespaceURI The namespace for the element.
- * @param localName The local name of the element.
- * @param attributes The associated attributes.
- */
- Element(final String namespaceURI, final String localName, final Attributes attributes)
- {
- name = new QName(namespaceURI, localName) ;
- final int numAttributes = attributes.getLength() ;
- for(int count = 0 ; count < numAttributes ; count++)
- {
- final String attrNamespaceURI = attributes.getURI(count) ;
- final String attrLocalName = attributes.getLocalName(count) ;
- final String attrValue = attributes.getValue(count) ;
-
- this.attributes.put(new QName(attrNamespaceURI, attrLocalName), attrValue) ;
- }
- }
-
- /**
- * Add a child node.
- * @param child The child node.
- */
- void addChild(final Node child)
- {
- children.add(child) ;
- }
-
- /**
- * Check for equality.
- * @param obj the object to test against.
- */
- @Override
- public boolean equals(final Object obj)
- {
- if (obj == null)
- {
- return false ;
- }
-
- if (obj == this)
- {
- return true ;
- }
-
- if (obj instanceof Element)
- {
- final Element rhs = (Element)obj ;
- return (name.equals(rhs.name) && attributes.equals(rhs.attributes) &&
- children.equals(rhs.children)) ;
- }
-
- return false ;
- }
-
- /**
- * The QName comparator class.
- * @author kevin
- */
- private static final class QNameComparator implements Comparator<QName>
- {
- /**
- * Compare the QNames.
- * @param name1 The first QName.
- * @param name2 The second QName.
- * @return
- */
- public int compare(final QName name1, final QName name2)
- {
- final int uriComparator = name1.getNamespaceURI().compareTo(name2.getNamespaceURI()) ;
- if (uriComparator != 0)
- {
- return uriComparator ;
- }
- return name1.getLocalPart().compareTo(name2.getLocalPart());
- }
- }
-}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/IdentitySAXHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/IdentitySAXHandler.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/IdentitySAXHandler.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.soa.esb.testutils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * Simple SAX parser creating an identity document for the incoming XML.
- * Any leading and trailing whitespace is ignored in the document as are
- * namespace prefixes.
- *
- * @author Kevin Conner
- */
-public class IdentitySAXHandler extends DefaultHandler
-{
- /**
- * The root element.
- */
- private Element rootElement ;
- /**
- * The current element.
- */
- private Element currentElement ;
- /**
- * The stack of working elements.
- */
- private List<Element> stack = new ArrayList<Element>() ;
- /**
- * The current text value.
- */
- private StringBuilder currentText = new StringBuilder() ;
-
- @Override
- public void startElement(final String uri, final String localName,
- final String name, final Attributes attributes)
- throws SAXException
- {
- checkText() ;
-
- final Element element = new Element(uri, localName, attributes) ;
- if (rootElement == null)
- {
- rootElement = element ;
- }
-
- if (currentElement != null)
- {
- currentElement.addChild(element) ;
- stack.add(currentElement) ;
- }
- currentElement = element ;
- }
-
- @Override
- public void endElement(final String uri, final String localName,
- final String name)
- throws SAXException
- {
- checkText() ;
-
- final int lastIndex = (stack.size() - 1) ;
- if (lastIndex < 0)
- {
- currentElement = null ;
- }
- else
- {
- currentElement = stack.remove(lastIndex) ;
- }
- }
-
- @Override
- public void characters(final char[] ch, final int start, final int length)
- throws SAXException
- {
- currentText.append(ch, start, length) ;
- }
-
- private void checkText()
- {
- final int textLength = currentText.length() ;
- if (textLength > 0)
- {
- int start = 0 ;
- while((start < textLength) && isXMLWhitespace(currentText.charAt(start)))
- {
- start++ ;
- }
-
- int end = textLength-1 ;
- while((end >= start) && isXMLWhitespace(currentText.charAt(end)))
- {
- end-- ;
- }
-
- if (start <= end)
- {
- currentElement.addChild(new Text(currentText.substring(start, end+1))) ;
- }
- currentText.setLength(0) ;
- currentText.trimToSize() ;
- }
- }
-
- private boolean isXMLWhitespace(final char ch)
- {
- return ((ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n')) ;
- }
-
- public Element getRootElement()
- {
- return rootElement ;
- }
-}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Node.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Node.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Node.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.soa.esb.testutils;
-
-/**
- * Simple Node tagging XML nodes.
- *
- * @author Kevin Conner
- */
-public interface Node
-{
-}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/StringUtils.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/StringUtils.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/StringUtils.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -21,16 +21,6 @@
*/
package org.jboss.soa.esb.testutils;
-import java.io.IOException;
-import java.io.StringReader;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
/**
* Utility methods for string manipulation and testing.
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -77,47 +67,4 @@
return stringBuf.toString();
}
-
- /**
- * Compare the specified contents as XML.
- * @param content1 The first content.
- * @param content2 The second content.
- * @return true if equals, false otherwise.
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws IOException
- */
- public static boolean compareXMLContent(final String content1, final String content2)
- throws ParserConfigurationException, SAXException, IOException
- {
- try {
- final SAXParserFactory parserFactory = SAXParserFactory.newInstance() ;
- parserFactory.setNamespaceAware(true) ;
-
- final SAXParser parser = parserFactory.newSAXParser() ;
- final IdentitySAXHandler handler1;
- final IdentitySAXHandler handler2;
-
- try {
- handler1 = new IdentitySAXHandler() ;
- parser.parse(new InputSource(new StringReader(content1)), handler1) ;
- } catch(SAXException e) {
- System.out.println("Failed to parse content1 [" + content1 + "].");
- throw e;
- }
-
- try {
- handler2 = new IdentitySAXHandler() ;
- parser.parse(new InputSource(new StringReader(content2)), handler2) ;
- } catch(SAXException e) {
- System.out.println("Failed to parse content2 [" + content2 + "].");
- throw e;
- }
-
- return (handler1.getRootElement().equals(handler2.getRootElement())) ;
- } catch(IOException e) {
- e.printStackTrace();
- throw e;
- }
- }
}
Deleted: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Text.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Text.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/testutils/Text.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, 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.soa.esb.testutils;
-
-
-/**
- * Simple class representing a text element.
- * This is used to compare XML documents.
- *
- * @author Kevin Conner
- */
-public class Text implements Node
-{
- /**
- * The text content.
- */
- private final String text ;
-
- /**
- * Construct the text element.
- * @param text The text value.
- */
- Text(final String text)
- {
- this.text = text ;
- }
-
- /**
- * Check for equality.
- * @param obj the object to test against.
- */
- @Override
- public boolean equals(final Object obj)
- {
- if (obj == null)
- {
- return false ;
- }
-
- if (obj == this)
- {
- return true ;
- }
-
- if (obj instanceof Text)
- {
- final Text rhs = (Text)obj ;
- return (text.equals(rhs.text)) ;
- }
-
- return false ;
- }
-}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/util/BindingsTransformUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/util/BindingsTransformUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/util/BindingsTransformUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -21,10 +21,8 @@
package org.jboss.soa.esb.util;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
@@ -32,13 +30,11 @@
import junit.framework.JUnit4TestAdapter;
import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.custommonkey.xmlunit.XMLAssert;
-import org.custommonkey.xmlunit.XMLUnit;
-import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.internal.soa.esb.util.XMLHelper;
+import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
/**
* Test for processing bindings-jboss-beans.xml for AS 5.1.0.GA.
@@ -58,7 +54,6 @@
@BeforeClass
public static void setup()
{
- XMLUnit.setIgnoreWhitespace(true);
transformerFactory = TransformerFactory.newInstance();
}
@@ -66,7 +61,7 @@
* Tests JBoss AS 5.1.0.GA ServiceBindingManager configuration
*/
@Test
- public void transform_AS_5_1_0_GA() throws ConfigurationException, TransformerException, SAXException, IOException
+ public void transform_AS_5_1_0_GA() throws Exception
{
final Source bindingsXml = new StreamSource(getClass().getResourceAsStream("bindings-jboss-beans-as-5-1-0-GA.xml"));
final Source bindinsXslt = new StreamSource(getClass().getResourceAsStream("bindings-jboss-beans-as-5-1-0-GA.xslt"));
@@ -79,7 +74,7 @@
final ByteArrayInputStream bin = new ByteArrayInputStream(((ByteArrayOutputStream)streamResult.getOutputStream()).toByteArray());
final InputSource transformResult = new InputSource(bin);
- XMLAssert.assertXMLEqual(bindingsValid, transformResult);
+ Assert.assertTrue("XML Comparison", XMLHelper.compareXMLContent(bindingsValid, transformResult));
}
public static junit.framework.Test suite()
Modified: labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java
===================================================================
--- labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java 2009-09-22 07:16:15 UTC (rev 29426)
+++ labs/jbossesb/trunk/qa/junit/src/org/jboss/soa/esb/server/ebws/EBWSUnitTest.java 2009-09-22 08:09:19 UTC (rev 29427)
@@ -26,12 +26,12 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.jboss.internal.soa.esb.util.XMLHelper;
import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.couriers.FaultMessageException;
import org.jboss.soa.esb.listeners.message.MessageValidationException;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.esb.message.format.MessageFactory;
-import org.jboss.soa.esb.testutils.StringUtils;
import org.jboss.test.JBossTestCase;
/**
@@ -175,8 +175,8 @@
final String[] logs = waitForMessages(2) ;
assertNotNull("Log message", logs) ;
assertEquals("Log count", 2, logs.length) ;
- assertTrue("Request log message", StringUtils.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
- assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
+ assertTrue("Request log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
+ assertTrue("Response log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
}
private void runInvalidRequestTest(final String requestLocation, final String name)
@@ -233,8 +233,8 @@
final String[] logs = waitForMessages(2) ;
assertNotNull("Log message", logs) ;
assertEquals("Log count", 2, logs.length) ;
- assertTrue("Request log message", StringUtils.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
- assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.INVALID_RESPONSE, logs[1])) ;
+ assertTrue("Request log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
+ assertTrue("Response log message", XMLHelper.compareXMLContent(EBWSUtil.INVALID_RESPONSE, logs[1])) ;
}
private void runSoapRequestTest(final String endpoint)
@@ -248,13 +248,13 @@
httpClient.executeMethod(postMethod) ;
final String response = postMethod.getResponseBodyAsString() ;
System.out.println("Response is " + response) ;
- assertTrue("XML response", StringUtils.compareXMLContent(EBWSUtil.SOAP_RESPONSE, response)) ;
+ assertTrue("XML response", XMLHelper.compareXMLContent(EBWSUtil.SOAP_RESPONSE, response)) ;
final String[] logs = waitForMessages(2) ;
assertNotNull("Log message", logs) ;
assertEquals("Log count", 2, logs.length) ;
- assertTrue("Request log message", StringUtils.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
- assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
+ assertTrue("Request log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
+ assertTrue("Response log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[1])) ;
}
private void runSoapAddressingRequestTest(final String endpoint)
@@ -274,11 +274,11 @@
final String[] logs = waitForMessages(5) ;
assertNotNull("Log message", logs) ;
assertEquals("Log count", 5, logs.length) ;
- assertTrue("Request log message", StringUtils.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
+ assertTrue("Request log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_REQUEST, logs[0])) ;
assertEquals("WS-A Message ID", "urn:esb:1234567", logs[1]) ;
assertEquals("WS-A relates TO", "[urn:esb:r1234, urn:esb:r5678]", logs[2]) ;
assertEquals("WS-A relationship Type", "[{http://www.w3.org/2005/08/addressing}Reply, {http://www.w3.org/2005/08/addressing}test]", logs[3]) ;
- assertTrue("Response log message", StringUtils.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[4])) ;
+ assertTrue("Response log message", XMLHelper.compareXMLContent(EBWSUtil.VALID_RESPONSE, logs[4])) ;
}
/**
More information about the jboss-svn-commits
mailing list