Jonathan Hart
Committed by Gerrit Code Review

Move GossipDeviceStore away from deprecated ClusterCommunicationService API

Change-Id: Ib0ca7125e17013156aac27f8437ca717a96a56f0
...@@ -17,7 +17,6 @@ package org.onosproject.store.device.impl; ...@@ -17,7 +17,6 @@ package org.onosproject.store.device.impl;
17 17
18 import com.google.common.collect.Iterables; 18 import com.google.common.collect.Iterables;
19 import com.google.common.collect.Sets; 19 import com.google.common.collect.Sets;
20 -
21 import org.easymock.Capture; 20 import org.easymock.Capture;
22 import org.junit.After; 21 import org.junit.After;
23 import org.junit.AfterClass; 22 import org.junit.AfterClass;
...@@ -55,12 +54,12 @@ import org.onosproject.store.Timestamp; ...@@ -55,12 +54,12 @@ import org.onosproject.store.Timestamp;
55 import org.onosproject.store.cluster.StaticClusterService; 54 import org.onosproject.store.cluster.StaticClusterService;
56 import org.onosproject.store.cluster.messaging.ClusterCommunicationService; 55 import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
57 import org.onosproject.store.cluster.messaging.ClusterMessage; 56 import org.onosproject.store.cluster.messaging.ClusterMessage;
58 -import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
59 import org.onosproject.store.cluster.messaging.MessageSubject; 57 import org.onosproject.store.cluster.messaging.MessageSubject;
60 import org.onosproject.store.impl.MastershipBasedTimestamp; 58 import org.onosproject.store.impl.MastershipBasedTimestamp;
61 import org.onosproject.store.service.EventuallyConsistentMap; 59 import org.onosproject.store.service.EventuallyConsistentMap;
62 import org.onosproject.store.service.EventuallyConsistentMapBuilder; 60 import org.onosproject.store.service.EventuallyConsistentMapBuilder;
63 import org.onosproject.store.service.StorageService; 61 import org.onosproject.store.service.StorageService;
62 +
64 import java.io.IOException; 63 import java.io.IOException;
65 import java.util.Arrays; 64 import java.util.Arrays;
66 import java.util.Collections; 65 import java.util.Collections;
...@@ -70,20 +69,37 @@ import java.util.Map; ...@@ -70,20 +69,37 @@ import java.util.Map;
70 import java.util.Set; 69 import java.util.Set;
71 import java.util.concurrent.CompletableFuture; 70 import java.util.concurrent.CompletableFuture;
72 import java.util.concurrent.CountDownLatch; 71 import java.util.concurrent.CountDownLatch;
73 -import java.util.concurrent.ExecutorService;
74 import java.util.concurrent.TimeUnit; 72 import java.util.concurrent.TimeUnit;
75 import java.util.concurrent.atomic.AtomicLong; 73 import java.util.concurrent.atomic.AtomicLong;
76 import java.util.function.BiFunction; 74 import java.util.function.BiFunction;
77 import java.util.function.Function; 75 import java.util.function.Function;
78 76
79 import static java.util.Arrays.asList; 77 import static java.util.Arrays.asList;
80 -import static org.easymock.EasyMock.*; 78 +import static org.easymock.EasyMock.anyObject;
81 -import static org.junit.Assert.*; 79 +import static org.easymock.EasyMock.capture;
80 +import static org.easymock.EasyMock.createNiceMock;
81 +import static org.easymock.EasyMock.expect;
82 +import static org.easymock.EasyMock.expectLastCall;
83 +import static org.easymock.EasyMock.replay;
84 +import static org.easymock.EasyMock.reset;
85 +import static org.easymock.EasyMock.verify;
86 +import static org.junit.Assert.assertEquals;
87 +import static org.junit.Assert.assertFalse;
88 +import static org.junit.Assert.assertNotNull;
89 +import static org.junit.Assert.assertNull;
90 +import static org.junit.Assert.assertTrue;
91 +import static org.junit.Assert.fail;
82 import static org.onosproject.cluster.ControllerNode.State.ACTIVE; 92 import static org.onosproject.cluster.ControllerNode.State.ACTIVE;
83 import static org.onosproject.net.DefaultAnnotations.union; 93 import static org.onosproject.net.DefaultAnnotations.union;
84 import static org.onosproject.net.Device.Type.SWITCH; 94 import static org.onosproject.net.Device.Type.SWITCH;
85 import static org.onosproject.net.DeviceId.deviceId; 95 import static org.onosproject.net.DeviceId.deviceId;
86 -import static org.onosproject.net.device.DeviceEvent.Type.*; 96 +import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
97 +import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_AVAILABILITY_CHANGED;
98 +import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_REMOVED;
99 +import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_UPDATED;
100 +import static org.onosproject.net.device.DeviceEvent.Type.PORT_ADDED;
101 +import static org.onosproject.net.device.DeviceEvent.Type.PORT_REMOVED;
102 +import static org.onosproject.net.device.DeviceEvent.Type.PORT_UPDATED;
87 103
88 104
89 // TODO add tests for remote replication 105 // TODO add tests for remote replication
...@@ -157,9 +173,6 @@ public class GossipDeviceStoreTest { ...@@ -157,9 +173,6 @@ public class GossipDeviceStoreTest {
157 @Before 173 @Before
158 public void setUp() throws Exception { 174 public void setUp() throws Exception {
159 clusterCommunicator = createNiceMock(ClusterCommunicationService.class); 175 clusterCommunicator = createNiceMock(ClusterCommunicationService.class);
160 - clusterCommunicator.addSubscriber(anyObject(MessageSubject.class),
161 - anyObject(ClusterMessageHandler.class), anyObject(ExecutorService.class));
162 - expectLastCall().anyTimes();
163 replay(clusterCommunicator); 176 replay(clusterCommunicator);
164 ClusterService clusterService = new TestClusterService(); 177 ClusterService clusterService = new TestClusterService();
165 178
......