jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r155774 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
Date Tue, 01 Mar 2005 13:25:56 GMT
Author: mreutegg
Date: Tue Mar  1 05:25:54 2005
New Revision: 155774

URL: http://svn.apache.org/viewcvs?view=rev&rev=155774
Log:
Enhance NamespaceRemappingTest.

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

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java?view=diff&r1=155773&r2=155774
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/NamespaceRemappingTest.java
Tue Mar  1 05:25:54 2005
@@ -22,6 +22,8 @@
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
 import javax.jcr.NamespaceException;
+import javax.jcr.Property;
+import javax.jcr.nodetype.NodeType;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Arrays;
@@ -71,12 +73,25 @@
      * returns the property with the correct primaryType value.
      */
     public void testNamespaceRemapping() throws RepositoryException {
+        Property primaryTypeProp = session.getRootNode().getProperty(jcrPrimaryType);
+        NodeType ntBaseType = session.getWorkspace().getNodeTypeManager().getNodeType(ntBase);
+
         // find an unused prefix
-        String testPrefix = getUnusedPrefix();
+        String jcrPrefix = getUnusedPrefix();
         // remap jcr prefix
-        session.setNamespacePrefix(testPrefix, NS_JCR_URI);
+        session.setNamespacePrefix(jcrPrefix, NS_JCR_URI);
+        // find an unused prefix
+        String ntPrefix = getUnusedPrefix();
+        // remap nt prefix
+        session.setNamespacePrefix(ntPrefix, NS_NT_URI);
+
+        assertTrue("Unable to retrieve property with new namespace prefix.",
+                session.getRootNode().getProperty(jcrPrefix + ":primaryType").isSame(primaryTypeProp));
+
+        assertEquals("NodeType name does not use new namespace prefix.",
+                ntBaseType.getName(), ntPrefix + ":base");
 
-        String propval = session.getRootNode().getProperty(testPrefix + ":primaryType").getString();
+        String propval = session.getRootNode().getProperty(jcrPrefix + ":primaryType").getString();
         String primaryType = session.getRootNode().getPrimaryNodeType().getName();
         assertEquals("Remapping of jcr prefix failed", primaryType, propval);
     }
@@ -165,7 +180,7 @@
      */
     private String getUnusedPrefix() throws RepositoryException {
         Set prefixes = new HashSet();
-        prefixes.addAll(Arrays.asList(nsr.getPrefixes()));
+        prefixes.addAll(Arrays.asList(session.getNamespacePrefixes()));
         String prefix = "myapp";
         int count = 0;
         while (prefixes.contains(prefix + count)) {



Mime
View raw message