incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r985840 - in /incubator/hise/trunk/hise-services: pom.xml src/test/java/org/apache/hise/TaskEvaluatorTest.java src/test/java/org/apache/hise/TaskTest.java
Date Mon, 16 Aug 2010 09:34:48 GMT
Author: rr
Date: Mon Aug 16 09:34:47 2010
New Revision: 985840

URL: http://svn.apache.org/viewvc?rev=985840&view=rev
Log:
HISE-76: Evaluating EPR from soap header fails when wsa prefix is not declared (tests thanks
to Piotr Zagórski)

Modified:
    incubator/hise/trunk/hise-services/pom.xml
    incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
    incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java

Modified: incubator/hise/trunk/hise-services/pom.xml
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/pom.xml?rev=985840&r1=985839&r2=985840&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/pom.xml (original)
+++ incubator/hise/trunk/hise-services/pom.xml Mon Aug 16 09:34:47 2010
@@ -293,5 +293,11 @@
             <version>${log4j.version}</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>xmlunit</groupId>
+            <artifactId>xmlunit</artifactId>
+            <version>1.3</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java?rev=985840&r1=985839&r2=985840&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
(original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskEvaluatorTest.java
Mon Aug 16 09:34:47 2010
@@ -17,7 +17,10 @@ import org.apache.hise.runtime.TaskEvalu
 import org.apache.hise.utils.DOMUtils;
 import org.apache.hise.utils.XQueryEvaluator;
 import org.apache.xmlbeans.XmlString;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Test;
+import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 public class TaskEvaluatorTest {
@@ -132,8 +135,11 @@ public class TaskEvaluatorTest {
     public void testEvalOutcome2() throws Exception {
         System.out.println("testEvalOutcome2");
         XQueryEvaluator e = buildTaskEvaluator().buildQueryEvaluator(null);
-        Object r = DOMUtils.domToString((Node) e.evaluateExpression(IOUtils.toString(getClass().getResourceAsStream("/outcome2.xml")),
null).get(0));
-        Assert.assertTrue(r.toString().contains("<firstname>text1</firstname><lastname>text1</lastname><taskId>1234</taskId>"));
+        Node ne = (Node) e.evaluateExpression(IOUtils.toString(getClass().getResourceAsStream("/outcome2.xml")),
null).get(0);
+        Document d = DOMUtils.parse("<?xml version='1.0' encoding='UTF-8'?><cla:notify
xmlns:cla='http://www.insurance.example.com/claims' xmlns:htd='http://www.example.org/WS-HT'><firstname
xmlns=''>text1</firstname><lastname xmlns=''>text1</lastname><taskId
xmlns=''>1234</taskId></cla:notify>");
+        Diff diff = XMLUnit.compareXML(d, ne.getOwnerDocument());
+        Assert.assertTrue(diff.similar());
+
         System.out.println("~testEvalOutcome2");
     }
 }

Modified: incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java?rev=985840&r1=985839&r2=985840&view=diff
==============================================================================
--- incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java (original)
+++ incubator/hise/trunk/hise-services/src/test/java/org/apache/hise/TaskTest.java Mon Aug
16 09:34:47 2010
@@ -5,7 +5,11 @@ import junit.framework.Assert;
 import org.apache.hise.runtime.Task;
 import org.apache.hise.runtime.TaskEvaluator;
 import org.apache.hise.utils.DOMUtils;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
 
 public class TaskTest {
     @Test
@@ -16,8 +20,9 @@ public class TaskTest {
         t.setTaskDto(t2);
 
         TaskEvaluator e = new TaskEvaluator(t);
-        String r = DOMUtils.domToString(e.createEprFromHeader(DOMUtils.parse(getClass().getResourceAsStream("/epr.xml")).getDocumentElement()));
-        System.out.println(r);
-        Assert.assertTrue(r.contains("<wsa:EndpointReference xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><wsa:Address
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">http://localhost:8082/ClaimsResponseService/</wsa:Address></wsa:EndpointReference>"));
+        Node epr = e.createEprFromHeader(DOMUtils.parse(getClass().getResourceAsStream("/epr.xml")).getDocumentElement());
+        Document comp = DOMUtils.parse("<wsa:EndpointReference xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"><wsa:Address
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">http://localhost:8082/ClaimsResponseService/</wsa:Address></wsa:EndpointReference>");
+        Diff diff = XMLUnit.compareXML(comp, epr.getOwnerDocument());
+        Assert.assertTrue(diff.similar());
     }
 }



Mime
View raw message