jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r772245 - in /jackrabbit/trunk: jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/
Date Wed, 06 May 2009 13:35:18 GMT
Author: reschke
Date: Wed May  6 13:35:18 2009
New Revision: 772245

URL: http://svn.apache.org/viewvc?rev=772245&view=rev
Log:
JCR-2085: move those EventJournal tests to jackrabbit-jcr-tests which do not rely on a specific
Jackrabbit feature.

Added:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
      - copied, changed from r772223, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/TestAll.java

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=772245&r1=772244&r2=772245&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
Wed May  6 13:35:18 2009
@@ -22,7 +22,6 @@
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
-import javax.jcr.Session;
 import javax.jcr.observation.Event;
 import javax.jcr.observation.EventJournal;
 
@@ -34,6 +33,10 @@
  */
 public class EventJournalTest extends AbstractObservationTest {
 
+    // TODO: most tests have been migrated over to jackrabbit-jcr-tests
+    // TODO: what's left here relies on Jackrabbit's ObservationManager
+    // TODO: allowing to specify filters when getting the EventJournal
+    
     private EventJournal journal;
 
     protected void setUp() throws Exception {
@@ -41,63 +44,6 @@
         journal = getEventJournal(ALL_TYPES, "/", true, null, null);
     }
 
-    public void testSkipToNow() throws RepositoryException {
-        // skip everything
-        journal.skipTo(System.currentTimeMillis());
-        assertFalse(journal.hasNext());
-    }
-
-    public void testSkipTo() throws Exception {
-        long time = System.currentTimeMillis();
-
-        // add some nodes
-        Node n1 = testRootNode.addNode(nodeName1);
-        Node n2 = testRootNode.addNode(nodeName2);
-
-        // make sure some time passed otherwise we might
-        // skip this change as well.
-        while (time == System.currentTimeMillis()) {
-            Thread.sleep(1);
-        }
-
-        // now save
-        superuser.save();
-
-        journal.skipTo(time);
-        // at least the two added nodes must be returned by the journal
-        checkJournal(new String[]{n1.getPath(), n2.getPath()}, new String[0]);
-    }
-
-    public void testLiveJournal() throws RepositoryException {
-        journal.skipTo(System.currentTimeMillis());
-        assertFalse(journal.hasNext());
-
-        testRootNode.addNode(nodeName1);
-        superuser.save();
-
-        assertTrue(journal.hasNext());
-    }
-
-    public void testWorkspaceSeparation() throws RepositoryException {
-        journal.skipTo(System.currentTimeMillis());
-        assertFalse(journal.hasNext());
-
-        Session session = helper.getSuperuserSession(workspaceName);
-        try {
-            Node rootNode = session.getRootNode();
-            if (rootNode.hasNode(nodeName1)) {
-                rootNode.getNode(nodeName1).remove();
-            } else {
-                rootNode.addNode(nodeName1);
-            }
-            session.save();
-        } finally {
-            session.logout();
-        }
-
-        assertFalse(journal.hasNext());
-    }
-
     public void testEventType() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1);
 
@@ -122,18 +68,6 @@
         checkJournal(new String[]{n2.getPath()}, new String[]{n1.getPath()});
     }
 
-    public void testIsDeepTrue() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1);
-        Node n2 = n1.addNode(nodeName2);
-
-        journal = getEventJournal(ALL_TYPES, testRoot, true, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n1.getPath(), n2.getPath()}, new String[0]);
-    }
-
     public void testIsDeepFalse() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1);
         Node n2 = n1.addNode(nodeName2);
@@ -146,23 +80,6 @@
         checkJournal(new String[]{n1.getPath()}, new String[]{n2.getPath()});
     }
 
-    public void testUUID() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1);
-        if (!n1.isNodeType(mixReferenceable)) {
-            n1.addMixin(mixReferenceable);
-        }
-        superuser.save();
-
-        Node n2 = n1.addNode(nodeName2);
-
-        journal = getEventJournal(ALL_TYPES, "/", true, new String[]{n1.getIdentifier()},
null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n2.getPath()}, new String[0]);
-    }
-
     public void testNodeType() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1, "nt:folder");
         Node n2 = n1.addNode(nodeName2, "nt:folder");
@@ -176,20 +93,6 @@
         checkJournal(new String[]{n2.getPath()}, new String[]{n1.getPath()});
     }
 
-    public void testUserData() throws RepositoryException {
-        testRootNode.addNode(nodeName1);
-        String data = createRandomString(5);
-        obsMgr.setUserData(data);
-
-        journal = getEventJournal(ALL_TYPES, testRoot, true, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        assertTrue("no more events", journal.hasNext());
-        assertEquals("Wrong user data", data, journal.nextEvent().getUserData());
-    }
-
     //-------------------------------< internal >-------------------------------
 
     private EventJournal getEventJournal(int eventTypes,

Copied: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
(from r772223, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java?p2=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java&r1=772223&r2=772245&rev=772245&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/EventJournalTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
Wed May  6 13:35:18 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.api.jsr283.observation;
+package org.apache.jackrabbit.test.api.observation;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -23,12 +23,8 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.observation.Event;
 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.
  */
@@ -38,7 +34,7 @@
 
     protected void setUp() throws Exception {
         super.setUp();
-        journal = getEventJournal(ALL_TYPES, "/", true, null, null);
+        journal = obsMgr.getEventJournal();
     }
 
     public void testSkipToNow() throws RepositoryException {
@@ -98,35 +94,11 @@
         assertFalse(journal.hasNext());
     }
 
-    public void testEventType() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1);
-
-        journal = getEventJournal(Event.PROPERTY_ADDED, testRoot, true, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n1.getPath() + "/" + jcrPrimaryType},
-                new String[]{n1.getPath()});
-    }
-
-    public void testPath() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1);
-        Node n2 = n1.addNode(nodeName2);
-
-        journal = getEventJournal(ALL_TYPES, n1.getPath(), true, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n2.getPath()}, new String[]{n1.getPath()});
-    }
-
     public void testIsDeepTrue() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1);
         Node n2 = n1.addNode(nodeName2);
 
-        journal = getEventJournal(ALL_TYPES, testRoot, true, null, null);
+        journal = obsMgr.getEventJournal();
         journal.skipTo(System.currentTimeMillis());
 
         superuser.save();
@@ -134,18 +106,6 @@
         checkJournal(new String[]{n1.getPath(), n2.getPath()}, new String[0]);
     }
 
-    public void testIsDeepFalse() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1);
-        Node n2 = n1.addNode(nodeName2);
-
-        journal = getEventJournal(ALL_TYPES, testRoot, false, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n1.getPath()}, new String[]{n2.getPath()});
-    }
-
     public void testUUID() throws RepositoryException {
         Node n1 = testRootNode.addNode(nodeName1);
         if (!n1.isNodeType(mixReferenceable)) {
@@ -155,7 +115,7 @@
 
         Node n2 = n1.addNode(nodeName2);
 
-        journal = getEventJournal(ALL_TYPES, "/", true, new String[]{n1.getIdentifier()},
null);
+        journal = obsMgr.getEventJournal();
         journal.skipTo(System.currentTimeMillis());
 
         superuser.save();
@@ -163,25 +123,12 @@
         checkJournal(new String[]{n2.getPath()}, new String[0]);
     }
 
-    public void testNodeType() throws RepositoryException {
-        Node n1 = testRootNode.addNode(nodeName1, "nt:folder");
-        Node n2 = n1.addNode(nodeName2, "nt:folder");
-
-        journal = getEventJournal(ALL_TYPES, testRoot, true, null,
-                new String[]{"nt:folder"});
-        journal.skipTo(System.currentTimeMillis());
-
-        superuser.save();
-
-        checkJournal(new String[]{n2.getPath()}, new String[]{n1.getPath()});
-    }
-
     public void testUserData() throws RepositoryException {
         testRootNode.addNode(nodeName1);
         String data = createRandomString(5);
         obsMgr.setUserData(data);
 
-        journal = getEventJournal(ALL_TYPES, testRoot, true, null, null);
+        journal = obsMgr.getEventJournal();
         journal.skipTo(System.currentTimeMillis());
 
         superuser.save();
@@ -192,17 +139,6 @@
 
     //-------------------------------< internal >-------------------------------
 
-    private EventJournal getEventJournal(int eventTypes,
-                                        String absPath,
-                                        boolean isDeep,
-                                        String[] uuid,
-                                        String[] nodeTypeName)
-            throws RepositoryException {
-        // TODO: remove cast when JCR 2.0 is final
-        return ((ObservationManagerImpl) superuser.getWorkspace().getObservationManager()).getEventJournal(
-                eventTypes, absPath, isDeep, uuid, nodeTypeName);
-    }
-
     /**
      * Checks the journal for events.
      *

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/TestAll.java?rev=772245&r1=772244&r2=772245&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/TestAll.java
Wed May  6 13:35:18 2009
@@ -51,6 +51,7 @@
 
         // JCR 2.0
         
+        suite.addTestSuite(EventJournalTest.class);
         suite.addTestSuite(GetDateTest.class);
         suite.addTestSuite(GetIdentifierTest.class);
         suite.addTestSuite(GetInfoTest.class);



Mime
View raw message