jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r409520 - /jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
Date Fri, 26 May 2006 00:31:29 GMT
Author: jukka
Date: Thu May 25 17:31:28 2006
New Revision: 409520

URL: http://svn.apache.org/viewvc?rev=409520&view=rev
Log:
1.0: Merged revision 391041: JCR-285

Modified:
    jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java

Modified: jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java?rev=409520&r1=409519&r2=409520&view=diff
==============================================================================
--- jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
(original)
+++ jackrabbit/branches/1.0/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
Thu May 25 17:31:28 2006
@@ -220,10 +220,13 @@
             }
 
             NodeType type = manager.getNodeType(name);
-            assertEquals(
-                    "Predefined node type " + name,
-                    spec.toString(),
-                    getNodeTypeSpec(type));
+            String current = getNodeTypeSpec(type);
+            if (!System.getProperty("line.separator").equals("\n")) {
+                current = normalizeLineSeparators(current);
+            }
+            String expected = normalizeLineSeparators(spec.toString());
+
+            assertEquals("Predefined node type " + name, expected, current);
         } catch (IOException e) {
             fail(e.getMessage());
         } catch (NoSuchNodeTypeException e) {
@@ -382,6 +385,22 @@
         writer.println("  Multiple " + property.isMultiple());
 
         return buffer.toString();
+    }
+
+    /**
+     * Replaces platform-dependant line-separators in <code>stringValue</code>
+     * with "\n".
+     *
+     * @param stringValue string to normalize
+     * @return the normalized string
+     */
+    private String normalizeLineSeparators(String stringValue) {
+        // Replace "\r\n" (Windows format) with "\n" (Unix format)
+        stringValue = stringValue.replaceAll("\r\n", "\n");
+        // Replace "\r" (Mac format) with "\n" (Unix format)
+        stringValue = stringValue.replaceAll("\r", "\n");
+
+        return stringValue;
     }
 
     /**



Mime
View raw message