tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject svn commit: r1608169 - in /tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors: pom.xml src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java
Date Sun, 06 Jul 2014 07:33:07 GMT
Author: andygumbrecht
Date: Sun Jul  6 07:33:07 2014
New Revision: 1608169

URL: http://svn.apache.org/r1608169
Log:
Fix format dependant test

Modified:
    tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/pom.xml
    tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java

Modified: tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/pom.xml?rev=1608169&r1=1608168&r2=1608169&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/pom.xml (original)
+++ tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/pom.xml Sun Jul  6 07:33:07
2014
@@ -56,6 +56,11 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>xmlunit</groupId>
+      <artifactId>xmlunit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>

Modified: tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java?rev=1608169&r1=1608168&r2=1608169&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java
(original)
+++ tomee/tomee/branches/tomee-1.7.x/container/openejb-jee-accessors/src/test/java/org/apache/openejb/sxc/EjbJarXmlTest.java
Sun Jul  6 07:33:07 2014
@@ -19,10 +19,16 @@ package org.apache.openejb.sxc;
 import junit.framework.TestCase;
 import org.apache.openejb.jee.EjbJar$JAXB;
 import org.apache.openejb.loader.IO;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Difference;
+import org.custommonkey.xmlunit.IgnoreTextAndAttributeValuesDifferenceListener;
+import org.custommonkey.xmlunit.XMLUnit;
 
 import java.io.ByteArrayOutputStream;
 import java.net.URL;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * @version $Revision$ $Date$
@@ -61,22 +67,28 @@ public class EjbJarXmlTest extends TestC
         marshall.stop();
 
         final String result = new String(baos.toByteArray(), "UTF-8");
-        assertEquals(expected.trim().replace("<!--\n" +
-            "  Licensed to the Apache Software Foundation (ASF) under one or more\n" +
-            "  contributor license agreements.  See the NOTICE file distributed with\n" +
-            "  this work for additional information regarding copyright ownership.\n" +
-            "  The ASF licenses this file to You under the Apache License, Version 2.0\n"
+
-            "  (the \"License\"); you may not use this file except in compliance with\n"
+
-            "  the License.  You may obtain a copy of the License at\n" +
-            "\n" +
-            "      http://www.apache.org/licenses/LICENSE-2.0\n" +
-            "\n" +
-            "  Unless required by applicable law or agreed to in writing, software\n" +
-            "  distributed under the License is distributed on an \"AS IS\" BASIS,\n" +
-            "  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+
-            "  See the License for the specific language governing permissions and\n" +
-            "  limitations under the License.\n" +
-            "-->\n", ""), result.trim());
+
+        XMLUnit.setIgnoreComments(Boolean.TRUE);
+        XMLUnit.setIgnoreWhitespace(Boolean.TRUE);
+        XMLUnit.setIgnoreAttributeOrder(Boolean.TRUE);
+        XMLUnit.setIgnoreDiffBetweenTextAndCDATA(Boolean.TRUE);
+
+        final Diff diff = new Diff(expected.trim(), result.trim());
+        final Diff myDiff = new DetailedDiff(diff);
+
+        final AtomicInteger differenceNumber = new AtomicInteger(0); // just to get an int
wrapper for the test
+        myDiff.overrideDifferenceListener(new IgnoreTextAndAttributeValuesDifferenceListener(){
+            @Override
+            public int differenceFound(final Difference difference) {
+                if (!difference.isRecoverable()) {
+                    differenceNumber.incrementAndGet();
+                    System.err.println(">>> " + difference.toString());
+                }
+                return 0;
+            }
+        });
+
+        assertTrue("Files are not identical", myDiff.identical());
         test.stop();
     }
 



Mime
View raw message