jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1478109 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/security/authorization/permission/ test/java/org/apache/jackrabbit/oak/core/ test/java/org/apache/jackrabbit/oak/plugins/identifier/ test/java/org/apache/...
Date Wed, 01 May 2013 17:42:20 GMT
Author: mduerig
Date: Wed May  1 17:42:19 2013
New Revision: 1478109

URL: http://svn.apache.org/r1478109
Log:
OAK-798: Review / refactor TreeImpl and related classes
reduce usage of deprecated methods: replace Root.getTreeOrNull with Root.getTree in tests

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImpl.java Wed May  1 17:42:19 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.permission;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.security.Principal;
 import java.security.acl.Group;
 import java.util.Collections;
@@ -24,6 +27,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -50,9 +54,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.util.TreeUtil;
 import org.apache.jackrabbit.util.Text;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
 /**
  * TODO: WIP
  */
@@ -165,8 +166,8 @@ class CompiledPermissionImpl implements 
         return permissionsTree.getChildOrNull(Text.escapeIllegalJcrChars(principal.getName()));
     }
 
-    private void buildEntries(@Nullable ImmutableTree permissionsTree) {
-        if (permissionsTree == null) {
+    private void buildEntries(@Nonnull ImmutableTree permissionsTree) {
+        if (!permissionsTree.exists()) {
             repoEntries = Collections.emptyMap();
             userEntries = Collections.emptyMap();
             groupEntries = Collections.emptyMap();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/ImmutableRootTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
 import org.apache.jackrabbit.oak.OakBaseTest;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.ContentSession;
@@ -24,9 +27,6 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
 public class ImmutableRootTest extends OakBaseTest {
 
     private ImmutableRoot root;
@@ -37,7 +37,7 @@ public class ImmutableRootTest extends O
 
         // Add test content
         Root root = session.getLatestRoot();
-        Tree tree = root.getTreeOrNull("/");
+        Tree tree = root.getTree("/");
         Tree x = tree.addChild("x");
         Tree y = x.addChild("y");
         Tree z = y.addChild("z");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/identifier/IdentifierManagerTest.java Wed May  1 17:42:19 2013
@@ -18,6 +18,10 @@
  */
 package org.apache.jackrabbit.oak.plugins.identifier;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -32,10 +36,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
 public class IdentifierManagerTest {
     private static final String UUID_Y = IdentifierManager.generateUUID();
     private static final String UUID_Z1 = IdentifierManager.generateUUID();
@@ -59,7 +59,7 @@ public class IdentifierManagerTest {
             .with(new InitialContent())
             .createContentSession().getLatestRoot();
 
-        Tree tree = root.getTreeOrNull("/");
+        Tree tree = root.getTree("/");
         Tree x = tree.addChild("x");
         Tree y = tree.addChild("y");
         y.setProperty(JcrConstants.JCR_UUID, UUID_Y);
@@ -74,16 +74,16 @@ public class IdentifierManagerTest {
 
     @Test
     public void getIdentifierTest() {
-        Tree rootTree = root.getTreeOrNull("/");
+        Tree rootTree = root.getTree("/");
         assertEquals(ID_ROOT, identifierManager.getIdentifier(rootTree));
 
-        Tree xx1 = root.getTreeOrNull(PATH_X1);
+        Tree xx1 = root.getTree(PATH_X1);
         assertEquals(ID_X1, identifierManager.getIdentifier(xx1));
 
-        Tree yy1 = root.getTreeOrNull(PATH_Y1);
+        Tree yy1 = root.getTree(PATH_Y1);
         assertEquals(ID_Y1, identifierManager.getIdentifier(yy1));
 
-        Tree zz1 = root.getTreeOrNull(PATH_Z1);
+        Tree zz1 = root.getTree(PATH_Z1);
         assertEquals(ID_Z1, identifierManager.getIdentifier(zz1));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/RelativePathTest.java Wed May  1 17:42:19 2013
@@ -16,10 +16,14 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.property;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import javax.jcr.query.Query;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.Tree;
@@ -32,11 +36,6 @@ import org.apache.jackrabbit.oak.spi.sta
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.junit.Test;
 
-import com.google.common.collect.ImmutableList;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
 /**
  * <code>RelativePathTest</code>...
  */
@@ -63,7 +62,7 @@ public class RelativePathTest extends Ab
 
     @Test
     public void query() throws Exception {
-        Tree t = root.getTreeOrNull("/");
+        Tree t = root.getTree("/");
         t.addChild("a").addChild("n").setProperty("myProp", "foo");
         t.addChild("b").addChild("n").setProperty("myProp", "bar");
         t.addChild("c").addChild("x").setProperty("myProp", "foo");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamespaceRegistryTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,8 @@
 */
 package org.apache.jackrabbit.oak.plugins.name;
 
+import static org.junit.Assert.assertEquals;
+
 import javax.jcr.NamespaceRegistry;
 
 import org.apache.jackrabbit.oak.OakBaseTest;
@@ -24,8 +26,6 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-
 public class ReadWriteNamespaceRegistryTest extends OakBaseTest {
 
     @Test
@@ -34,7 +34,7 @@ public class ReadWriteNamespaceRegistryT
         NamespaceRegistry r = new ReadWriteNamespaceRegistry() {
             @Override
             protected Tree getReadTree() {
-                return session.getLatestRoot().getTreeOrNull("/");
+                return session.getLatestRoot().getTree("/");
             }
             @Override
             protected Root getWriteRoot() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java Wed May  1 17:42:19 2013
@@ -80,7 +80,7 @@ public abstract class AbstractQueryTest 
      * {@link #createTestIndexNode(Tree, String)} for a helper method
      */
     protected void createTestIndexNode() throws Exception {
-        Tree index = root.getTreeOrNull("/");
+        Tree index = root.getTree("/");
         createTestIndexNode(index, "unknown");
         root.commit();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/JsopUtil.java Wed May  1 17:42:19 2013
@@ -68,8 +68,8 @@ public class JsopUtil {
             throws UnsupportedOperationException {
         int index = commit.indexOf(' ');
         String path = commit.substring(0, index).trim();
-        Tree c = root.getTreeOrNull(path);
-        if (c == null) {
+        Tree c = root.getTree(path);
+        if (!c.exists()) {
             // TODO create intermediary?
             throw new UnsupportedOperationException("Non existing path " + path);
         }
@@ -92,7 +92,7 @@ public class JsopUtil {
             if (!t.hasChild(p)) {
                 return;
             }
-            t = t.getChildOrNull(p);
+            t = t.getChild(p);
         }
         t.remove();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImplTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,12 @@
  */
 package org.apache.jackrabbit.oak.security.authentication.token;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Date;
@@ -23,6 +29,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
+
 import javax.annotation.Nonnull;
 import javax.jcr.Credentials;
 import javax.jcr.GuestCredentials;
@@ -37,12 +44,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * TokenProviderImplTest...
  */
@@ -140,9 +141,9 @@ public class TokenProviderImplTest exten
 
         TokenInfo info = tokenProvider.createToken(userId, attributes);
 
-        Tree userTree = root.getTreeOrNull(getUserManager().getAuthorizable(userId).getPath());
-        Tree tokens = userTree.getChildOrNull(".tokens");
-        assertNotNull(tokens);
+        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
+        Tree tokens = userTree.getChild(".tokens");
+        assertTrue(tokens.exists());
         assertEquals(1, tokens.getChildrenCount());
 
         Tree tokenNode = tokens.getChildren().iterator().next();
@@ -211,12 +212,12 @@ public class TokenProviderImplTest exten
     public void testRemoveTokenRemovesNode() throws Exception {
         TokenInfo info = tokenProvider.createToken(userId, Collections.<String, Object>emptyMap());
 
-        Tree userTree = root.getTreeOrNull(getUserManager().getAuthorizable(userId).getPath());
-        Tree tokens = userTree.getChildOrNull(".tokens");
+        Tree userTree = root.getTree(getUserManager().getAuthorizable(userId).getPath());
+        Tree tokens = userTree.getChild(".tokens");
         String tokenNodePath = tokens.getChildren().iterator().next().getPath();
 
         tokenProvider.removeToken(info);
-        assertNull(root.getTreeOrNull(tokenNodePath));
+        assertTrue(root.getTree(tokenNodePath).exists());
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.oak.security.authentication.user;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
 import javax.jcr.GuestCredentials;
 import javax.jcr.SimpleCredentials;
 import javax.security.auth.login.Configuration;
@@ -34,11 +39,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
 /**
  * LoginTest...
  */
@@ -85,7 +85,7 @@ public class LoginModuleImplTest extends
         // verify initial user-content looks like expected
         Authorizable anonymous = userMgr.getAuthorizable(anonymousID);
         assertNotNull(anonymous);
-        assertFalse(root.getTreeOrNull(anonymous.getPath()).hasProperty(UserConstants.REP_PASSWORD));
+        assertFalse(root.getTree(anonymous.getPath()).hasProperty(UserConstants.REP_PASSWORD));
 
         ContentSession cs = null;
         try {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlManagerImplTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,14 @@
  */
 package org.apache.jackrabbit.oak.security.authorization;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -26,6 +34,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.jcr.AccessDeniedException;
@@ -59,27 +68,19 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.namepath.NamePathMapperImpl;
 import org.apache.jackrabbit.oak.plugins.name.Namespaces;
 import org.apache.jackrabbit.oak.plugins.value.ValueFactoryImpl;
-import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBitsProvider;
-import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.spi.security.authorization.AbstractAccessControlTest;
 import org.apache.jackrabbit.oak.spi.security.authorization.TestACL;
 import org.apache.jackrabbit.oak.spi.security.authorization.restriction.RestrictionProvider;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
+import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
+import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.oak.util.TreeUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * Tests for the default {@code AccessControlManager} implementation.
  */
@@ -104,13 +105,13 @@ public class AccessControlManagerImplTes
         super.before();
 
         registerNamespace(TestNameMapper.TEST_PREFIX, TestNameMapper.TEST_URI);
-        nameMapper = new TestNameMapper(Namespaces.getNamespaceMap(root.getTreeOrNull("/")));
+        nameMapper = new TestNameMapper(Namespaces.getNamespaceMap(root.getTree("/")));
         npMapper = new NamePathMapperImpl(nameMapper);
 
         acMgr = getAccessControlManager(npMapper);
         valueFactory = new ValueFactoryImpl(root.getBlobFactory(), npMapper);
 
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"), npMapper);
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"), npMapper);
         rootNode.addChild(testName, JcrConstants.NT_UNSTRUCTURED);
         root.commit();
 
@@ -122,7 +123,7 @@ public class AccessControlManagerImplTes
     public void after() throws Exception {
         try {
             root.refresh();
-            root.getTreeOrNull(testPath).remove();
+            root.getTree(testPath).remove();
             root.commit();
 
             if (testRoot != null) {
@@ -227,8 +228,8 @@ public class AccessControlManagerImplTes
         acMgr.setPolicy(testPath, policy);
 
         String aclPath = testPath + '/' + REP_POLICY;
-        Tree acl = root.getTreeOrNull(aclPath);
-        assertNotNull(acl);
+        Tree acl = root.getTree(aclPath);
+        assertTrue(acl.exists());
         Iterator<Tree> aces = acl.getChildren().iterator();
         assertTrue(aces.hasNext());
         Tree ace = aces.next();
@@ -238,8 +239,8 @@ public class AccessControlManagerImplTes
         acContentPath.add(aclPath);
         acContentPath.add(ace.getPath());
 
-        Tree rest = ace.getChildOrNull(REP_RESTRICTIONS);
-        if (rest != null) {
+        Tree rest = ace.getChild(REP_RESTRICTIONS);
+        if (rest.exists()) {
             acContentPath.add(rest.getPath());
         }
         return acContentPath;
@@ -716,7 +717,7 @@ public class AccessControlManagerImplTes
 
     @Test
     public void testGetApplicablePoliciesOnAccessControllable() throws Exception {
-        NodeUtil node = new NodeUtil(root.getTreeOrNull(testPath));
+        NodeUtil node = new NodeUtil(root.getTree(testPath));
         node.setNames(JcrConstants.JCR_MIXINTYPES, MIX_REP_ACCESS_CONTROLLABLE);
 
         AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
@@ -745,7 +746,7 @@ public class AccessControlManagerImplTes
 
     @Test
     public void testGetApplicablePoliciesWithCollidingNode() throws Exception {
-        NodeUtil testTree = new NodeUtil(root.getTreeOrNull(testPath));
+        NodeUtil testTree = new NodeUtil(root.getTree(testPath));
         testTree.addChild(REP_POLICY, JcrConstants.NT_UNSTRUCTURED);
 
         AccessControlPolicyIterator itr = acMgr.getApplicablePolicies(testPath);
@@ -867,7 +868,7 @@ public class AccessControlManagerImplTes
         policy.addEntry(testPrincipal, testPrivileges, true, getGlobRestriction("*"));
         acMgr.setPolicy(testPath, policy);
 
-        NodeUtil aclNode = new NodeUtil(root.getTreeOrNull(testPath + '/' + REP_POLICY));
+        NodeUtil aclNode = new NodeUtil(root.getTree(testPath + '/' + REP_POLICY));
         NodeUtil aceNode = aclNode.addChild("testACE", NT_REP_DENY_ACE);
         aceNode.setString(REP_PRINCIPAL_NAME, "invalidPrincipal");
         aceNode.setNames(REP_PRIVILEGES, PrivilegeConstants.JCR_READ);
@@ -1052,9 +1053,9 @@ public class AccessControlManagerImplTes
         root.commit();
 
         Root root2 = adminSession.getLatestRoot();
-        Tree tree = root2.getTreeOrNull(testPath);
+        Tree tree = root2.getTree(testPath);
         assertTrue(tree.hasChild(REP_POLICY));
-        Tree policyTree = tree.getChildOrNull(REP_POLICY);
+        Tree policyTree = tree.getChild(REP_POLICY);
         assertEquals(NT_REP_ACL, TreeUtil.getPrimaryTypeName(policyTree));
         assertEquals(2, policyTree.getChildrenCount());
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/AccessControlValidatorTest.java Wed May  1 17:42:19 2013
@@ -16,23 +16,23 @@
  */
 package org.apache.jackrabbit.oak.security.authorization;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.security.Principal;
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.spi.security.authorization.AbstractAccessControlTest;
+import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 public class AccessControlValidatorTest extends AbstractAccessControlTest implements AccessControlConstants {
 
     private final String testName = "testRoot";
@@ -45,7 +45,7 @@ public class AccessControlValidatorTest 
     public void before() throws Exception {
         super.before();
 
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"), getNamePathMapper());
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"), getNamePathMapper());
         rootNode.addChild(testName, JcrConstants.NT_UNSTRUCTURED);
 
         root.commit();
@@ -56,8 +56,8 @@ public class AccessControlValidatorTest 
     @After
     public void after() throws Exception {
         try {
-            Tree testRoot = root.getTreeOrNull(testPath);
-            if (testRoot != null) {
+            Tree testRoot = root.getTree(testPath);
+            if (testRoot.exists()) {
                 testRoot.remove();
                 root.commit();
             }
@@ -67,7 +67,7 @@ public class AccessControlValidatorTest 
     }
 
     private NodeUtil getTestRoot() {
-        return new NodeUtil(root.getTreeOrNull(testPath));
+        return new NodeUtil(root.getTree(testPath));
     }
 
     private NodeUtil createAcl() {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/EffectivePolicyTest.java Wed May  1 17:42:19 2013
@@ -16,9 +16,16 @@
  */
 package org.apache.jackrabbit.oak.security.authorization;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.security.Principal;
 import java.util.Collections;
 import java.util.Set;
+
 import javax.annotation.Nonnull;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Value;
@@ -38,12 +45,6 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * EffectivePolicyTest... TODO
  */
@@ -63,7 +64,7 @@ public class EffectivePolicyTest extends
         super.before();
 
         // create some nodes below the test root in order to apply ac-stuff
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"));
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"));
         NodeUtil testRootNode = rootNode.getOrAddChild("testRoot", JcrConstants.NT_UNSTRUCTURED);
         NodeUtil testNode = testRootNode.addChild("testNode", JcrConstants.NT_UNSTRUCTURED);
         NodeUtil cn1 = testNode.addChild("child1", JcrConstants.NT_UNSTRUCTURED);
@@ -93,7 +94,7 @@ public class EffectivePolicyTest extends
                 testSession.close();
             }
 
-            root.getTreeOrNull(path).remove();
+            root.getTree(path).remove();
             root.commit();
         } finally {
             super.after();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/AbstractOakCoreTest.java Wed May  1 17:42:19 2013
@@ -16,7 +16,11 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.evaluation;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
+
 import java.security.Principal;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import javax.jcr.security.AccessControlManager;
@@ -31,9 +35,6 @@ import org.apache.jackrabbit.oak.util.No
 import org.junit.After;
 import org.junit.Before;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
-
 /**
  * Base class for all classes that attempt to test OAK API and OAK core functionality
  * in combination with permission evaluation
@@ -50,7 +51,7 @@ public abstract class AbstractOakCoreTes
 
         testPrincipal = getTestUser().getPrincipal();
 
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"));
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"));
         NodeUtil a = rootNode.addChild("a", NT_UNSTRUCTURED);
         a.setString("aProp", "aValue");
 
@@ -77,7 +78,7 @@ public abstract class AbstractOakCoreTes
             }
 
             // remove all test content
-            root.getTreeOrNull("/a").remove();
+            root.getTree("/a").remove();
             root.commit();
 
             // release test session

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ChildOrderPropertyTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,11 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.evaluation;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import java.util.Set;
 
 import com.google.common.collect.Sets;
@@ -26,11 +31,6 @@ import org.apache.jackrabbit.oak.core.Tr
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Test for the hidden {@link TreeImpl#OAK_CHILD_ORDER} property
  *
@@ -43,20 +43,20 @@ public class ChildOrderPropertyTest exte
     public void before() throws Exception {
         super.before();
 
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         a.setOrderableChildren(true);
         root.commit();
     }
 
     @Test
     public void testHasProperty() {
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         assertFalse(a.hasProperty(TreeImpl.OAK_CHILD_ORDER));
     }
 
     @Test
     public void testGetProperty() {
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         assertNull(a.getProperty(TreeImpl.OAK_CHILD_ORDER));
     }
 
@@ -64,7 +64,7 @@ public class ChildOrderPropertyTest exte
     public void testGetProperties() {
         Set<String> propertyNames = Sets.newHashSet(JcrConstants.JCR_PRIMARYTYPE, "aProp");
 
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         for (PropertyState prop : a.getProperties()) {
             assertTrue(propertyNames.remove(prop.getName()));
         }
@@ -73,13 +73,13 @@ public class ChildOrderPropertyTest exte
 
     @Test
     public void testGetPropertyCount() {
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         assertEquals(2, a.getPropertyCount());
     }
 
     @Test
     public void testGetPropertyStatus() {
-        Tree a = root.getTreeOrNull("/a");
+        Tree a = root.getTree("/a");
         assertNull(a.getPropertyStatus(TreeImpl.OAK_CHILD_ORDER));
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/HiddenTreeTest.java Wed May  1 17:42:19 2013
@@ -16,16 +16,15 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.evaluation;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import org.apache.jackrabbit.oak.api.Tree;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
 /**
  * Test to make sure hidden trees are never exposed.
  *
@@ -43,8 +42,8 @@ public class HiddenTreeTest extends Abst
     public void before() throws Exception {
         super.before();
 
-        parent = root.getTreeOrNull(hiddenParentPath);
-        assertNotNull(parent);
+        parent = root.getTree(hiddenParentPath);
+        assertTrue(parent.exists());
     }
 
     @Ignore("OAK-753") // FIXME
@@ -56,13 +55,13 @@ public class HiddenTreeTest extends Abst
     @Ignore("OAK-753") // FIXME
     @Test
     public void testGetHiddenTree() {
-        assertNull(parent.getChildOrNull(hiddenName));
+        assertFalse(parent.getChild(hiddenName).exists());
     }
 
     @Ignore("OAK-753") // FIXME
     @Test
     public void testGetHiddenChildren() {
-        Iterable children = parent.getChildren();
+        Iterable<Tree> children = parent.getChildren();
         assertFalse(children.iterator().hasNext());
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/ShadowInvisibleContentTest.java Wed May  1 17:42:19 2013
@@ -40,7 +40,7 @@ public class ShadowInvisibleContentTest 
         setupPermission("/a/b/c", testPrincipal, true, PrivilegeConstants.JCR_ALL);
 
         Root testRoot = getTestRoot();
-        Tree a = testRoot.getTreeOrNull("/a");
+        Tree a = testRoot.getTree("/a");
 
         // /b not visible to this session
         assertFalse(a.hasChild("b"));
@@ -65,7 +65,7 @@ public class ShadowInvisibleContentTest 
         setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);
 
         Root testRoot = getTestRoot();
-        Tree a = testRoot.getTreeOrNull("/a");
+        Tree a = testRoot.getTree("/a");
 
         // /a/x not visible to this session
         assertNull(a.getProperty("x"));
@@ -89,7 +89,7 @@ public class ShadowInvisibleContentTest 
         setupPermission("/a", testPrincipal, false, PrivilegeConstants.REP_READ_PROPERTIES);
 
         Root testRoot = getTestRoot();
-        Tree a = testRoot.getTreeOrNull("/a");
+        Tree a = testRoot.getTree("/a");
 
         // /a/x not visible to this session
         assertNull(a.getProperty("x"));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/evaluation/TreeTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,10 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.evaluation;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.util.List;
 
 import com.google.common.collect.ImmutableList;
@@ -26,12 +30,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 public class TreeTest extends AbstractOakCoreTest {
 
     // TODO: add tests for acls withs restrictions
@@ -51,60 +49,60 @@ public class TreeTest extends AbstractOa
 
     @Test
     public void testHasChild() throws Exception {
-        Tree rootTree = testRoot.getTreeOrNull("/");
+        Tree rootTree = testRoot.getTree("/");
 
         assertTrue(rootTree.hasChild("a"));
         assertFalse(rootTree.hasChild(AccessControlConstants.REP_POLICY));
 
-        Tree a = rootTree.getChildOrNull("a");
+        Tree a = rootTree.getChild("a");
         assertTrue(a.hasChild("b"));
         assertFalse(a.hasChild("bb"));
 
-        Tree b = a.getChildOrNull("b");
+        Tree b = a.getChild("b");
         assertTrue(b.hasChild("c"));
     }
 
     @Test
     public void testGetChild() throws Exception {
-        Tree rootTree = testRoot.getTreeOrNull("/");
-        assertNotNull(rootTree);
+        Tree rootTree = testRoot.getTree("/");
+        assertTrue(rootTree.exists());
 
-        Tree a = rootTree.getChildOrNull("a");
-        assertNotNull(a);
+        Tree a = rootTree.getChild("a");
+        assertTrue(a.exists());
 
-        Tree b = a.getChildOrNull("b");
-        assertNotNull(b);
-        assertNotNull(b.getChildOrNull("c"));
+        Tree b = a.getChild("b");
+        assertTrue(b.exists());
+        assertTrue(b.getChild("c").exists());
 
-        assertNull(a.getChildOrNull("bb"));
+        assertFalse(a.getChild("bb").exists());
     }
 
     @Test
     public void testPolicyChild() throws Exception {
-        assertNotNull(root.getTreeOrNull('/' + AccessControlConstants.REP_POLICY));
+        assertTrue(root.getTree('/' + AccessControlConstants.REP_POLICY).exists());
 
         // 'testUser' must not have access to the policy node
-        Tree rootTree = testRoot.getTreeOrNull("/");
+        Tree rootTree = testRoot.getTree("/");
 
         assertFalse(rootTree.hasChild(AccessControlConstants.REP_POLICY));
-        assertNull(rootTree.getChildOrNull(AccessControlConstants.REP_POLICY));
+        assertFalse(rootTree.getChild(AccessControlConstants.REP_POLICY).exists());
     }
 
     @Test
 	public void testGetChildrenCount() throws Exception {
-        long cntRoot = root.getTreeOrNull("/").getChildrenCount();
-        long cntA = root.getTreeOrNull("/a").getChildrenCount();
+        long cntRoot = root.getTree("/").getChildrenCount();
+        long cntA = root.getTree("/a").getChildrenCount();
 
         // 'testUser' may only see 'regular' child nodes -> count must be adjusted.
-        assertEquals(cntRoot-1, testRoot.getTreeOrNull("/").getChildrenCount());
-        assertEquals(cntA - 1, testRoot.getTreeOrNull("/a").getChildrenCount());
+        assertEquals(cntRoot-1, testRoot.getTree("/").getChildrenCount());
+        assertEquals(cntA - 1, testRoot.getTree("/a").getChildrenCount());
 
         // for the following nodes the cnt must not differ
         List<String> paths = ImmutableList.of("/a/b", "/a/b/c");
         for (String path : paths) {
             assertEquals(
-                    root.getTreeOrNull(path).getChildrenCount(),
-                    testRoot.getTreeOrNull(path).getChildrenCount());
+                    root.getTree(path).getChildrenCount(),
+                    testRoot.getTree(path).getChildrenCount());
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/AllPermissionsTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.permission;
 
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -27,10 +30,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Test {@code AllPermissions}.
  */
@@ -52,8 +51,8 @@ public class AllPermissionsTest extends 
     @Test
     public void testGetReadStatus() {
         for (String path : paths) {
-            Tree tree = root.getTreeOrNull(path);
-            assertNotNull(tree);
+            Tree tree = root.getTree(path);
+            assertTrue(tree.exists());
 
             assertSame(ReadStatus.ALLOW_ALL, all.getReadStatus(tree, null));
             for (Tree child : tree.getChildren()) {
@@ -70,8 +69,8 @@ public class AllPermissionsTest extends 
         assertTrue(all.isGranted(Permissions.ALL));
 
         for (String path : paths) {
-            Tree tree = root.getTreeOrNull(path);
-            assertNotNull(tree);
+            Tree tree = root.getTree(path);
+            assertTrue(tree.exists());
 
             assertTrue(all.isGranted(tree, null, Permissions.ALL));
             for (PropertyState prop : tree.getProperties()) {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/CompiledPermissionImplTest.java Wed May  1 17:42:19 2013
@@ -16,6 +16,13 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.permission;
 
+import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
+import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
 import java.security.Principal;
 import java.security.acl.Group;
 import java.util.ArrayList;
@@ -23,6 +30,7 @@ import java.util.Collections;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Set;
+
 import javax.annotation.Nonnull;
 
 import com.google.common.base.Objects;
@@ -57,13 +65,6 @@ import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import static org.apache.jackrabbit.JcrConstants.JCR_PRIMARYTYPE;
-import static org.apache.jackrabbit.JcrConstants.NT_UNSTRUCTURED;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
 /**
  * CompiledPermissionImplTest... TODO
  */
@@ -97,7 +98,7 @@ public class CompiledPermissionImplTest 
         pbp = new PrivilegeBitsProvider(root);
         rp = new RestrictionProviderImpl(NamePathMapper.DEFAULT);
 
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"));
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"));
         NodeUtil system = rootNode.getChild("jcr:system");
         NodeUtil perms = system.addChild(REP_PERMISSION_STORE, NT_REP_PERMISSION_STORE);
         perms.addChild(userPrincipal.getName(), NT_REP_PERMISSION_STORE);
@@ -117,7 +118,7 @@ public class CompiledPermissionImplTest 
 
     @Override
     public void after() throws Exception {
-        root.getTreeOrNull(PERMISSIONS_STORE_PATH).remove();
+        root.getTree(PERMISSIONS_STORE_PATH).remove();
         root.commit();
 
         super.after();
@@ -417,7 +418,7 @@ public class CompiledPermissionImplTest 
     // TODO: tests for path base evaluation
 
     private CompiledPermissionImpl createPermissions(Set<Principal> principals) {
-        ImmutableTree permissionsTree = new ImmutableRoot(root, TreeTypeProvider.EMPTY).getTreeOrNull(PERMISSIONS_STORE_PATH);
+        ImmutableTree permissionsTree = new ImmutableRoot(root, TreeTypeProvider.EMPTY).getTree(PERMISSIONS_STORE_PATH);
         return new CompiledPermissionImpl(principals, permissionsTree, pbp, rp, AccessControlConstants.DEFAULT_READ_PATHS);
     }
 
@@ -433,7 +434,7 @@ public class CompiledPermissionImplTest 
                                  int index, String[] privilegeName, Set<Restriction> restrictions) throws CommitFailedException {
         PrivilegeBits pb = pbp.getBits(privilegeName);
         String name = ((isAllow) ? PREFIX_ALLOW : PREFIX_DENY) + "-" + Objects.hashCode(path, principal, index, pb, isAllow, restrictions);
-        Tree principalRoot = root.getTreeOrNull(PERMISSIONS_STORE_PATH + '/' + principal.getName());
+        Tree principalRoot = root.getTree(PERMISSIONS_STORE_PATH + '/' + principal.getName());
         Tree entry = principalRoot.addChild(name);
         entry.setProperty(JCR_PRIMARYTYPE, NT_REP_PERMISSIONS);
         entry.setProperty(REP_ACCESS_CONTROLLED_PATH, path);
@@ -462,7 +463,7 @@ public class CompiledPermissionImplTest 
                                   CompiledPermissions cp,
                                   List<String> treePaths) {
         for (String path : treePaths) {
-            Tree node = root.getTreeOrNull(path);
+            Tree node = root.getTree(path);
             assertSame("Tree " + path, expectedTrees, cp.getReadStatus(node, null));
             assertSame("Property jcr:primaryType " + path, expectedProperties, cp.getReadStatus(node, node.getProperty(JCR_PRIMARYTYPE)));
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authorization/permission/PermissionHookTest.java Wed May  1 17:42:19 2013
@@ -16,12 +16,17 @@
  */
 package org.apache.jackrabbit.oak.security.authorization.permission;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+
 import javax.jcr.RepositoryException;
 import javax.jcr.security.AccessControlEntry;
 import javax.jcr.security.AccessControlManager;
@@ -36,18 +41,14 @@ import org.apache.jackrabbit.oak.api.Typ
 import org.apache.jackrabbit.oak.security.authorization.AccessControlConstants;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBits;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeBitsProvider;
-import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.spi.security.authorization.AbstractAccessControlTest;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
+import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConstants;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
 /**
  * Testing the {@code PermissionHook}
  */
@@ -64,7 +65,7 @@ public class PermissionHookTest extends 
         super.before();
 
         Principal testPrincipal = getTestPrincipal();
-        NodeUtil rootNode = new NodeUtil(root.getTreeOrNull("/"), namePathMapper);
+        NodeUtil rootNode = new NodeUtil(root.getTree("/"), namePathMapper);
         rootNode.addChild("testPath", JcrConstants.NT_UNSTRUCTURED);
 
         AccessControlManager acMgr = getAccessControlManager(root);
@@ -82,8 +83,8 @@ public class PermissionHookTest extends 
     public void after() throws Exception {
         try {
             root.refresh();
-            Tree test = root.getTreeOrNull(testPath);
-            if (test != null) {
+            Tree test = root.getTree(testPath);
+            if (test.exists()) {
                 test.remove();
             }
 
@@ -97,7 +98,7 @@ public class PermissionHookTest extends 
     }
 
     private Tree getPrincipalRoot(String principalName) {
-        return root.getTreeOrNull(PERMISSIONS_STORE_PATH).getChildOrNull(adminSession.getWorkspaceName()).getChildOrNull(principalName);
+        return root.getTree(PERMISSIONS_STORE_PATH).getChild(adminSession.getWorkspaceName()).getChild(principalName);
     }
 
     private Tree getEntry(String principalName, String accessControlledPath) throws Exception {
@@ -123,7 +124,7 @@ public class PermissionHookTest extends 
     @Test
     public void testDuplicateAce() throws Exception {
         // add duplicate policy on OAK-API
-        NodeUtil policy = new NodeUtil(root.getTreeOrNull(testPath + "/rep:policy"));
+        NodeUtil policy = new NodeUtil(root.getTree(testPath + "/rep:policy"));
         NodeUtil ace = policy.addChild("duplicateAce", NT_REP_GRANT_ACE);
         ace.setString(REP_PRINCIPAL_NAME, testPrincipalName);
         ace.setStrings(REP_PRIVILEGES, PrivilegeConstants.JCR_ADD_CHILD_NODES);
@@ -141,7 +142,7 @@ public class PermissionHookTest extends 
         assertEquals(ImmutableSet.of(0, 2), index);
 
         // remove duplicate policy entry again
-        root.getTreeOrNull(testPath + "/rep:policy/duplicateAce").remove();
+        root.getTree(testPath + "/rep:policy/duplicateAce").remove();
         root.commit();
 
         assertEquals(1, getPrincipalRoot(testPrincipalName).getChildrenCount());
@@ -149,7 +150,7 @@ public class PermissionHookTest extends 
 
     @Test
     public void testModifyRestrictions() throws Exception {
-        Tree testAce = root.getTreeOrNull(testPath + "/rep:policy").getChildren().iterator().next();
+        Tree testAce = root.getTree(testPath + "/rep:policy").getChildren().iterator().next();
         assertEquals(testPrincipalName, testAce.getProperty(REP_PRINCIPAL_NAME).getValue(Type.STRING));
 
         // add a new restriction node through the OAK API instead of access control manager
@@ -164,7 +165,7 @@ public class PermissionHookTest extends 
         assertEquals("*", principalRoot.getChildren().iterator().next().getProperty(REP_GLOB).getValue(Type.STRING));
 
         // modify the restrictions node
-        Tree restrictionsNode = root.getTreeOrNull(restritionsPath);
+        Tree restrictionsNode = root.getTree(restritionsPath);
         restrictionsNode.setProperty(REP_GLOB, "/*/jcr:content/*");
         root.commit();
 
@@ -173,7 +174,7 @@ public class PermissionHookTest extends 
         assertEquals("/*/jcr:content/*", principalRoot.getChildren().iterator().next().getProperty(REP_GLOB).getValue(Type.STRING));
 
         // remove the restriction again
-        root.getTreeOrNull(restritionsPath).remove();
+        root.getTree(restritionsPath).remove();
         root.commit();
 
         principalRoot = getPrincipalRoot(testPrincipalName);
@@ -187,7 +188,7 @@ public class PermissionHookTest extends 
         Tree entry = getEntry(testPrincipalName, testPath);
         assertEquals(0, entry.getProperty(REP_INDEX).getValue(Type.LONG).longValue());
 
-        Tree aclTree = root.getTreeOrNull(testPath + "/rep:policy");
+        Tree aclTree = root.getTree(testPath + "/rep:policy");
         aclTree.getChildren().iterator().next().orderBefore(null);
 
         root.commit();
@@ -201,7 +202,7 @@ public class PermissionHookTest extends 
         Tree entry = getEntry(testPrincipalName, testPath);
         assertEquals(0, entry.getProperty(REP_INDEX).getValue(Type.LONG).longValue());
 
-        Tree aclTree = root.getTreeOrNull(testPath + "/rep:policy");
+        Tree aclTree = root.getTree(testPath + "/rep:policy");
         // reorder
         aclTree.getChildren().iterator().next().orderBefore(null);
 
@@ -220,7 +221,7 @@ public class PermissionHookTest extends 
         Tree entry = getEntry(testPrincipalName, testPath);
         assertEquals(0, entry.getProperty(REP_INDEX).getValue(Type.LONG).longValue());
 
-        Tree aclTree = root.getTreeOrNull(testPath + "/rep:policy");
+        Tree aclTree = root.getTree(testPath + "/rep:policy");
 
         // reorder testPrincipal entry to the end
         aclTree.getChildren().iterator().next().orderBefore(null);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java Wed May  1 17:42:19 2013
@@ -16,9 +16,18 @@
  */
 package org.apache.jackrabbit.oak.security.user;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.security.PrivilegedExceptionAction;
 import java.util.HashMap;
 import java.util.Map;
+
 import javax.jcr.SimpleCredentials;
 import javax.security.auth.Subject;
 import javax.security.auth.login.LoginException;
@@ -51,14 +60,6 @@ import org.apache.jackrabbit.oak.util.Tr
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * @since OAK 1.0
  */
@@ -109,26 +110,26 @@ public class UserInitializerTest extends
     @Test
     public void testUserContent() throws Exception {
         Authorizable a = userMgr.getAuthorizable(UserUtility.getAdminId(config));
-        assertNotNull(root.getTreeOrNull(a.getPath()));
+        assertTrue(root.getTree(a.getPath()).exists());
 
         a = userMgr.getAuthorizable(UserUtility.getAnonymousId(config));
-        assertNotNull(root.getTreeOrNull(a.getPath()));
+        assertTrue(root.getTree(a.getPath()).exists());
     }
 
     @Test
     public void testUserIndexDefinitions() throws Exception {
-        Tree oakIndex = root.getTreeOrNull('/' + IndexConstants.INDEX_DEFINITIONS_NAME);
-        assertNotNull(oakIndex);
+        Tree oakIndex = root.getTree('/' + IndexConstants.INDEX_DEFINITIONS_NAME);
+        assertTrue(oakIndex.exists());
 
-        Tree id = oakIndex.getChildOrNull("authorizableId");
+        Tree id = oakIndex.getChild("authorizableId");
         assertIndexDefinition(id, UserConstants.REP_AUTHORIZABLE_ID, true);
 
-        Tree princName = oakIndex.getChildOrNull("principalName");
+        Tree princName = oakIndex.getChild("principalName");
         assertIndexDefinition(princName, UserConstants.REP_PRINCIPAL_NAME, true);
         String[] declaringNtNames = TreeUtil.getStrings(princName, IndexConstants.DECLARING_NODE_TYPES);
         assertArrayEquals(new String[]{UserConstants.NT_REP_AUTHORIZABLE}, declaringNtNames);
 
-        Tree members = oakIndex.getChildOrNull("members");
+        Tree members = oakIndex.getChild("members");
         assertIndexDefinition(members, UserConstants.REP_MEMBERS, false);
     }
 
@@ -163,8 +164,8 @@ public class UserInitializerTest extends
             Authorizable adminUser = umgr.getAuthorizable("admin");
             assertNotNull(adminUser);
 
-            Tree adminTree = root.getTreeOrNull(adminUser.getPath());
-            assertNotNull(adminTree);
+            Tree adminTree = root.getTree(adminUser.getPath());
+            assertTrue(adminTree.exists());
             assertNull(adminTree.getProperty(UserConstants.REP_PASSWORD));
         } finally {
             cs.close();
@@ -185,7 +186,7 @@ public class UserInitializerTest extends
     }
 
     private static void assertIndexDefinition(Tree tree, String propName, boolean isUnique) {
-        assertNotNull(tree);
+        assertTrue(tree.exists());
 
         assertEquals(isUnique, TreeUtil.getBoolean(tree, IndexConstants.UNIQUE_PROPERTY_NAME));
         assertArrayEquals(propName, new String[]{propName}, TreeUtil.getStrings(tree, IndexConstants.PROPERTY_NAMES));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java Wed May  1 17:42:19 2013
@@ -16,10 +16,18 @@
  */
 package org.apache.jackrabbit.oak.security.user;
 
+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.assertNull;
+import static org.junit.Assert.fail;
+
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
@@ -38,13 +46,6 @@ 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.assertNull;
-import static org.junit.Assert.fail;
-
 /**
  * @since OAK 1.0
  */
@@ -83,7 +84,7 @@ public class UserManagerImplTest extends
         pwds.add("");
         pwds.add("{sha1}pw");
 
-        Tree userTree = root.getTreeOrNull(user.getPath());
+        Tree userTree = root.getTree(user.getPath());
         for (String pw : pwds) {
             userMgr.setPassword(userTree, pw, true);
             String pwHash = userTree.getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
@@ -109,7 +110,7 @@ public class UserManagerImplTest extends
         User user = userMgr.createUser(testUserId, null);
         root.commit();
 
-        Tree userTree = root.getTreeOrNull(user.getPath());
+        Tree userTree = root.getTree(user.getPath());
         try {
             userMgr.setPassword(userTree, null, true);
             fail("setting null password should fail");
@@ -130,7 +131,7 @@ public class UserManagerImplTest extends
         User user = userMgr.createUser(testUserId, null);
         root.commit();
 
-        Tree userTree = root.getTreeOrNull(user.getPath());
+        Tree userTree = root.getTree(user.getPath());
         assertNull(userTree.getProperty(UserConstants.REP_PASSWORD));
     }
 
@@ -154,7 +155,7 @@ public class UserManagerImplTest extends
         User user = userMgr.createUser(testUserId, null);
         root.commit();
 
-        NodeUtil userNode = new NodeUtil(root.getTreeOrNull(user.getPath()));
+        NodeUtil userNode = new NodeUtil(root.getTree(user.getPath()));
 
         NodeUtil folder = userNode.addChild("folder", UserConstants.NT_REP_AUTHORIZABLE_FOLDER);
         String path = folder.getTree().getPath();
@@ -217,8 +218,8 @@ public class UserManagerImplTest extends
             }
         } finally {
             root.refresh();
-            Tree t = root.getTreeOrNull(path);
-            if (t != null) {
+            Tree t = root.getTree(path);
+            if (t.exists()) {
                 t.remove();
                 root.commit();
             }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserProviderTest.java Wed May  1 17:42:19 2013
@@ -285,7 +285,7 @@ public class UserProviderTest {
         Tree u1 = up.createUser("b", "b");
         Tree u2 = up.createUser("bb", "bb");
 
-        Tree folder = root.getTreeOrNull(Text.getRelativeParent(u1.getPath(), 2));
+        Tree folder = root.getTree(Text.getRelativeParent(u1.getPath(), 2));
         folder.remove();
         if (up.getAuthorizable("b") != null) {
             fail("Removing the top authorizable folder must remove all users contained.");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserValidatorTest.java Wed May  1 17:42:19 2013
@@ -16,9 +16,12 @@
  */
 package org.apache.jackrabbit.oak.security.user;
 
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
+
 import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.JcrConstants;
@@ -35,8 +38,6 @@ import org.apache.jackrabbit.util.Text;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.fail;
-
 /**
  * @since OAK 1.0
  */
@@ -53,7 +54,7 @@ public class UserValidatorTest extends A
     @Test
     public void removePassword() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.removeProperty(UserConstants.REP_PASSWORD);
             root.commit();
             fail("removing password should fail");
@@ -67,7 +68,7 @@ public class UserValidatorTest extends A
     @Test
     public void removePrincipalName() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.removeProperty(UserConstants.REP_PRINCIPAL_NAME);
             root.commit();
             fail("removing principal name should fail");
@@ -81,7 +82,7 @@ public class UserValidatorTest extends A
     @Test
     public void removeAuthorizableId() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.removeProperty(UserConstants.REP_AUTHORIZABLE_ID);
             root.commit();
             fail("removing authorizable id should fail");
@@ -96,7 +97,7 @@ public class UserValidatorTest extends A
     public void createWithoutPrincipalName() throws Exception {
         try {
             User user = getUserManager().createUser("withoutPrincipalName", "pw");
-            Tree tree = root.getTreeOrNull(userPath);
+            Tree tree = root.getTree(userPath);
             tree.removeProperty(UserConstants.REP_PRINCIPAL_NAME);
             root.commit();
 
@@ -112,7 +113,7 @@ public class UserValidatorTest extends A
     public void createWithInvalidUUID() throws Exception {
         try {
             User user = getUserManager().createUser("withInvalidUUID", "pw");
-            Tree tree = root.getTreeOrNull(userPath);
+            Tree tree = root.getTree(userPath);
             tree.setProperty(JcrConstants.JCR_UUID, UUID.randomUUID().toString());
             root.commit();
 
@@ -127,7 +128,7 @@ public class UserValidatorTest extends A
     @Test
     public void changeUUID() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.setProperty(JcrConstants.JCR_UUID, UUID.randomUUID().toString());
             root.commit();
             fail("changing jcr:uuid should fail if it the uuid valid is invalid");
@@ -141,7 +142,7 @@ public class UserValidatorTest extends A
     @Test
     public void changePrincipalName() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.setProperty(UserConstants.REP_PRINCIPAL_NAME, "another");
             root.commit();
             fail("changing the principal name should fail");
@@ -155,7 +156,7 @@ public class UserValidatorTest extends A
     @Test
     public void changeAuthorizableId() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.setProperty(UserConstants.REP_AUTHORIZABLE_ID, "modified");
             root.commit();
             fail("changing the authorizable id should fail");
@@ -169,7 +170,7 @@ public class UserValidatorTest extends A
     @Test
     public void changePasswordToPlainText() throws Exception {
         try {
-            Tree userTree = root.getTreeOrNull(userPath);
+            Tree userTree = root.getTree(userPath);
             userTree.setProperty(UserConstants.REP_PASSWORD, "plaintext");
             root.commit();
             fail("storing a plaintext password should fail");
@@ -191,7 +192,7 @@ public class UserValidatorTest extends A
                 root.commit();
             }
 
-            root.getTreeOrNull(admin.getPath()).remove();
+            root.getTree(admin.getPath()).remove();
             root.commit();
             fail("Admin user cannot be removed");
         } catch (CommitFailedException e) {
@@ -212,7 +213,7 @@ public class UserValidatorTest extends A
                 root.commit();
             }
 
-            root.getTreeOrNull(admin.getPath()).setProperty(UserConstants.REP_DISABLED, "disabled");
+            root.getTree(admin.getPath()).setProperty(UserConstants.REP_DISABLED, "disabled");
             root.commit();
             fail("Admin user cannot be disabled");
         } catch (CommitFailedException e) {
@@ -236,13 +237,13 @@ public class UserValidatorTest extends A
 
         for (String path : invalid) {
             try {
-                Tree parent = root.getTreeOrNull(path);
-                if (parent == null) {
+                Tree parent = root.getTree(path);
+                if (!parent.exists()) {
                     String[] segments = Text.explode(path, '/', false);
-                    parent = root.getTreeOrNull("/");
+                    parent = root.getTree("/");
                     for (String segment : segments) {
-                        Tree next = parent.getChildOrNull(segment);
-                        if (next == null) {
+                        Tree next = parent.getChild(segment);
+                        if (!next.exists()) {
                             next = parent.addChild(segment);
                             next.setProperty(JcrConstants.JCR_PRIMARYTYPE, UserConstants.NT_REP_AUTHORIZABLE_FOLDER, Type.NAME);
                             parent = next;

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/AbstractAccessControlTest.java Wed May  1 17:42:19 2013
@@ -38,7 +38,7 @@ public abstract class AbstractAccessCont
 
             @Override
             protected Tree getReadTree() {
-                return root.getTreeOrNull("/");
+                return root.getTree("/");
             }
         };
         nsRegistry.registerNamespace(prefix, uri);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionDefinitionImplTest.java Wed May  1 17:42:19 2013
@@ -16,8 +16,14 @@
  */
 package org.apache.jackrabbit.oak.spi.security.authorization.restriction;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.jcr.PropertyType;
 
 import org.apache.jackrabbit.oak.TestNameMapper;
@@ -28,11 +34,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * Tests for {@link RestrictionDefinitionImpl}.
  */
@@ -46,7 +47,7 @@ public class RestrictionDefinitionImplTe
         super.before();
 
         registerNamespace(TestNameMapper.TEST_PREFIX, TestNameMapper.TEST_URI);
-        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper(Namespaces.getNamespaceMap(root.getTreeOrNull("/")), TestNameMapper.LOCAL_MAPPING));
+        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper(Namespaces.getNamespaceMap(root.getTree("/")), TestNameMapper.LOCAL_MAPPING));
 
         name = TestNameMapper.TEST_PREFIX + ":defName";
         definition = new RestrictionDefinitionImpl(name, PropertyType.NAME, true, npMapper);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/RestrictionImplTest.java Wed May  1 17:42:19 2013
@@ -16,8 +16,14 @@
  */
 package org.apache.jackrabbit.oak.spi.security.authorization.restriction;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.List;
+
 import javax.annotation.Nonnull;
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
@@ -34,11 +40,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /**
  * Tests for {@link RestrictionImpl}
  */
@@ -52,7 +53,7 @@ public class RestrictionImplTest extends
         super.before();
 
         registerNamespace(TestNameMapper.TEST_PREFIX, TestNameMapper.TEST_URI);
-        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper(Namespaces.getNamespaceMap(root.getTreeOrNull("/")), TestNameMapper.LOCAL_MAPPING));
+        NamePathMapper npMapper = new NamePathMapperImpl(new TestNameMapper(Namespaces.getNamespaceMap(root.getTree("/")), TestNameMapper.LOCAL_MAPPING));
 
         name = TestNameMapper.TEST_PREFIX + ":defName";
         PropertyState property = createProperty(name);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java Wed May  1 17:42:19 2013
@@ -16,9 +16,15 @@
  */
 package org.apache.jackrabbit.oak.spi.security.user.action;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+
 import javax.annotation.Nonnull;
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -39,11 +45,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 public class PasswordValidationActionTest extends AbstractSecurityTest {
 
     private PasswordValidationAction pwAction = new PasswordValidationAction();
@@ -130,7 +131,7 @@ public class PasswordValidationActionTes
         testUser = getUserManager().createUser("testuser", hashed);
         root.commit();
 
-        String pwValue = root.getTreeOrNull(testUser.getPath()).getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
+        String pwValue = root.getTree(testUser.getPath()).getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
         assertFalse(PasswordUtility.isPlainTextPassword(pwValue));
         assertTrue(PasswordUtility.isSame(pwValue, hashed));
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java?rev=1478109&r1=1478108&r2=1478109&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/util/JsopUtilTest.java Wed May  1 17:42:19 2013
@@ -16,41 +16,41 @@
  */
 package org.apache.jackrabbit.oak.util;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static org.apache.jackrabbit.oak.api.Type.STRING;
+
 import org.apache.jackrabbit.oak.OakBaseTest;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.query.JsopUtil;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-import static org.apache.jackrabbit.oak.api.Type.STRING;
-
 public class JsopUtilTest extends OakBaseTest {
 
     @Test
     public void test() throws Exception {
         Root root = createContentSession().getLatestRoot();
 
-        Tree t = root.getTreeOrNull("/");
+        Tree t = root.getTree("/");
         assertFalse(t.hasChild("test"));
 
         String add = "/ + \"test\": { \"a\": { \"id\": \"123\" }, \"b\": {} }";
         JsopUtil.apply(root, add);
         root.commit();
 
-        t = root.getTreeOrNull("/");
+        t = root.getTree("/");
         assertTrue(t.hasChild("test"));
 
-        t = t.getChildOrNull("test");
+        t = t.getChild("test");
         assertEquals(2, t.getChildrenCount());
         assertTrue(t.hasChild("a"));
         assertTrue(t.hasChild("b"));
 
-        assertEquals(0, t.getChildOrNull("b").getChildrenCount());
+        assertEquals(0, t.getChild("b").getChildrenCount());
 
-        t = t.getChildOrNull("a");
+        t = t.getChild("a");
         assertEquals(0, t.getChildrenCount());
         assertTrue(t.hasProperty("id"));
         assertEquals("123", t.getProperty("id").getValue(STRING));
@@ -59,7 +59,7 @@ public class JsopUtilTest extends OakBas
         JsopUtil.apply(root, rm);
         root.commit();
 
-        t = root.getTreeOrNull("/");
+        t = root.getTree("/");
         assertFalse(t.hasChild("test"));
     }
 



Mime
View raw message