Search in sources :

Example 1 with SimpleFlowRuleStore

use of org.onosproject.store.trivial.SimpleFlowRuleStore in project onos by opennetworkinglab.

the class FlowRuleManagerTest method setUp.

@Before
public void setUp() {
    mgr = new FlowRuleManager();
    mgr.store = new SimpleFlowRuleStore();
    injectEventDispatcher(mgr, new TestEventDispatcher());
    mgr.deviceService = new TestDeviceService();
    mgr.mastershipService = new TestMastershipService();
    mgr.coreService = new TestCoreService();
    mgr.operationsService = MoreExecutors.newDirectExecutorService();
    mgr.deviceInstallers = MoreExecutors.newDirectExecutorService();
    mgr.cfgService = new ComponentConfigAdapter();
    ClusterService mockClusterService = createMock(ClusterService.class);
    NodeId nodeId = new NodeId(NODE_ID);
    MockControllerNode mockControllerNode = new MockControllerNode(nodeId);
    expect(mockClusterService.getLocalNode()).andReturn(mockControllerNode).anyTimes();
    replay(mockClusterService);
    mgr.clusterService = mockClusterService;
    service = mgr;
    registry = mgr;
    DriverRegistryManager driverRegistry = new DriverRegistryManager();
    driverService = new TestDriverManager(driverRegistry);
    driverRegistry.addDriver(new DefaultDriver("foo", ImmutableList.of(), "", "", "", ImmutableMap.of(FlowRuleProgrammable.class, TestFlowRuleProgrammable.class), ImmutableMap.of()));
    mgr.activate(null);
    mgr.addListener(listener);
    provider = new TestProvider(PID);
    providerService = this.registry.register(provider);
    appId = new TestApplicationId(0, "FlowRuleManagerTest");
    assertTrue("provider should be registered", this.registry.getProviders().contains(provider.id()));
}
Also used : TestEventDispatcher(org.onosproject.common.event.impl.TestEventDispatcher) ComponentConfigAdapter(org.onosproject.cfg.ComponentConfigAdapter) ClusterService(org.onosproject.cluster.ClusterService) SimpleFlowRuleStore(org.onosproject.store.trivial.SimpleFlowRuleStore) NodeId(org.onosproject.cluster.NodeId) DefaultDriver(org.onosproject.net.driver.DefaultDriver) DriverRegistryManager(org.onosproject.net.driver.impl.DriverRegistryManager) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 ComponentConfigAdapter (org.onosproject.cfg.ComponentConfigAdapter)1 ClusterService (org.onosproject.cluster.ClusterService)1 NodeId (org.onosproject.cluster.NodeId)1 TestEventDispatcher (org.onosproject.common.event.impl.TestEventDispatcher)1 DefaultDriver (org.onosproject.net.driver.DefaultDriver)1 DriverRegistryManager (org.onosproject.net.driver.impl.DriverRegistryManager)1 SimpleFlowRuleStore (org.onosproject.store.trivial.SimpleFlowRuleStore)1