jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r325870 - /incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java
Date Mon, 17 Oct 2005 10:04:47 GMT
Author: mreutegg
Date: Mon Oct 17 03:04:41 2005
New Revision: 325870

URL: http://svn.apache.org/viewcvs?rev=325870&view=rev
Log:
- ExportDocViewTest fails when running with jdk 1.5

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java?rev=325870&r1=325869&r2=325870&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/ExportDocViewTest.java
Mon Oct 17 03:04:41 2005
@@ -576,6 +576,7 @@
     private void compareNamespaces(Element root) throws RepositoryException {
 
         Properties nameSpaces = new AttributeSeparator(root).getNsAttrs();
+        // check if all namespaces exist that were exported
         for (Enumeration e = nameSpaces.keys(); e.hasMoreElements();) {
             String prefix = (String) e.nextElement();
             String URI = nameSpaces.getProperty(prefix);
@@ -585,8 +586,18 @@
             assertEquals("Uri of prefix " + prefix + "is not exported correctly.",
                     nsr.getURI(prefix), URI);
         }
-        assertEquals("Not all namespace declarations are exported.",
-                nameSpaces.size(), nsr.getPrefixes().length - 1);
+
+        String[] registeredNamespaces = nsr.getURIs();
+        // check if all required namespaces are exported
+        for (int i = 0; i < registeredNamespaces.length; i++) {
+            String prefix = nsr.getPrefix(registeredNamespaces[i]);
+            // skip default namespace and xml namespaces
+            if (prefix.length() == 0 || prefix.startsWith("xml")) {
+                continue;
+            } else {
+                assertTrue("namespace: " + registeredNamespaces[i] + " not exported", nameSpaces.keySet().contains(prefix));
+            }
+        }
     }
 
     /**
@@ -1112,9 +1123,9 @@
 
                 if (xmlnsURI.equals(attribute.getNamespaceURI())) {
                     String localName = attribute.getLocalName();
-                    // empty prefix
+                    // ignore setting default namespace
                     if (xmlnsPrefix.equals(localName)) {
-                        localName = "";
+                        continue;
                     }
                     nsAttrs.put(localName, attribute.getValue());
                 } else {



Mime
View raw message