Madan Jampani

Fix EventuallyConsistentMapImpl unit tests.

Change-Id: I5d114bac40c16d0f67330ba2b4b922a4301666b2
......@@ -85,7 +85,7 @@ public class EventuallyConsistentMapImpl<K, V>
private final ScheduledExecutorService backgroundExecutor;
private final ExecutorService broadcastMessageExecutor;
private ExecutorService broadcastMessageExecutor;
private volatile boolean destroyed = false;
private static final String ERROR_DESTROYED = " map is already destroyed";
......@@ -188,6 +188,18 @@ public class EventuallyConsistentMapImpl<K, V>
};
}
/**
* Sets the executor to use for broadcasting messages and returns this
* instance for method chaining.
* @param executor executor service
* @return this instance
*/
public EventuallyConsistentMapImpl<K, V> withBroadcastMessageExecutor(ExecutorService executor) {
checkNotNull(executor, "Null executor");
broadcastMessageExecutor = executor;
return this;
}
@Override
public int size() {
checkState(!destroyed, mapName + ERROR_DESTROYED);
......
......@@ -17,10 +17,10 @@ package org.onosproject.store.ecmap;
import com.google.common.collect.ComparisonChain;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.onlab.packet.IpAddress;
import org.onlab.util.KryoNamespace;
......@@ -60,8 +60,6 @@ import static org.junit.Assert.fail;
/**
* Unit tests for EventuallyConsistentMapImpl.
*/
// FIXME: fix this test
@Ignore
public class EventuallyConsistentMapImplTest {
private EventuallyConsistentMap<String, String> ecMap;
......@@ -144,7 +142,8 @@ public class EventuallyConsistentMapImplTest {
ecMap = new EventuallyConsistentMapImpl<>(MAP_NAME, clusterService,
clusterCommunicator,
serializer, clockService);
serializer, clockService)
.withBroadcastMessageExecutor(MoreExecutors.newDirectExecutorService());
// Reset ready for tests to add their own expectations
reset(clusterCommunicator);
......