You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by an...@apache.org on 2009/06/10 14:57:01 UTC
svn commit: r783338 - in
/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization:
AbstractEvaluationTest.java AbstractWriteTest.java acl/WriteTest.java
combined/WriteTest.java
Author: angela
Date: Wed Jun 10 12:57:01 2009
New Revision: 783338
URL: http://svn.apache.org/viewvc?rev=783338&view=rev
Log:
JCR-1104: JSR 283 support
- remove redundant casts now that 283 api is present
Modified:
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/WriteTest.java
jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/WriteTest.java
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java?rev=783338&r1=783337&r2=783338&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractEvaluationTest.java Wed Jun 10 12:57:01 2009
@@ -28,7 +28,6 @@
import org.apache.jackrabbit.uuid.UUID;
import org.apache.jackrabbit.test.NotExecutableException;
import org.apache.jackrabbit.test.api.security.AbstractAccessControlTest;
-import org.apache.jackrabbit.core.SessionImpl;
import javax.jcr.Session;
import javax.jcr.Node;
@@ -49,7 +48,7 @@
protected User testUser;
protected Credentials creds;
- private SessionImpl testSession;
+ private Session testSession;
private AccessControlManager testAccessControlManager;
private Node trn;
private Set toClear = new HashSet();
@@ -110,10 +109,9 @@
}
}
- protected SessionImpl getTestSession() throws RepositoryException {
+ protected Session getTestSession() throws RepositoryException {
if (testSession == null) {
- // TODO: remove cast once 283 is released.
- testSession = (SessionImpl) helper.getRepository().login(creds);
+ testSession = helper.getRepository().login(creds);
}
return testSession;
}
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java?rev=783338&r1=783337&r2=783338&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java Wed Jun 10 12:57:01 2009
@@ -21,7 +21,6 @@
import javax.jcr.security.Privilege;
import org.apache.jackrabbit.api.security.user.Group;
import org.apache.jackrabbit.api.security.user.User;
-import org.apache.jackrabbit.core.SessionImpl;
import org.apache.jackrabbit.core.security.TestPrincipal;
import org.apache.jackrabbit.test.JUnitTest;
import org.apache.jackrabbit.test.NotExecutableException;
@@ -128,7 +127,7 @@
testuser must not have
- REMOVE permission for child node
*/
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
String nonExChildPath = path + "/anyItem";
assertTrue(testSession.hasPermission(nonExChildPath, "read,add_node,set_property"));
assertFalse(testSession.hasPermission(nonExChildPath, "remove"));
@@ -181,7 +180,7 @@
*/
// must still have read-access to path, ...
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
assertTrue(testSession.hasPermission(path, "read"));
Node n = testSession.getNode(path);
// ... siblings of childN
@@ -219,7 +218,7 @@
// make sure the 'rep:policy' node has been created.
assertTrue(superuser.itemExists(tmpl.getPath() + "/rep:policy"));
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
/*
Testuser must still have READ-only access only and must not be
allowed to view the acl-node that has been created.
@@ -251,7 +250,7 @@
testuser must have READ-only permission on test-node and below
*/
checkReadOnly(path);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
// give 'testUser' ADD_CHILD_NODES|MODIFY_PROPERTIES| REMOVE_CHILD_NODES privileges at 'path'
Privilege[] privileges = privilegesFromNames(new String[] {
@@ -328,7 +327,7 @@
testuser must have READ-only permission on test-node and below
*/
checkReadOnly(path);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
// withdraw the READ privilege
Privilege[] dnPrivs = privilegesFromName(Privilege.JCR_READ);
@@ -361,7 +360,7 @@
}
public void testInheritance() throws RepositoryException, NotExecutableException {
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
/* precondition:
testuser must have READ-only permission on test-node and below
@@ -439,7 +438,7 @@
*/
checkReadOnly(path);
checkReadOnly(childNPath);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
Privilege[] rmChildNodes = privilegesFromName(Privilege.JCR_REMOVE_CHILD_NODES);
@@ -461,7 +460,7 @@
*/
checkReadOnly(path);
checkReadOnly(childNPath);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
Privilege[] rmChildNodes = privilegesFromName(Privilege.JCR_REMOVE_NODE);
@@ -484,7 +483,7 @@
*/
checkReadOnly(path);
checkReadOnly(childNPath);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
Privilege[] privs = privilegesFromNames(new String[] {
Privilege.JCR_REMOVE_CHILD_NODES, Privilege.JCR_REMOVE_NODE
@@ -508,7 +507,7 @@
}
public void testRemovePermission4() throws NotExecutableException, RepositoryException {
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
/*
precondition:
@@ -555,7 +554,7 @@
}
public void testRemovePermission6() throws NotExecutableException, RepositoryException {
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
/*
precondition:
@@ -586,7 +585,7 @@
}
public void testRemovePermission7() throws NotExecutableException, RepositoryException {
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
/*
precondition:
@@ -652,7 +651,7 @@
*/
checkReadOnly(path);
checkReadOnly(childNPath);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
String destPath = path + "/" + nodeName1;
@@ -704,7 +703,7 @@
*/
checkReadOnly(path);
checkReadOnly(childNPath);
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
String destPath = path + "/" + nodeName1;
@@ -802,7 +801,7 @@
checkReadOnly(path);
/* create some new nodes below 'path' */
- Node n = ((SessionImpl) superuser).getNode(path);
+ Node n = superuser.getNode(path);
for (int i = 0; i < 5; i++) {
n = n.addNode(nodeName2, testNodeType);
}
@@ -885,7 +884,7 @@
checkReadOnly(path);
/* create a child node below node at 'path' */
- Node n = ((SessionImpl) superuser).getNode(path);
+ Node n = superuser.getNode(path);
n = n.addNode(nodeName2, testNodeType);
superuser.save();
@@ -897,7 +896,7 @@
- testSession cannot add child-nodes at 'path'
- testSession can add child-nodes below path
*/
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
assertFalse(testSession.hasPermission(path, javax.jcr.Session.ACTION_ADD_NODE));
assertTrue(testSession.hasPermission(path+"/anychild", javax.jcr.Session.ACTION_ADD_NODE));
String childPath = n.getPath();
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/WriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/WriteTest.java?rev=783338&r1=783337&r2=783338&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/WriteTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/acl/WriteTest.java Wed Jun 10 12:57:01 2009
@@ -95,7 +95,7 @@
// make sure the 'rep:policy' node has been created.
assertTrue(superuser.itemExists(tmpl.getPath() + "/rep:policy"));
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
// test: MODIFY_AC granted at 'path'
assertTrue(testAcMgr.hasPrivileges(path, privilegesFromName(Privilege.JCR_MODIFY_ACCESS_CONTROL)));
Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/WriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/WriteTest.java?rev=783338&r1=783337&r2=783338&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/WriteTest.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/combined/WriteTest.java Wed Jun 10 12:57:01 2009
@@ -31,6 +31,7 @@
import javax.jcr.AccessDeniedException;
import javax.jcr.RepositoryException;
import javax.jcr.PropertyType;
+import javax.jcr.Session;
import java.security.Principal;
import java.util.Map;
import java.util.HashMap;
@@ -111,7 +112,7 @@
public void testCombinedPolicies() throws RepositoryException, NotExecutableException {
Group testGroup = getTestGroup();
- SessionImpl testSession = getTestSession();
+ Session testSession = getTestSession();
AccessControlManager testAcMgr = getTestACManager();
/*