jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1738713 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java
Date Tue, 12 Apr 2016 07:25:31 GMT
Author: mreutegg
Date: Tue Apr 12 07:25:31 2016
New Revision: 1738713

URL: http://svn.apache.org/viewvc?rev=1738713&view=rev
Log:
JCR-3962: NodeReorderTest waits for unexpected events

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java?rev=1738713&r1=1738712&r2=1738713&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/NodeReorderTest.java
Tue Apr 12 07:25:31 2016
@@ -80,20 +80,23 @@ public class NodeReorderTest extends Abs
         testRootNode.addNode(nodeName2, testNodeType);
         testRootNode.addNode(nodeName3, testNodeType);
         testRootNode.getSession().save();
-        EventResult addNodeListener = new EventResult(log);
-        EventResult removeNodeListener = new EventResult(log);
-        EventResult moveNodeListener = new EventResult(log);
-        addEventListener(addNodeListener, Event.NODE_ADDED);
-        addEventListener(removeNodeListener, Event.NODE_REMOVED);
-        addEventListener(moveNodeListener, Event.NODE_MOVED);
+        EventResult listener = new EventResult(log);
+        addEventListener(listener, Event.NODE_ADDED | Event.NODE_REMOVED | Event.NODE_MOVED);
         testRootNode.orderBefore(nodeName3, nodeName2);
         testRootNode.getSession().save();
-        added.addAll(Arrays.asList(addNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT)));
-        removed.addAll(Arrays.asList(removeNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT)));
-        moved.addAll(Arrays.asList(moveNodeListener.getEvents(DEFAULT_WAIT_TIMEOUT)));
-        removeEventListener(addNodeListener);
-        removeEventListener(removeNodeListener);
-        removeEventListener(moveNodeListener);
+        List<Event> events = Arrays.asList(listener.getEvents(DEFAULT_WAIT_TIMEOUT));
+        for (Event e : events) {
+            if (e.getType() == Event.NODE_ADDED) {
+                added.add(e);
+            } else if (e.getType() == Event.NODE_REMOVED) {
+                removed.add(e);
+            } else if (e.getType() == Event.NODE_MOVED) {
+                moved.add(e);
+            } else {
+                fail("unexpected event type: " + e.getType());
+            }
+        }
+        removeEventListener(listener);
     }
 
     /**



Mime
View raw message