You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by mr...@apache.org on 2009/04/15 22:12:53 UTC

svn commit: r765337 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation: AddEventListenerTest.java TestAll.java

Author: mreutegg
Date: Wed Apr 15 20:12:52 2009
New Revision: 765337

URL: http://svn.apache.org/viewvc?rev=765337&view=rev
Log:
JCR-2075: JSR 283: Identifier based event filtering

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/TestAll.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java?rev=765337&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java Wed Apr 15 20:12:52 2009
@@ -0,0 +1,56 @@
+/*
+ * 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.api.jsr283.observation;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+import javax.jcr.observation.Event;
+
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.api.observation.EventResult;
+
+/**
+ * <code>AddEventListenerTest</code> contains tests for JSR 283 specific
+ * features.
+ */
+public class AddEventListenerTest extends AbstractObservationTest {
+
+    /**
+     * Tests if events are only generated for specified Identifiers.
+     */
+    public void testUUID() throws RepositoryException, NotExecutableException {
+        Node n1 = testRootNode.addNode(nodeName1, testNodeType);
+        Node n2 = testRootNode.addNode(nodeName2, testNodeType);
+        testRootNode.save();
+
+        EventResult listener = new EventResult(log);
+        obsMgr.addEventListener(listener,
+                Event.PROPERTY_ADDED,
+                testRoot,
+                true,
+                new String[]{getIdentifier(n1)},
+                null,
+                false);
+        n1.setProperty(propertyName1, "foo");
+        n2.setProperty(propertyName1, "foo");
+        testRootNode.save();
+
+        Event[] events = listener.getEvents(DEFAULT_WAIT_TIMEOUT);
+        obsMgr.removeEventListener(listener);
+        checkPropertyAdded(events, new String[]{nodeName1 + "/" + propertyName1});
+    }
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/TestAll.java?rev=765337&r1=765336&r2=765337&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/TestAll.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/TestAll.java Wed Apr 15 20:12:52 2009
@@ -29,6 +29,7 @@
     public static Test suite() {
         TestSuite suite = new TestSuite("org.apache.jackrabbit.api.jsr283.observation tests");
 
+        suite.addTestSuite(AddEventListenerTest.class);
         suite.addTestSuite(EventJournalTest.class);
         suite.addTestSuite(GetDateTest.class);
         suite.addTestSuite(GetIdentifierTest.class);