Search in sources :

Example 1 with ClusterCommunicationServiceAdapter

use of org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter in project onos by opennetworkinglab.

the class DistributedGroupStoreTest method setUp.

@Before
public void setUp() throws Exception {
    groupStoreImpl = new DistributedGroupStore();
    groupStoreImpl.storageService = new TestStorageService();
    groupStoreImpl.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    groupStoreImpl.mastershipService = new MasterOfAll();
    groupStoreImpl.cfgService = new ComponentConfigAdapter();
    groupStoreImpl.deviceService = new InternalDeviceServiceImpl();
    ClusterService mockClusterService = createMock(ClusterService.class);
    NodeId nodeId = new NodeId(NODE_ID);
    MockControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    groupStoreImpl.clusterService = mockClusterService;
    groupStoreImpl.activate(null);
    groupStore = groupStoreImpl;
    auditPendingReqQueue = TestUtils.getField(groupStoreImpl, "auditPendingReqQueue");
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) TestStorageService(org.onosproject.store.service.TestStorageService) NodeId(org.onosproject.cluster.NodeId) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) Before(org.junit.Before)

Example 2 with ClusterCommunicationServiceAdapter

use of org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter in project onos by opennetworkinglab.

the class DistributedStatisticStoreTest method setUp.

@Before
public void setUp() throws Exception {
    statStore = new DistributedStatisticStore();
    statStore.cfgService = new ComponentConfigAdapter();
    mockClusterService = createMock(ClusterService.class);
    statStore.clusterService = mockClusterService;
    statStore.clusterService = mockClusterService;
    nodeId = new NodeId("1");
    mockControllerNode = new SetMockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    statStore.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    statStore.mastershipService = new MasterOfAll();
    statStore.activate(mockContext);
    store = statStore;
}
Also used : ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) NodeId(org.onosproject.cluster.NodeId) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) Before(org.junit.Before)

Example 3 with ClusterCommunicationServiceAdapter

use of org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter in project onos by opennetworkinglab.

the class ControlPlaneMonitorTest method setup.

/**
 * Sets up the services required by control plane monitor.
 */
@Before
public void setup() {
    monitor = new ControlPlaneMonitor();
    mockCommunicationService = new ClusterCommunicationServiceAdapter();
    monitor.communicationService = mockCommunicationService;
    nodeId = new NodeId("1");
    mockControllerNode = new MockControllerNode(nodeId);
    mockClusterService = createMock(ClusterService.class);
    monitor.clusterService = mockClusterService;
    expect(mockClusterService.getNode(anyObject())).andReturn(mockControllerNode).anyTimes();
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    monitor.activate();
}
Also used : ClusterService(org.onosproject.cluster.ClusterService) NodeId(org.onosproject.cluster.NodeId) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) Before(org.junit.Before)

Example 4 with ClusterCommunicationServiceAdapter

use of org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter in project onos by opennetworkinglab.

the class ECFlowRuleStoreTest method setUp.

@Before
public void setUp() throws Exception {
    flowStoreImpl = new ECFlowRuleStore();
    flowStoreImpl.storageService = new TestStorageService() {

        @Override
        public <K, V> ConsistentMapBuilder<K, V> consistentMapBuilder() {
            return new ConsistentMapBuilder<K, V>() {

                @Override
                public AsyncConsistentMap<K, V> buildAsyncMap() {
                    return new AsyncConsistentMapAdapter<K, V>();
                }

                @Override
                public ConsistentMap<K, V> build() {
                    return null;
                }
            };
        }
    };
    ReplicaInfoManager replicaInfoManager = new ReplicaInfoManager();
    replicaInfoManager.mastershipService = new MasterOfAll();
    flowStoreImpl.replicaInfoManager = replicaInfoManager;
    mockClusterService = createMock(ClusterService.class);
    flowStoreImpl.clusterService = mockClusterService;
    nodeId = new NodeId("1");
    mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    flowStoreImpl.clusterCommunicator = new ClusterCommunicationServiceAdapter();
    flowStoreImpl.mastershipService = new MasterOfAll();
    flowStoreImpl.deviceService = new DeviceServiceAdapter();
    flowStoreImpl.coreService = new CoreServiceAdapter();
    flowStoreImpl.configService = new ComponentConfigAdapter();
    flowStoreImpl.persistenceService = new PersistenceServiceAdapter();
    flowStoreImpl.activate(context);
}
Also used : PersistenceServiceAdapter(org.onosproject.store.persistence.PersistenceServiceAdapter) TestStorageService(org.onosproject.store.service.TestStorageService) ClusterCommunicationServiceAdapter(org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) CoreServiceAdapter(org.onosproject.core.CoreServiceAdapter) ConsistentMap(org.onosproject.store.service.ConsistentMap) AsyncConsistentMap(org.onosproject.store.service.AsyncConsistentMap) NodeId(org.onosproject.cluster.NodeId) AsyncConsistentMap(org.onosproject.store.service.AsyncConsistentMap) ConsistentMapBuilder(org.onosproject.store.service.ConsistentMapBuilder) DeviceServiceAdapter(org.onosproject.net.device.DeviceServiceAdapter) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)4 ClusterService (org.onosproject.cluster.ClusterService)4 NodeId (org.onosproject.cluster.NodeId)4 ClusterCommunicationServiceAdapter (org.onosproject.store.cluster.messaging.ClusterCommunicationServiceAdapter)4 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)3 TestStorageService (org.onosproject.store.service.TestStorageService)2 CoreServiceAdapter (org.onosproject.core.CoreServiceAdapter)1 DeviceServiceAdapter (org.onosproject.net.device.DeviceServiceAdapter)1 PersistenceServiceAdapter (org.onosproject.store.persistence.PersistenceServiceAdapter)1 AsyncConsistentMap (org.onosproject.store.service.AsyncConsistentMap)1 ConsistentMap (org.onosproject.store.service.ConsistentMap)1 ConsistentMapBuilder (org.onosproject.store.service.ConsistentMapBuilder)1