jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r771669 - in /jackrabbit/trunk: jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/...
Date Tue, 05 May 2009 11:27:50 GMT
Author: reschke
Date: Tue May  5 11:27:40 2009
New Revision: 771669

URL: http://svn.apache.org/viewvc?rev=771669&view=rev
Log:
JCR-2085: move JCR 2.0 related code in AbstractObservationTest into existing base class in
jackrabbit-jcr-tests

Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetDateTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetIdentifierTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetInfoTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetUserDataTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeMovedTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeReorderTest.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ShareableNodesTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AbstractObservationTest.java

Modified: 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=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AddEventListenerTest.java
Tue May  5 11:27:40 2009
@@ -21,6 +21,7 @@
 import javax.jcr.observation.Event;
 
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 import org.apache.jackrabbit.test.api.observation.EventResult;
 
 /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
Tue May  5 11:27:40 2009
@@ -27,6 +27,7 @@
 import javax.jcr.observation.EventJournal;
 
 import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 
 /**
  * <code>EventJournalTest</code> performs EventJournal tests.

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetDateTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetDateTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetDateTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetDateTest.java
Tue May  5 11:27:40 2009
@@ -25,6 +25,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
 
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
+
 /**
  * <code>GetDateTest</code> checks if the dates returned by events are
  * monotonically increasing.

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetIdentifierTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetIdentifierTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetIdentifierTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetIdentifierTest.java
Tue May  5 11:27:40 2009
@@ -21,6 +21,8 @@
 import javax.jcr.Property;
 import javax.jcr.observation.Event;
 
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
+
 /**
  * <code>IdentifierTest</code> checks if the identifier of an event is correct.
  */

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetInfoTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetInfoTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetInfoTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetInfoTest.java
Tue May  5 11:27:40 2009
@@ -21,6 +21,8 @@
 import javax.jcr.Property;
 import javax.jcr.observation.Event;
 
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
+
 /**
  * <code>GetInfoTest</code> checks that the info map is empty for event types:
  * {@link Event#NODE_ADDED}, {@link Event#NODE_REMOVED},

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetUserDataTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetUserDataTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetUserDataTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/GetUserDataTest.java
Tue May  5 11:27:40 2009
@@ -22,6 +22,7 @@
 import javax.jcr.observation.Event;
 
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 
 /**
  * <code>GetUserDataTest</code> performs observation tests with user data set

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeMovedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeMovedTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeMovedTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeMovedTest.java
Tue May  5 11:27:40 2009
@@ -22,6 +22,7 @@
 import javax.jcr.Node;
 import javax.jcr.observation.Event;
 
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 import org.apache.jackrabbit.test.api.observation.EventResult;
 
 /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeReorderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeReorderTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeReorderTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/NodeReorderTest.java
Tue May  5 11:27:40 2009
@@ -19,6 +19,7 @@
 import java.util.Map;
 
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 import org.apache.jackrabbit.test.api.observation.EventResult;
 
 import javax.jcr.RepositoryException;

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ShareableNodesTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ShareableNodesTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ShareableNodesTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/observation/ShareableNodesTest.java
Tue May  5 11:27:40 2009
@@ -21,8 +21,8 @@
 import javax.jcr.Workspace;
 import javax.jcr.observation.Event;
 
+import org.apache.jackrabbit.test.api.observation.AbstractObservationTest;
 import org.apache.jackrabbit.test.api.observation.EventResult;
-import org.apache.jackrabbit.api.jsr283.observation.AbstractObservationTest;
 import org.apache.jackrabbit.core.NodeImpl;
 
 /**

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AbstractObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AbstractObservationTest.java?rev=771669&r1=771668&r2=771669&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AbstractObservationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/AbstractObservationTest.java
Tue May  5 11:27:40 2009
@@ -16,21 +16,22 @@
  */
 package org.apache.jackrabbit.test.api.observation;
 
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.NotExecutableException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventListener;
-import javax.jcr.observation.ObservationManager;
 import javax.jcr.observation.EventListenerIterator;
+import javax.jcr.observation.ObservationManager;
 
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * This class implements the basic {@link #setUp} and {@link #tearDown()}
@@ -43,6 +44,9 @@
      */
     protected static final long DEFAULT_WAIT_TIMEOUT = 5000;
 
+
+    protected static final int ALL_TYPES = Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED
| Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED | javax.jcr.observation.Event.NODE_MOVED;
+
     /**
      * The <code>ObservationManager</code>
      */
@@ -245,4 +249,52 @@
                     optional.contains(path));
         }
     }
+    
+
+    /**
+     * Registers an event listener for the passed <code>eventTypes</code> and
+     * calls the callable.
+     *
+     * @param call       the callable.
+     * @param eventTypes the types of the events to listen for.
+     * @return the events that were generated during execution of the callable.
+     * @throws RepositoryException if an error occurs.
+     */
+    protected Event[] getEvents(Callable call, int eventTypes)
+            throws RepositoryException {
+        EventResult result = new EventResult(log);
+        addEventListener(result, eventTypes);
+        call.call();
+        Event[] events = result.getEvents(DEFAULT_WAIT_TIMEOUT);
+        removeEventListener(result);
+        return events;
+    }
+
+    /**
+     * Returns the first event with the given <code>path</code>.
+     *
+     * @param events the events.
+     * @param path   the path.
+     * @return the event with the given <code>path</code> or {@link #fail()}s
if
+     *         no such event exists.
+     * @throws RepositoryException if an error occurs while reading from the
+     *                             repository.
+     */
+    protected Event getEventByPath(Event[] events, String path)
+            throws RepositoryException {
+        for (int i = 0; i < events.length; i++) {
+            if (events[i].getPath().equals(path)) {
+                return events[i];
+            }
+        }
+        fail("no event with path: " + path + " in " + Arrays.asList(events));
+        return null;
+    }
+    
+    /**
+     * Helper interface.
+     */
+    protected interface Callable {
+        public void call() throws RepositoryException;
+    }
 }



Mime
View raw message