You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2007/10/30 15:38:16 UTC
svn commit: r590088 - in
/incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl:
AbstractRepositoryEventHandlerTest.java DistributingEventHandlerTest.java
Author: cziegeler
Date: Tue Oct 30 07:38:12 2007
New Revision: 590088
URL: http://svn.apache.org/viewvc?rev=590088&view=rev
Log:
Clean up repository after each test.
Modified:
incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java
incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/DistributingEventHandlerTest.java
Modified: incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java?rev=590088&r1=590087&r2=590088&view=diff
==============================================================================
--- incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java (original)
+++ incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/AbstractRepositoryEventHandlerTest.java Tue Oct 30 07:38:12 2007
@@ -23,6 +23,8 @@
import java.util.Dictionary;
import java.util.Hashtable;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.observation.EventListenerIterator;
@@ -104,6 +106,14 @@
}
@org.junit.After public void shutdown() throws Exception {
+ // delete all child nodes to get a clean repository again
+ final Node rootNode = (Node) session.getItem(this.handler.repositoryPath);
+ final NodeIterator iter = rootNode.getNodes();
+ while ( iter.hasNext() ) {
+ final Node child = iter.nextNode();
+ child.remove();
+ }
+ rootNode.save();
ComponentContext componentContext = this.getMockery().mock(ComponentContext.class);
this.handler.deactivate(componentContext);
}
Modified: incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/DistributingEventHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/DistributingEventHandlerTest.java?rev=590088&r1=590087&r2=590088&view=diff
==============================================================================
--- incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/DistributingEventHandlerTest.java (original)
+++ incubator/sling/trunk/event/src/test/java/org/apache/sling/event/impl/DistributingEventHandlerTest.java Tue Oct 30 07:38:12 2007
@@ -65,10 +65,6 @@
assertTrue(Calendar.getInstance().compareTo(eventNode.getProperty(EventHelper.NODE_PROPERTY_CREATED).getDate()) >= 0);
// as a starting point we just check if the properties property exists
assertTrue(eventNode.hasProperty(EventHelper.NODE_PROPERTY_PROPERTIES));
-
- // now we remove the node to have a clean repo
- eventNode.remove();
- rootNode.save();
}
@org.junit.Test public void testWriteEventPlusAppId() throws Exception {
@@ -87,9 +83,5 @@
assertTrue(Calendar.getInstance().compareTo(eventNode.getProperty(EventHelper.NODE_PROPERTY_CREATED).getDate()) >= 0);
// as a starting point we just check if the properties property exists
assertTrue(eventNode.hasProperty(EventHelper.NODE_PROPERTY_PROPERTIES));
-
- // now we remove the node to have a clean repo
- eventNode.remove();
- rootNode.save();
}
}