You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by an...@apache.org on 2013/07/24 16:25:21 UTC
svn commit: r1506574 -
/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
Author: angela
Date: Wed Jul 24 14:25:21 2013
New Revision: 1506574
URL: http://svn.apache.org/r1506574
Log:
OAK-930: test-case illustrating the problem
Added:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
Added: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java?rev=1506574&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java (added)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/VersionTest.java Wed Jul 24 14:25:21 2013
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.jcr.security.authorization;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.jcr.GuestCredentials;
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.security.Privilege;
+
+import org.apache.jackrabbit.commons.jackrabbit.authorization.AccessControlUtils;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class VersionTest {
+
+ private Repository repository;
+ private List<Session> sessions = new ArrayList();
+
+ @Before
+ public void before() throws Exception {
+ repository = new Jcr().createRepository();
+
+ Session admin = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
+ sessions.add(admin);
+ Node testNode = admin.getRootNode().addNode("testNode");
+ AccessControlUtils.addAccessControlEntry(admin, "/testNode", EveryonePrincipal.getInstance(), new String[]{Privilege.JCR_READ}, true);
+ admin.save();
+ }
+
+ @After
+ public void after() throws Exception {
+ for (Session s : sessions) {
+ s.logout();
+ }
+ repository = null;
+ }
+
+ @Ignore("OAK-930") // FIXME
+ @Test
+ public void testNodeIsCheckedOut() throws RepositoryException {
+ Session s = repository.login(new GuestCredentials());
+ sessions.add(s);
+
+ assertFalse(s.nodeExists("/"));
+ assertTrue(s.nodeExists("/testNode"));
+
+ assertTrue(s.getWorkspace().getVersionManager().isCheckedOut("/testNode"));
+ }
+
+}
\ No newline at end of file