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 2016/08/08 09:37:07 UTC
svn commit: r1755482 -
/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java
Author: angela
Date: Mon Aug 8 09:37:07 2016
New Revision: 1755482
URL: http://svn.apache.org/viewvc?rev=1755482&view=rev
Log:
OAK-4196 : EventListener gets removed event for denied node (additional test-case illustring what IMO could be the root cause for the issue)
Modified:
jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java
Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java?rev=1755482&r1=1755481&r2=1755482&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/authorization/ObservationTest.java Mon Aug 8 09:37:07 2016
@@ -66,6 +66,9 @@ public class ObservationTest extends Abs
// withdraw the READ privilege on childNPath
deny(childNPath, readPrivileges);
+ assertFalse(testSession.nodeExists(childNPath));
+ assertTrue(testSession.nodeExists(childNPath2));
+
// testUser registers a event listener for changes under testRoot
ObservationManager obsMgr = testSession.getWorkspace().getObservationManager();
EventResult listener = new EventResult(this.log);
@@ -79,6 +82,38 @@ public class ObservationTest extends Abs
superuser.save();
// since the testUser does not have read-permission on the removed
+ // childNPath, no corresponding event must be generated.
+ Event[] evts = listener.getEvents(DEFAULT_WAIT_TIMEOUT);
+ for (Event evt : evts) {
+ if (evt.getType() == Event.NODE_REMOVED &&
+ evt.getPath().equals(childNPath)) {
+ fail("TestUser does not have READ permission on " + childNPath);
+ }
+ }
+ } finally {
+ obsMgr.removeEventListener(listener);
+ }
+ }
+
+ @Test
+ public void testEventDeniedNode2() throws Exception {
+ // withdraw the READ privilege on childNPath
+ deny(path, readPrivileges);
+
+ assertFalse(testSession.nodeExists(childNPath));
+
+ // testUser registers a event listener for changes under testRoot
+ ObservationManager obsMgr = testSession.getWorkspace().getObservationManager();
+ EventResult listener = new EventResult(this.log);
+ try {
+ obsMgr.addEventListener(listener, Event.NODE_REMOVED, testRoot, true, null, null, true);
+
+ // superuser removes the node with childNPath & childNPath2 in
+ // order to provoke events being generated
+ superuser.getItem(childNPath).remove();
+ superuser.save();
+
+ // since the testUser does not have read-permission on the removed
// childNPath, no corresponding event must be generated.
Event[] evts = listener.getEvents(DEFAULT_WAIT_TIMEOUT);
for (Event evt : evts) {