use of org.onosproject.store.cluster.messaging.ClusterCommunicationService in project onos by opennetworkinglab.
the class EventuallyConsistentMapImplTest method setUp.
@Before
public void setUp() throws Exception {
clusterCommunicator = createMock(ClusterCommunicationService.class);
persistenceService = new TestPersistenceService();
// Add expectation for adding cluster message subscribers which
// delegate to our ClusterCommunicationService implementation. This
// allows us to get a reference to the map's internal cluster message
// handlers so we can induce events coming in from a peer.
clusterCommunicator.<Object, Object>addSubscriber(anyObject(MessageSubject.class), anyObject(Function.class), anyObject(Function.class), anyObject(Function.class));
expectLastCall().andDelegateTo(new TestClusterCommunicationService()).times(1);
clusterCommunicator.<Object, Object>addSubscriber(anyObject(MessageSubject.class), anyObject(Function.class), anyObject(Function.class), anyObject(Function.class), anyObject(Executor.class));
expectLastCall().andDelegateTo(new TestClusterCommunicationService()).times(1);
clusterCommunicator.<Object>addSubscriber(anyObject(MessageSubject.class), anyObject(Function.class), anyObject(Consumer.class), anyObject(Executor.class));
expectLastCall().andDelegateTo(new TestClusterCommunicationService()).times(1);
clusterCommunicator.<Object, Object>addSubscriber(anyObject(MessageSubject.class), anyObject(Function.class), anyObject(Function.class), anyObject(Function.class), anyObject(Executor.class));
expectLastCall().andDelegateTo(new TestClusterCommunicationService()).times(1);
clusterCommunicator.<Object>addSubscriber(anyObject(MessageSubject.class), anyObject(Function.class), anyObject(Consumer.class), anyObject(Executor.class));
expectLastCall().andDelegateTo(new TestClusterCommunicationService()).times(1);
replay(clusterCommunicator);
clockService = new SequentialClockService<>();
KryoNamespace.Builder serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(TestTimestamp.class);
ecMap = new EventuallyConsistentMapBuilderImpl<String, String>(NodeId.nodeId("0"), clusterCommunicator, persistenceService, peersHandler, peersHandler).withName(MAP_NAME).withSerializer(serializer).withTimestampProvider((k, v) -> clockService.getTimestamp(k, v)).withCommunicationExecutor(MoreExecutors.newDirectExecutorService()).withPersistence().build();
// Reset ready for tests to add their own expectations
reset(clusterCommunicator);
}
Aggregations