Skip to content
Browse files

- TUNNEL_Test: GossipRouter now listens on wildcard address

- RetransmitterTest: using MockTimeScheduler now
  • Loading branch information...
1 parent 6225f2b commit 6ebd0b345bd8d890faf1c5abfff6ed2e06a34755 @belaban committed Oct 7, 2011
View
80 src/org/jgroups/util/MockTimeScheduler.java
@@ -0,0 +1,80 @@
+package org.jgroups.util;
+
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Mock implementation of {@link TimeScheduler}, used by unit tests
+ * @author Bela Ban
+ * @since 3.0
+ */
+public class MockTimeScheduler implements TimeScheduler {
+ public void execute(Runnable command) {
+ }
+
+ public Future<?> schedule(Runnable command, long delay, TimeUnit unit) {
+ return null;
+ }
+
+ public Future<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
+ return null;
+ }
+
+ public Future<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
+ return null;
+ }
+
+ public Future<?> scheduleWithDynamicInterval(Task task) {
+ return null;
+ }
+
+ public void setThreadFactory(ThreadFactory factory) {
+ }
+
+ public String dumpTimerTasks() {
+ return null;
+ }
+
+ public int getMinThreads() {
+ return 0;
+ }
+
+ public void setMinThreads(int size) {
+ }
+
+ public int getMaxThreads() {
+ return 0;
+ }
+
+ public void setMaxThreads(int size) {
+ }
+
+ public long getKeepAliveTime() {
+ return 0;
+ }
+
+ public void setKeepAliveTime(long time) {
+ }
+
+ public int getCurrentThreads() {
+ return 0;
+ }
+
+ public int size() {
+ return 0;
+ }
+
+ public void stop() {
+ }
+
+ public boolean isShutdown() {
+ return false;
+ }
+
+ public ThreadDecorator getThreadDecorator() {
+ return null;
+ }
+
+ public void setThreadDecorator(ThreadDecorator decorator) {
+ }
+}
View
22 tests/junit-functional/org/jgroups/tests/RetransmitterTest.java
@@ -8,9 +8,7 @@
import org.jgroups.stack.ExponentialInterval;
import org.jgroups.stack.RangeBasedRetransmitter;
import org.jgroups.stack.Retransmitter;
-import org.jgroups.util.DefaultTimeScheduler;
-import org.jgroups.util.TimeScheduler;
-import org.jgroups.util.Util;
+import org.jgroups.util.*;
import org.testng.Assert;
import org.testng.annotations.*;
@@ -22,8 +20,12 @@
@BeforeClass
void createTimer() {
- System.out.println("<< create timer");
- timer=new DefaultTimeScheduler();
+ timer=new MockTimeScheduler();
+ }
+
+ @AfterClass
+ void destroyTimer() {
+ timer.stop();
}
@@ -38,17 +40,13 @@ void createTimer() {
old_retransmitter.reset();
return new Retransmitter[][] {
- {range_based_retransmitter},
- {old_retransmitter}
+ {old_retransmitter},
+ {range_based_retransmitter}
};
}
- @AfterClass
- void destroyTimer() throws InterruptedException {
- System.out.println("<< destroy timer");
- timer.stop();
- }
+
@Test(dataProvider="createRetransmitter")
public void testNoEntry(Retransmitter xmitter) {
View
2 tests/junit/org/jgroups/tests/TUNNEL_Test.java
@@ -45,7 +45,7 @@ void startRouter() throws Exception {
else
bind_addr="127.0.0.1";
}
- gossipRouter=new GossipRouter(12001, bind_addr);
+ gossipRouter=new GossipRouter(12001, null);
gossipRouter.start();
}

0 comments on commit 6ebd0b3

Please sign in to comment.
Something went wrong with that request. Please try again.