jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r782683 - 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/EventJournalTest.java
Date Mon, 08 Jun 2009 15:46:18 GMT
Author: reschke
Date: Mon Jun  8 15:46:18 2009
New Revision: 782683

URL: http://svn.apache.org/viewvc?rev=782683&view=rev
Log:
JCR-1104: move remaining EventJournal tests over to jackrabbit-jcr-tests

Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/
Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/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?rev=782683&r1=782682&r2=782683&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
Mon Jun  8 15:46:18 2009
@@ -23,6 +23,7 @@
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.observation.Event;
 import javax.jcr.observation.EventJournal;
 
 /**
@@ -137,8 +138,61 @@
         assertEquals("Wrong user data", data, journal.nextEvent().getUserData());
     }
 
+    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 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 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()});
+    }
+    
     //-------------------------------< internal >-------------------------------
 
+    private EventJournal getEventJournal(int eventTypes, String absPath, boolean isDeep,
String[] uuid, String[] nodeTypeName) throws RepositoryException {
+        return superuser.getWorkspace().getObservationManager().getEventJournal(eventTypes,
absPath, isDeep, uuid, nodeTypeName);
+    }
+
     /**
      * Checks the journal for events.
      *



Mime
View raw message