sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1533796 - /sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/
Date Sat, 19 Oct 2013 17:40:23 GMT
Author: cziegeler
Date: Sat Oct 19 17:40:23 2013
New Revision: 1533796

URL: http://svn.apache.org/r1533796
Log:
Clean up after each it test

Modified:
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/AbstractJobHandlingTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DeprecatedTimedJobsTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DropQueueTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/HistoryTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/IgnoreQueueTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/JobHandlingTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/OrderedQueueTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/RoundRobinQueueTest.java
    sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TimedJobsTest.java

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/AbstractJobHandlingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/AbstractJobHandlingTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/AbstractJobHandlingTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/AbstractJobHandlingTest.java
Sat Oct 19 17:40:23 2013
@@ -32,6 +32,11 @@ import java.util.Hashtable;
 
 import javax.inject.Inject;
 
+import org.apache.sling.api.resource.LoginException;
+import org.apache.sling.api.resource.PersistenceException;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.event.impl.jobs.JobManagerConfiguration;
 import org.apache.sling.event.jobs.JobManager;
 import org.apache.sling.event.jobs.consumer.JobConsumer;
@@ -189,6 +194,28 @@ public abstract class AbstractJobHandlin
         this.bc.registerService(StartupHandler.class.getName(), handler, null);
     }
 
+    public void cleanup() {
+        final ServiceReference ref = this.bc.getServiceReference(ResourceResolverFactory.class.getName());
+        final ResourceResolverFactory factory = (ResourceResolverFactory) this.bc.getService(ref);
+        ResourceResolver resolver = null;
+        try {
+            resolver = factory.getAdministrativeResourceResolver(null);
+            final Resource rsrc = resolver.getResource(JobManagerConfiguration.DEFAULT_REPOSITORY_PATH);
+            if ( rsrc != null ) {
+                resolver.delete(rsrc);
+                resolver.commit();
+            }
+        } catch ( final LoginException le ) {
+            // ignore
+        } catch (final PersistenceException e) {
+            // ignore
+        } finally {
+            if ( resolver != null ) {
+                resolver.close();
+            }
+        }
+    }
+
     /**
      * Helper method to register an event handler
      */

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
Sat Oct 19 17:40:23 2013
@@ -84,7 +84,7 @@ public class ClassloadingTest extends Ab
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfigPid);
-
+        super.cleanup();
     }
 
     @Test(timeout = DEFAULT_TEST_TIMEOUT)

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DeprecatedTimedJobsTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DeprecatedTimedJobsTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DeprecatedTimedJobsTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DeprecatedTimedJobsTest.java
Sat Oct 19 17:40:23 2013
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.Atomi
 import javax.inject.Inject;
 
 import org.apache.sling.event.EventUtil;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -57,6 +58,12 @@ public class DeprecatedTimedJobsTest ext
         this.sleep(1000L);
     }
 
+    @Override
+    @After
+    public void cleanup() {
+        super.cleanup();
+    }
+
     @Test(timeout = DEFAULT_TEST_TIMEOUT)
     public void testTimedJob() throws Exception {
         final AtomicInteger counter = new AtomicInteger();

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DropQueueTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DropQueueTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DropQueueTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/DropQueueTest.java
Sat Oct 19 17:40:23 2013
@@ -74,7 +74,7 @@ public class DropQueueTest extends Abstr
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
-
+        super.cleanup();
     }
 
     @Test(timeout = DEFAULT_TEST_TIMEOUT)

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/HistoryTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/HistoryTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/HistoryTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/HistoryTest.java
Sat Oct 19 17:40:23 2013
@@ -79,6 +79,7 @@ public class HistoryTest extends Abstrac
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
+        super.cleanup();
     }
 
     private Job addJob(final long counter) {

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/IgnoreQueueTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/IgnoreQueueTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/IgnoreQueueTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/IgnoreQueueTest.java
Sat Oct 19 17:40:23 2013
@@ -71,7 +71,7 @@ public class IgnoreQueueTest extends Abs
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
-
+        super.cleanup();
     }
 
     @Test(timeout = DEFAULT_TEST_TIMEOUT)

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/JobHandlingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/JobHandlingTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/JobHandlingTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/JobHandlingTest.java
Sat Oct 19 17:40:23 2013
@@ -84,7 +84,7 @@ public class JobHandlingTest extends Abs
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
-
+        super.cleanup();
     }
 
     /**

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/OrderedQueueTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/OrderedQueueTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/OrderedQueueTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/OrderedQueueTest.java
Sat Oct 19 17:40:23 2013
@@ -76,7 +76,7 @@ public class OrderedQueueTest extends Ab
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
-
+        super.cleanup();
     }
 
     /**

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/RoundRobinQueueTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/RoundRobinQueueTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/RoundRobinQueueTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/RoundRobinQueueTest.java
Sat Oct 19 17:40:23 2013
@@ -81,7 +81,7 @@ public class RoundRobinQueueTest extends
     @After
     public void cleanUp() throws IOException {
         this.removeConfiguration(this.queueConfPid);
-
+        super.cleanup();
     }
 
     @Test(timeout = DEFAULT_TEST_TIMEOUT)

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TimedJobsTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TimedJobsTest.java?rev=1533796&r1=1533795&r2=1533796&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TimedJobsTest.java
(original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TimedJobsTest.java
Sat Oct 19 17:40:23 2013
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.sling.event.jobs.Job;
 import org.apache.sling.event.jobs.ScheduledJobInfo;
 import org.apache.sling.event.jobs.consumer.JobConsumer;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -50,6 +51,12 @@ public class TimedJobsTest extends Abstr
         this.sleep(1000L);
     }
 
+    @Override
+    @After
+    public void cleanup() {
+        super.cleanup();
+    }
+
     @Test(timeout = DEFAULT_TEST_TIMEOUT)
     public void testTimedJob() throws Exception {
         final AtomicInteger counter = new AtomicInteger();



Mime
View raw message