jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1379027 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/ oak-jcr/src/test/jav...
Date Thu, 30 Aug 2012 17:30:47 GMT
Author: mduerig
Date: Thu Aug 30 17:30:46 2012
New Revision: 1379027

URL: http://svn.apache.org/viewvc?rev=1379027&view=rev
Log:
OAK-66: JCR Node Type Management
use NodeTypeManager for type validation
FIXME: PrivilegeManagerImplTest and AbstractLuceneQueryTest depend on registration of built
in node types. This needs ultimately to be handled else where

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Thu Aug 30 17:30:46 2012
@@ -32,14 +32,12 @@ import org.apache.jackrabbit.oak.kernel.
 import org.apache.jackrabbit.oak.plugins.index.Indexer;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
 import org.apache.jackrabbit.oak.security.authentication.LoginContextProviderImpl;
-import org.apache.jackrabbit.oak.security.authorization.AccessControlContextImpl;
 import org.apache.jackrabbit.oak.spi.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeValidatorProvider;
 import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.LoginContextProvider;
-import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlContext;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -156,9 +154,6 @@ public class ContentRepositoryImpl imple
         LoginContext loginContext = loginContextProvider.getLoginContext(credentials, workspaceName);
         loginContext.login();
 
-        // TODO make configurable
-        AccessControlContext acContext = new AccessControlContextImpl();
-
-        return new ContentSessionImpl(loginContext, workspaceName, nodeStore, queryEngine,
acContext);
+        return new ContentSessionImpl(loginContext, workspaceName, nodeStore, queryEngine);
     }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentSessionImpl.java
Thu Aug 30 17:30:46 2012
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.core;
 
 import java.io.IOException;
 import java.util.Set;
+
 import javax.annotation.Nonnull;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
@@ -29,7 +30,6 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.SessionQueryEngine;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
 import org.apache.jackrabbit.oak.query.SessionQueryEngineImpl;
-import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlContext;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,11 +47,9 @@ class ContentSessionImpl implements Cont
     private final SessionQueryEngine queryEngine;
 
     public ContentSessionImpl(LoginContext loginContext, String workspaceName,
-                              NodeStore store, QueryEngineImpl queryEngine,
-                              AccessControlContext accessControlContext) {
+                              NodeStore store, QueryEngineImpl queryEngine) {
 
         assert queryEngine != null;
-
         this.loginContext = loginContext;
         this.workspaceName = workspaceName;
         this.store = store;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
Thu Aug 30 17:30:46 2012
@@ -50,6 +50,14 @@ import org.apache.jackrabbit.oak.core.De
 import org.apache.jackrabbit.oak.namepath.NameMapper;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_AVAILABLE_QUERY_OPERATORS;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_IS_ABSTRACT;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_IS_FULLTEXT_SEARCHABLE;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_IS_QUERYABLE;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_IS_QUERY_ORDERABLE;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.JCR_NODE_TYPES;
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.NODE_TYPES_PATH;
+
 public class NodeTypeManagerImpl extends AbstractNodeTypeManager {
 
     private final ContentSession session;
@@ -100,10 +108,10 @@ public class NodeTypeManagerImpl extends
                                     withBase[0] = JcrConstants.NT_BASE;
                                     System.arraycopy(supertypes, 0, withBase, 1, supertypes.length);
                                     template.setDeclaredSuperTypeNames(withBase);
-                                }
                             }
                         }
                     }
+                    }
                     registerNodeTypes(templates.values().toArray(
                             new NodeTypeTemplate[templates.size()]), true);
                 } finally {
@@ -118,7 +126,7 @@ public class NodeTypeManagerImpl extends
 
     @Override
     protected Tree getTypes() {
-        return session.getCurrentRoot().getTree(NodeTypeConstants.NODE_TYPES_PATH);
+        return session.getCurrentRoot().getTree(NODE_TYPES_PATH);
     }
 
     @Override
@@ -191,8 +199,8 @@ public class NodeTypeManagerImpl extends
         node.setName(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_NODETYPE);
         node.setName(JcrConstants.JCR_NODETYPENAME, jcrName);
         node.setNames(JcrConstants.JCR_SUPERTYPES, ntd.getDeclaredSupertypeNames());
-        node.setBoolean(NodeTypeConstants.JCR_IS_ABSTRACT, ntd.isAbstract());
-        node.setBoolean(NodeTypeConstants.JCR_IS_QUERYABLE, ntd.isQueryable());
+        node.setBoolean(JCR_IS_ABSTRACT, ntd.isAbstract());
+        node.setBoolean(JCR_IS_QUERYABLE, ntd.isQueryable());
         node.setBoolean(JcrConstants.JCR_ISMIXIN, ntd.isMixin());
         node.setBoolean(JcrConstants.JCR_HASORDERABLECHILDNODES, ntd.hasOrderableChildNodes());
         String primaryItemName = ntd.getPrimaryItemName();
@@ -237,9 +245,9 @@ public class NodeTypeManagerImpl extends
                 JcrConstants.JCR_REQUIREDTYPE,
                 PropertyType.nameFromValue(def.getRequiredType()));
         node.setBoolean(JcrConstants.JCR_MULTIPLE, def.isMultiple());
-        node.setBoolean(NodeTypeConstants.JCR_IS_FULLTEXT_SEARCHABLE, def.isFullTextSearchable());
-        node.setBoolean(NodeTypeConstants.JCR_IS_QUERY_ORDERABLE, def.isQueryOrderable());
-        node.setStrings(NodeTypeConstants.JCR_AVAILABLE_QUERY_OPERATORS, def.getAvailableQueryOperators());
+        node.setBoolean(JCR_IS_FULLTEXT_SEARCHABLE, def.isFullTextSearchable());
+        node.setBoolean(JCR_IS_QUERY_ORDERABLE, def.isQueryOrderable());
+        node.setStrings(JCR_AVAILABLE_QUERY_OPERATORS, def.getAvailableQueryOperators());
 
         String[] constraints = def.getValueConstraints();
         if (constraints != null) {
@@ -266,20 +274,20 @@ public class NodeTypeManagerImpl extends
     }
 
     private static Tree getOrCreateNodeTypes(Root root) {
-        Tree types = root.getTree(NodeTypeConstants.NODE_TYPES_PATH);
+        Tree types = root.getTree(NODE_TYPES_PATH);
         if (types == null) {
             Tree system = root.getTree('/' + JcrConstants.JCR_SYSTEM);
             if (system == null) {
                 system = root.getTree("/").addChild(JcrConstants.JCR_SYSTEM);
             }
-            types = system.addChild(NodeTypeConstants.JCR_NODE_TYPES);
+            types = system.addChild(JCR_NODE_TYPES);
         }
         return types;
     }
 
     private boolean nodeTypesInContent() {
         Root currentRoot = session.getCurrentRoot();
-        Tree types = currentRoot.getTree(NodeTypeConstants.NODE_TYPES_PATH);
+        Tree types = currentRoot.getTree(NODE_TYPES_PATH);
         return types != null && types.getChildrenCount() > 0;
     }
 
@@ -287,7 +295,7 @@ public class NodeTypeManagerImpl extends
     public void unregisterNodeType(String name) throws RepositoryException {
         Tree type = null;
         Root root = session.getCurrentRoot();
-        Tree types = root.getTree(NodeTypeConstants.NODE_TYPES_PATH);
+        Tree types = root.getTree(NODE_TYPES_PATH);
         if (types != null) {
             type = types.getChild(getOakName(name));
         }
@@ -307,7 +315,7 @@ public class NodeTypeManagerImpl extends
     @Override
     public void unregisterNodeTypes(String[] names) throws RepositoryException {
         Root root = session.getCurrentRoot();
-        Tree types = root.getTree(NodeTypeConstants.NODE_TYPES_PATH);
+        Tree types = root.getTree(NODE_TYPES_PATH);
         if (types == null) {
             throw new NoSuchNodeTypeException("Node types can not be unregistered.");
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidator.java
Thu Aug 30 17:30:46 2012
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
-import java.util.Set;
-
-import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.RepositoryException;
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -28,24 +28,25 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 class TypeValidator implements Validator {
+    private final NodeTypeManager ntm;
 
-    private final Set<String> types;
-
-    public TypeValidator(Set<String> types) {
-        this.types = types;
+    public TypeValidator(NodeTypeManager ntm) {
+        this.ntm = ntm;
     }
 
-    private void checkTypeExists(PropertyState after)
-            throws CommitFailedException {
-        if (JcrConstants.JCR_PRIMARYTYPE.equals(after.getName())
-                || JcrConstants.JCR_MIXINTYPES.equals(after.getName())) {
-            for (CoreValue cv : after.getValues()) {
-                String value = cv.getString();
-                if (!types.contains(value)) {
-                    throw new CommitFailedException(
-                        new NoSuchNodeTypeException("Unknown node type: " + value));
+    private void checkTypeExists(PropertyState after) throws CommitFailedException {
+        if (JcrConstants.JCR_PRIMARYTYPE.equals(after.getName()) || JcrConstants.JCR_MIXINTYPES.equals(after.getName()))
{
+            try {
+                for (CoreValue cv : after.getValues()) {
+                    String ntName = cv.getString();
+                    NodeType nt = ntm.getNodeType(ntName);
+                    if (nt.isAbstract()) {
+                        throw new CommitFailedException("Can't create node with abstract
type: " + ntName);
+                    }
                 }
-                // TODO: make sure the specified node type isn't abstract
+            }
+            catch (RepositoryException e) {
+                throw new CommitFailedException(e);
             }
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/TypeValidatorProvider.java
Thu Aug 30 17:30:46 2012
@@ -16,100 +16,44 @@
  */
 package org.apache.jackrabbit.oak.plugins.type;
 
-import java.util.HashSet;
-import java.util.Set;
-
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.jackrabbit.oak.security.privilege.PrivilegeConstants;
+import org.apache.jackrabbit.oak.api.Tree;
+import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.core.ReadOnlyTree;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
-import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
+import static org.apache.jackrabbit.oak.plugins.type.NodeTypeConstants.NODE_TYPES_PATH;
+
 @Component
 @Service(ValidatorProvider.class)
-public class TypeValidatorProvider implements ValidatorProvider, NodeTypeConstants {
+public class TypeValidatorProvider implements ValidatorProvider {
 
     @Override
-    public Validator getRootValidator(NodeState before, NodeState after) {
-        Set<String> types = new HashSet<String>();
+    public Validator getRootValidator(NodeState before, final NodeState after) {
+        return new TypeValidator(new AbstractNodeTypeManager() {
+            private final Tree types = getTypes(after);
+
+            @Override
+            protected Tree getTypes() {
+                return types;
+            }
 
-        // Default JCR types are always available
-        types.add("nt:base");
-        types.add("nt:hierarchyNode");
-        types.add("nt:file");
-        types.add("nt:linkedFile");
-        types.add("nt:folder");
-        types.add("nt:resource");
-        types.add("mix:title");
-        types.add("mix:created");
-        types.add("mix:lastModified");
-        types.add("mix:language");
-        types.add("mix:mimeType");
-        types.add("nt:address");
-        types.add("mix:etag");
-        types.add("nt:unstructured");
-        types.add("mix:referenceable");
-        types.add("mix:lockable");
-        types.add("mix:shareable");
-        types.add("mix:simpleVersionable");
-        types.add("mix:versionable");
-        types.add("nt:versionHistory");
-        types.add("nt:versionLabels");
-        types.add("nt:version");
-        types.add("nt:frozenNode");
-        types.add("nt:versionedChild");
-        types.add("nt:activity");
-        types.add("nt:configuration");
-        types.add("nt:nodeType");
-        types.add("nt:propertyDefinition");
-        types.add("nt:childNodeDefinition");
-        types.add("nt:query");
-        types.add("mix:lifecycle");
-
-        // Jackrabbit 2.x types are always available
-        types.add("rep:root");
-        types.add("rep:system");
-        types.add("rep:nodeTypes");
-        types.add("rep:versionStorage");
-        types.add("rep:Activities");
-        types.add("rep:Configurations");
-        types.add("rep:VersionReference");
-        types.add("rep:AccessControllable");
-        types.add("rep:RepoAccessControllable");
-        types.add("rep:Policy");
-        types.add("rep:ACL");
-        types.add("rep:ACE");
-        types.add("rep:GrantACE");
-        types.add("rep:DenyACE");
-        types.add("rep:AccessControl");
-        types.add("rep:PrincipalAccessControl");
-        types.add("rep:Authorizable");
-        types.add("rep:Impersonatable");
-        types.add("rep:User");
-        types.add("rep:Group");
-        types.add("rep:AuthorizableFolder");
-        types.add("rep:Members");
-        types.add("rep:RetentionManageable");
-
-        // Oak types are always available
-        types.add(MIX_REP_MERGE_CONFLICT);
-        types.add(PrivilegeConstants.NT_REP_PRIVILEGES);
-        types.add(PrivilegeConstants.NT_REP_PRIVILEGE);
-
-        // Find any extra types from /jcr:system/jcr:nodeTypes
-        NodeState system = after.getChildNode(JCR_SYSTEM);
-        if (system != null) {
-            NodeState registry = system.getChildNode(JCR_NODE_TYPES);
-            if (registry != null) {
-                for (ChildNodeEntry child : registry.getChildNodeEntries()) {
-                    types.add(child.getName());
+            private Tree getTypes(NodeState after) {
+                Tree tree = new ReadOnlyTree(after);
+                for (String name : PathUtils.elements(NODE_TYPES_PATH)) {
+                    if (tree == null) {
+                        break;
+                    }
+                    else {
+                        tree = tree.getChild(name);
+                    }
                 }
+                return tree;
             }
-        }
-
-        return new TypeValidator(types);
+        });
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/lucene/AbstractLuceneQueryTest.java
Thu Aug 30 17:30:46 2012
@@ -33,10 +33,12 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
 import org.apache.jackrabbit.oak.core.DefaultConflictHandler;
+import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
 import org.apache.jackrabbit.oak.plugins.index.PropertyIndexFactory;
 import org.apache.jackrabbit.oak.plugins.name.NameValidatorProvider;
 import org.apache.jackrabbit.oak.plugins.name.NamespaceValidatorProvider;
 import org.apache.jackrabbit.oak.plugins.type.DefaultTypeEditor;
+import org.apache.jackrabbit.oak.plugins.type.NodeTypeManagerImpl;
 import org.apache.jackrabbit.oak.plugins.type.TypeValidatorProvider;
 import org.apache.jackrabbit.oak.plugins.value.ConflictValidatorProvider;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
@@ -73,6 +75,8 @@ public abstract class AbstractLuceneQuer
     public void before() throws Exception {
         super.before();
         session = createAdminSession();
+        // FIXME workaround to ensure built in node types are registered
+        new NodeTypeManagerImpl(session, NamePathMapperImpl.DEFAULT, null);
         root = session.getCurrentRoot();
         vf = session.getCoreValueFactory();
         qe = session.getQueryEngine();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java?rev=1379027&r1=1379026&r2=1379027&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/PrivilegeManagerImplTest.java
Thu Aug 30 17:30:46 2012
@@ -16,12 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr.security.privilege;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -50,6 +44,12 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 /**
  * PrivilegeManagerTest...
  *
@@ -79,6 +79,8 @@ public class PrivilegeManagerImplTest im
     private PrivilegeManager getPrivilegeManager(Credentials credentials)
             throws RepositoryException {
         Workspace workspace = repository.login(credentials).getWorkspace();
+        // FIXME workaround to ensure built in node types are registered
+        workspace.getNodeTypeManager();
         return ((JackrabbitWorkspace) workspace).getPrivilegeManager();
     }
 



Mime
View raw message