jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r771658 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/
Date Tue, 05 May 2009 10:38:48 GMT
Author: reschke
Date: Tue May  5 10:38:45 2009
New Revision: 771658

URL: http://svn.apache.org/viewvc?rev=771658&view=rev
Log:
JCR-2085: cleanup after switch to JCR 2.0

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java
    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

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java?rev=771658&r1=771657&r2=771658&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/jsr283/observation/AbstractObservationTest.java
Tue May  5 10:38:45 2009
@@ -16,15 +16,12 @@
  */
 package org.apache.jackrabbit.api.jsr283.observation;
 
-import java.util.Map;
 import java.util.Arrays;
 
-import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.observation.Event;
 
 import org.apache.jackrabbit.test.api.observation.EventResult;
-import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
 
 /**
  * <code>AbstractObservationTest</code> is a base class with utility methods
@@ -33,43 +30,8 @@
 public abstract class AbstractObservationTest
         extends org.apache.jackrabbit.test.api.observation.AbstractObservationTest {
 
-    /**
-     * TODO: remove when JSR 283 is final
-     */
-    protected static final int NODE_MOVED = javax.jcr.observation.Event.NODE_MOVED;
-
     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;
 
-    protected void setUserData(String userData) throws RepositoryException {
-        // TODO: remove when JCR 2.0 is final
-        ((ObservationManagerImpl) obsMgr).setUserData(userData);
-    }
-
-    protected static String getUserData(Event e) throws RepositoryException {
-        // TODO: remove when JCR 2.0 is final
-        return ((javax.jcr.observation.Event) e).getUserData();
-    }
-
-    protected String getIdentifier(Node node) throws RepositoryException {
-        // TODO: remove when JSR 283 is final
-        return ((javax.jcr.Node) node).getIdentifier();
-    }
-
-    protected String getIdentifier(Event event) throws RepositoryException {
-        // TODO: remove when JSR 283 is final
-        return ((javax.jcr.observation.Event) event).getIdentifier();
-    }
-
-    protected Map getInfo(Event event) throws RepositoryException {
-        // TODO: remove when JSR 283 is final
-        return ((javax.jcr.observation.Event) event).getInfo();
-    }
-
-    protected long getDate(Event event) throws RepositoryException {
-        // TODO: remove when JSR 283 is final
-        return ((javax.jcr.observation.Event) event).getDate();
-    }
-
     /**
      * Returns the first event with the given <code>path</code>.
      *

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -42,7 +42,7 @@
                 Event.PROPERTY_ADDED,
                 testRoot,
                 true,
-                new String[]{getIdentifier(n1)},
+                new String[]{n1.getIdentifier()},
                 null,
                 false);
         n1.setProperty(propertyName1, "foo");

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -154,7 +154,7 @@
 
         Node n2 = n1.addNode(nodeName2);
 
-        journal = getEventJournal(ALL_TYPES, "/", true, new String[]{n1.getUUID()}, null);
+        journal = getEventJournal(ALL_TYPES, "/", true, new String[]{n1.getIdentifier()},
null);
         journal.skipTo(System.currentTimeMillis());
 
         superuser.save();
@@ -178,7 +178,7 @@
     public void testUserData() throws RepositoryException {
         testRootNode.addNode(nodeName1);
         String data = createRandomString(5);
-        setUserData(data);
+        obsMgr.setUserData(data);
 
         journal = getEventJournal(ALL_TYPES, testRoot, true, null, null);
         journal.skipTo(System.currentTimeMillis());
@@ -186,7 +186,7 @@
         superuser.save();
 
         assertTrue("no more events", journal.hasNext());
-        assertEquals("Wrong user data", data, getUserData(journal.nextEvent()));
+        assertEquals("Wrong user data", data, journal.nextEvent().getUserData());
     }
 
     //-------------------------------< internal >-------------------------------

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -43,7 +43,7 @@
                 }
             }, Event.NODE_ADDED);
             for (int i = 0; i < events.length; i++) {
-                dates.add(new Long(getDate(events[i])));
+                dates.add(new Long(events[i].getDate()));
             }
             try {
                 // wait for a moment

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -34,26 +34,26 @@
             }
         }, Event.NODE_ADDED);
         Node n = testRootNode.getNode(nodeName1);
-        assertEquals(getIdentifier(n), getIdentifier(getEventByPath(events, n.getPath())));
+        assertEquals(n.getIdentifier(), getEventByPath(events, n.getPath()).getIdentifier());
     }
 
     public void testNodeMoved() throws RepositoryException {
         final Node n = testRootNode.addNode(nodeName1, testNodeType);
-        String id = getIdentifier(n);
+        String id = n.getIdentifier();
         testRootNode.save();
         Event[] events = getEvents(new Callable(){
             public void call() throws RepositoryException {
                 superuser.getWorkspace().move(n.getPath(), testRoot + "/" + nodeName2);
             }
-        }, NODE_MOVED);
+        }, Event.NODE_MOVED);
         String path = testRootNode.getNode(nodeName2).getPath();
-        assertEquals(id, getIdentifier(getEventByPath(events, path)));
+        assertEquals(id, getEventByPath(events, path).getIdentifier());
     }
 
     public void testNodeRemoved() throws RepositoryException {
         final Node n = testRootNode.addNode(nodeName1, testNodeType);
         String path = n.getPath();
-        String id = getIdentifier(n);
+        String id = n.getIdentifier();
         testRootNode.save();
         Event[] events = getEvents(new Callable(){
             public void call() throws RepositoryException {
@@ -61,7 +61,7 @@
                 testRootNode.save();
             }
         }, Event.NODE_REMOVED);
-        assertEquals(id, getIdentifier(getEventByPath(events, path)));
+        assertEquals(id, getEventByPath(events, path).getIdentifier());
     }
 
     public void testPropertyAdded() throws RepositoryException {
@@ -73,7 +73,7 @@
         }, Event.PROPERTY_ADDED);
         Node n = testRootNode.getNode(nodeName1);
         Property prop = n.getProperty(propertyName1);
-        assertEquals(getIdentifier(n), getIdentifier(getEventByPath(events, prop.getPath())));
+        assertEquals(n.getIdentifier(), getEventByPath(events, prop.getPath()).getIdentifier());
     }
 
     public void testPropertyChanged() throws RepositoryException {
@@ -86,12 +86,12 @@
                 testRootNode.save();
             }
         }, Event.PROPERTY_CHANGED);
-        assertEquals(getIdentifier(n), getIdentifier(getEventByPath(events, prop.getPath())));
+        assertEquals(n.getIdentifier(), getEventByPath(events, prop.getPath()).getIdentifier());
     }
 
     public void testPropertyRemoved() throws RepositoryException {
         Node n = testRootNode.addNode(nodeName1, testNodeType);
-        String id = getIdentifier(n);
+        String id = n.getIdentifier();
         final Property prop = n.setProperty(propertyName1, "test");
         String propPath = prop.getPath();
         testRootNode.save();
@@ -101,6 +101,6 @@
                 testRootNode.save();
             }
         }, Event.PROPERTY_REMOVED);
-        assertEquals(id, getIdentifier(getEventByPath(events, propPath)));
+        assertEquals(id, getEventByPath(events, propPath).getIdentifier());
     }
 }

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -37,7 +37,7 @@
             }
         }, Event.NODE_ADDED);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("info map must be empty", 0, getInfo(events[i]).size());
+            assertEquals("info map must be empty", 0, events[i].getInfo().size());
         }
     }
 
@@ -51,7 +51,7 @@
             }
         }, Event.NODE_REMOVED);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("info map must be empty", 0, getInfo(events[i]).size());
+            assertEquals("info map must be empty", 0, events[i].getInfo().size());
         }
     }
 
@@ -63,7 +63,7 @@
             }
         }, Event.PROPERTY_ADDED);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("info map must be empty", 0, getInfo(events[i]).size());
+            assertEquals("info map must be empty", 0, events[i].getInfo().size());
         }
     }
 
@@ -77,7 +77,7 @@
             }
         }, Event.PROPERTY_CHANGED);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("info map must be empty", 0, getInfo(events[i]).size());
+            assertEquals("info map must be empty", 0, events[i].getInfo().size());
         }
     }
 
@@ -91,7 +91,7 @@
             }
         }, Event.PROPERTY_REMOVED);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("info map must be empty", 0, getInfo(events[i]).size());
+            assertEquals("info map must be empty", 0, events[i].getInfo().size());
         }
     }
 }

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -71,14 +71,14 @@
         final String data = createRandomString(5);
         Event[] events = getEvents(new Callable() {
             public void call() throws RepositoryException {
-                setUserData(data);
+                obsMgr.setUserData(data);
                 c.call();
             }
         }, eventTypes);
 
         assertTrue("no events returned", events.length > 0);
         for (int i = 0; i < events.length; i++) {
-            assertEquals("Wrong user data", data, getUserData(events[i]));
+            assertEquals("Wrong user data", data, events[i].getUserData());
         }
     }
 

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -79,7 +79,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         superuser.move(n1.getPath(), testRoot + "/" + nodeName3);
         testRootNode.save();
         Event[] added = addNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -118,7 +118,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         superuser.move(n2.getPath(), testRoot + "/" + nodeName2);
         testRootNode.save();
         Event[] added = addNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -158,7 +158,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         // move n2
         superuser.move(n2.getPath(), n3.getPath() + "/" + nodeName2);
         // remove n1
@@ -188,9 +188,9 @@
      */
     protected void checkNodeMoved(Event[] events, String from, String to)
             throws RepositoryException {
-        checkNodes(events, new String[]{to}, null, NODE_MOVED);
+        checkNodes(events, new String[]{to}, null, Event.NODE_MOVED);
         assertEquals("Wrong number of events", 1, events.length);
-        Map info = getInfo(events[0]);
+        Map info = events[0].getInfo();
         checkInfoEntry(info, SRC_ABS_PATH, testRoot + "/" + from);
         checkInfoEntry(info, DEST_ABS_PATH, testRoot + "/" + to);
     }

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=771658&r1=771657&r2=771658&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 10:38:45 2009
@@ -89,7 +89,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         testRootNode.orderBefore(nodeName3, nodeName2);
         testRootNode.save();
         Event[] added = addNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT);
@@ -161,7 +161,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         testRootNode.orderBefore(nodeName1 + "[3]", nodeName1 + "[2]");
         //testRootNode.orderBefore(nodeName1 + "[2]", null);
         testRootNode.save();
@@ -240,7 +240,7 @@
         EventResult moveNodeListener = new EventResult(log);
         addEventListener(addNodeListener, Event.NODE_ADDED);
         addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, NODE_MOVED);
+        addEventListener(moveNodeListener, Event.NODE_MOVED);
         testRootNode.orderBefore(nodeName1 + "[2]", null);
         testRootNode.getNode(nodeName3).remove();
         testRootNode.save();
@@ -294,9 +294,9 @@
     protected void checkNodeReordered(Event[] events, String src,
                                       String dest, String before)
             throws RepositoryException {
-        checkNodes(events, new String[]{dest}, null, NODE_MOVED);
+        checkNodes(events, new String[]{dest}, null, Event.NODE_MOVED);
         assertEquals("Wrong number of events", 1, events.length);
-        Map info = getInfo(events[0]);
+        Map info = events[0].getInfo();
         checkInfoEntry(info, SRC_CHILD_REL_PATH, src);
         checkInfoEntry(info, DEST_CHILD_REL_PATH, before);
     }



Mime
View raw message