本文整理汇总了Java中org.onosproject.store.persistence.TestPersistenceService类的典型用法代码示例。如果您正苦于以下问题:Java TestPersistenceService类的具体用法?Java TestPersistenceService怎么用?Java TestPersistenceService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestPersistenceService类属于org.onosproject.store.persistence包,在下文中一共展示了TestPersistenceService类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.onosproject.store.persistence.TestPersistenceService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
clusterService = createMock(ClusterService.class);
expect(clusterService.getLocalNode()).andReturn(self).anyTimes();
expect(clusterService.getNodes()).andReturn(ImmutableSet.of(self)).anyTimes();
replay(clusterService);
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>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>(
clusterService, clusterCommunicator, persistenceService)
.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);
}
示例2: setUp
import org.onosproject.store.persistence.TestPersistenceService; //导入依赖的package包/类
@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);
}