jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r791457 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/ jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observatio...
Date Mon, 06 Jul 2009 12:21:10 GMT
Author: mreutegg
Date: Mon Jul  6 12:21:10 2009
New Revision: 791457

URL: http://svn.apache.org/viewvc?rev=791457&view=rev
Log:
JCR-2189: Move MemoryJournal from test to main

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
  (contents, props changed)
      - copied, changed from r791245, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryRevision.java
  (props changed)
      - copied unchanged from r791245, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryRevision.java
Removed:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryRevision.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/test/resources/repository.xml

Copied: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
(from r791245, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryJournal.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java?p2=jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryJournal.java&r1=791245&r2=791457&rev=791457&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
Mon Jul  6 12:21:10 2009
@@ -22,6 +22,8 @@
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.NoSuchElementException;
+import java.util.List;
+import java.util.Collections;
 
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceResolver;
 import org.slf4j.Logger;
@@ -55,7 +57,7 @@
     /**
      * List of records.
      */
-    private ArrayList records = new ArrayList();
+    private List<MemoryRecord> records = Collections.synchronizedList(new ArrayList<MemoryRecord>());
 
     /**
      * Set the read delay, i.e. the time in ms to wait before returning
@@ -167,7 +169,7 @@
      *
      * @param records array list that should back up this memory journal
      */
-    public void setRecords(ArrayList records) {
+    public void setRecords(List<MemoryRecord> records) {
         this.records = records;
     }
 
@@ -324,7 +326,7 @@
                 JournalException {
 
             int index = (int) revision;
-            MemoryRecord record = (MemoryRecord) records.get(index);
+            MemoryRecord record = records.get(index);
 
             checkState();
 

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryJournal.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryRevision.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/MemoryRevision.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

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=791457&r1=791456&r2=791457&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 Jul  6 12:21:10 2009
@@ -42,7 +42,7 @@
 
     public void testSkipToNow() throws RepositoryException {
         // skip everything
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
         assertFalse(journal.hasNext());
     }
 
@@ -68,7 +68,7 @@
     }
 
     public void testLiveJournal() throws RepositoryException {
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
         assertFalse(journal.hasNext());
 
         testRootNode.addNode(nodeName1);
@@ -78,7 +78,7 @@
     }
 
     public void testWorkspaceSeparation() throws RepositoryException {
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
         assertFalse(journal.hasNext());
 
         Session session = getHelper().getSuperuserSession(workspaceName);
@@ -102,7 +102,7 @@
         Node n2 = n1.addNode(nodeName2);
 
         journal = obsMgr.getEventJournal();
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -117,7 +117,7 @@
         Node n2 = n1.addNode(nodeName2);
 
         journal = obsMgr.getEventJournal();
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -130,7 +130,7 @@
         obsMgr.setUserData(data);
 
         journal = obsMgr.getEventJournal();
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -142,7 +142,7 @@
         Node n1 = testRootNode.addNode(nodeName1);
 
         journal = getEventJournal(Event.PROPERTY_ADDED, testRoot, true, null, null);
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -155,8 +155,7 @@
         Node n2 = n1.addNode(nodeName2);
 
         journal = getEventJournal(ALL_TYPES, n1.getPath(), true, null, null);
-        journal.skipTo(System.currentTimeMillis());
-
+        skipToNow();
         superuser.save();
 
         checkJournal(new String[]{n2.getPath()}, new String[]{n1.getPath()});
@@ -167,7 +166,7 @@
         Node n2 = n1.addNode(nodeName2);
 
         journal = getEventJournal(ALL_TYPES, testRoot, false, null, null);
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -180,7 +179,7 @@
 
         journal = getEventJournal(ALL_TYPES, testRoot, true, null,
                 new String[]{"nt:folder"});
-        journal.skipTo(System.currentTimeMillis());
+        skipToNow();
 
         superuser.save();
 
@@ -189,6 +188,18 @@
     
     //-------------------------------< internal >-------------------------------
 
+    private void skipToNow() {
+        long now = System.currentTimeMillis();
+        journal.skipTo(now);
+        while (now == System.currentTimeMillis()) {
+            try {
+                Thread.sleep(1);
+            } catch (InterruptedException e) {
+                // ignore
+            }
+        }
+    }
+
     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);
     }

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/test/resources/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/test/resources/repository.xml?rev=791457&r1=791456&r2=791457&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/test/resources/repository.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/test/resources/repository.xml Mon Jul  6 12:21:10
2009
@@ -24,10 +24,7 @@
 -->
 <Repository>
     <Cluster id="node1">
-        <Journal class="org.apache.jackrabbit.core.journal.FileJournal">
-            <param name="revision" value="${rep.home}/repository/revision"/>
-            <param name="directory" value="${rep.home}/repository/journal"/>
-        </Journal>
+        <Journal class="org.apache.jackrabbit.core.journal.MemoryJournal"/>
     </Cluster>
 
     <!--



Mime
View raw message