当前位置: 首页>>代码示例>>Java>>正文


Java TestPersistenceService类代码示例

本文整理汇总了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);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:48,代码来源:EventuallyConsistentMapImplTest.java

示例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);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:59,代码来源:EventuallyConsistentMapImplTest.java


注:本文中的org.onosproject.store.persistence.TestPersistenceService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。