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 2015/12/29 14:59:37 UTC
svn commit: r1722132 - in
/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it:
AbstractJobHandlingTest.java ClassloadingTest.java OrderedQueueTest.java
TopicMatchingTest.java
Author: cziegeler
Date: Tue Dec 29 13:59:36 2015
New Revision: 1722132
URL: http://svn.apache.org/viewvc?rev=1722132&view=rev
Log:
Clean up tests
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/OrderedQueueTest.java
sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TopicMatchingTest.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=1722132&r1=1722131&r2=1722132&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 Tue Dec 29 13:59:36 2015
@@ -271,11 +271,11 @@ public abstract class AbstractJobHandlin
/**
* Helper method to register an event handler
*/
- protected ServiceRegistration registerEventHandler(final String topic,
+ protected ServiceRegistration<EventHandler> registerEventHandler(final String topic,
final EventHandler handler) {
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(EventConstants.EVENT_TOPIC, topic);
- final ServiceRegistration reg = this.bc.registerService(EventHandler.class.getName(),
+ final ServiceRegistration<EventHandler> reg = this.bc.registerService(EventHandler.class,
handler, props);
return reg;
}
@@ -308,12 +308,12 @@ public abstract class AbstractJobHandlin
/**
* Helper method to register a job consumer
*/
- protected ServiceRegistration registerJobConsumer(final String topic,
+ protected ServiceRegistration<JobConsumer> registerJobConsumer(final String topic,
final JobConsumer handler) {
long cc = this.getConsumerChangeCount();
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(JobConsumer.PROPERTY_TOPICS, topic);
- final ServiceRegistration reg = this.bc.registerService(JobConsumer.class.getName(),
+ final ServiceRegistration<JobConsumer> reg = this.bc.registerService(JobConsumer.class,
handler, props);
this.waitConsumerChangeCount(cc + 1);
return reg;
@@ -322,12 +322,12 @@ public abstract class AbstractJobHandlin
/**
* Helper method to register a job executor
*/
- protected ServiceRegistration registerJobExecutor(final String topic,
+ protected ServiceRegistration<JobExecutor> registerJobExecutor(final String topic,
final JobExecutor handler) {
long cc = this.getConsumerChangeCount();
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put(JobConsumer.PROPERTY_TOPICS, topic);
- final ServiceRegistration reg = this.bc.registerService(JobExecutor.class.getName(),
+ final ServiceRegistration<JobExecutor> reg = this.bc.registerService(JobExecutor.class,
handler, props);
this.waitConsumerChangeCount(cc + 1);
return reg;
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=1722132&r1=1722131&r2=1722132&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 Tue Dec 29 13:59:36 2015
@@ -19,6 +19,7 @@
package org.apache.sling.event.it;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.io.IOException;
import java.io.Serializable;
@@ -84,12 +85,12 @@ public class ClassloadingTest extends Ab
this.removeConfiguration(this.queueConfigPid);
super.cleanup();
}
-/*
+
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void testSimpleClassloading() throws Exception {
final AtomicInteger processedJobsCount = new AtomicInteger(0);
final List<Event> finishedEvents = Collections.synchronizedList(new ArrayList<Event>());
- final ServiceRegistration jcReg = this.registerJobConsumer(TOPIC,
+ final ServiceRegistration<JobConsumer> jcReg = this.registerJobConsumer(TOPIC,
new JobConsumer() {
@Override
public JobResult process(Job job) {
@@ -97,7 +98,7 @@ public class ClassloadingTest extends Ab
return JobResult.OK;
}
});
- final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
+ final ServiceRegistration<EventHandler> ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
@@ -112,7 +113,7 @@ public class ClassloadingTest extends Ab
list.add("1");
list.add("2");
- final EventPropertiesMap map = new EventPropertiesMap();
+ final Map<String, String> map = new HashMap<String, String>();
map.put("a", "a1");
map.put("b", "b2");
@@ -163,12 +164,12 @@ public class ClassloadingTest extends Ab
ehReg.unregister();
}
}
-*/
+
@Test(timeout = DEFAULT_TEST_TIMEOUT)
public void testFailedClassloading() throws Exception {
final AtomicInteger failedJobsCount = new AtomicInteger(0);
final List<Event> finishedEvents = Collections.synchronizedList(new ArrayList<Event>());
- final ServiceRegistration jcReg = this.registerJobConsumer(TOPIC + "/failed",
+ final ServiceRegistration<JobConsumer> jcReg = this.registerJobConsumer(TOPIC + "/failed",
new JobConsumer() {
@Override
@@ -177,7 +178,7 @@ public class ClassloadingTest extends Ab
return JobResult.OK;
}
});
- final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
+ final ServiceRegistration<EventHandler> ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
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=1722132&r1=1722131&r2=1722132&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 Tue Dec 29 13:59:36 2015
@@ -93,7 +93,7 @@ public class OrderedQueueTest extends Ab
final Barrier cb = new Barrier(2);
final AtomicInteger count = new AtomicInteger(0);
final AtomicInteger parallelCount = new AtomicInteger(0);
- final ServiceRegistration jcReg = this.registerJobConsumer("sling/orderedtest/*",
+ final ServiceRegistration<JobConsumer> jcReg = this.registerJobConsumer("sling/orderedtest/*",
new JobConsumer() {
private volatile int lastCounter = -1;
@@ -130,7 +130,7 @@ public class OrderedQueueTest extends Ab
return JobResult.OK;
}
});
- final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
+ final ServiceRegistration<EventHandler> ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TopicMatchingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TopicMatchingTest.java?rev=1722132&r1=1722131&r2=1722132&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TopicMatchingTest.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/TopicMatchingTest.java Tue Dec 29 13:59:36 2015
@@ -62,7 +62,7 @@ public class TopicMatchingTest extends A
public void testSimpleMatching() throws Exception {
final Barrier barrier = new Barrier(2);
- final ServiceRegistration reg = this.registerJobExecutor("sling/test/*",
+ final ServiceRegistration<JobExecutor> reg = this.registerJobExecutor("sling/test/*",
new JobExecutor() {
@Override
@@ -70,7 +70,7 @@ public class TopicMatchingTest extends A
return context.result().succeeded();
}
});
- final ServiceRegistration eventHandler = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
+ final ServiceRegistration<EventHandler> eventHandler = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
@@ -95,7 +95,7 @@ public class TopicMatchingTest extends A
public void testDeepMatching() throws Exception {
final Barrier barrier = new Barrier(2);
- final ServiceRegistration reg = this.registerJobExecutor("sling/**",
+ final ServiceRegistration<JobExecutor> reg = this.registerJobExecutor("sling/**",
new JobExecutor() {
@Override
@@ -103,7 +103,7 @@ public class TopicMatchingTest extends A
return context.result().succeeded();
}
});
- final ServiceRegistration eventHandler = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
+ final ServiceRegistration<EventHandler> eventHandler = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
@@ -130,7 +130,7 @@ public class TopicMatchingTest extends A
final Barrier barrier2 = new Barrier(2);
final Barrier barrier3 = new Barrier(2);
- final ServiceRegistration reg1 = this.registerJobExecutor("sling/**",
+ final ServiceRegistration<JobExecutor> reg1 = this.registerJobExecutor("sling/**",
new JobExecutor() {
@Override
@@ -139,7 +139,7 @@ public class TopicMatchingTest extends A
return context.result().succeeded();
}
});
- final ServiceRegistration reg2 = this.registerJobExecutor("sling/test/*",
+ final ServiceRegistration<JobExecutor> reg2 = this.registerJobExecutor("sling/test/*",
new JobExecutor() {
@Override
@@ -148,7 +148,7 @@ public class TopicMatchingTest extends A
return context.result().succeeded();
}
});
- final ServiceRegistration reg3 = this.registerJobExecutor(TOPIC,
+ final ServiceRegistration<JobExecutor> reg3 = this.registerJobExecutor(TOPIC,
new JobExecutor() {
@Override