Search in sources :

Example 1 with DataBrokerTestModule

use of org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule in project genius by opendaylight.

the class InterfaceManagerTestModule method configureBindings.

@Override
protected void configureBindings() {
    // Bindings for services from this project
    // Bindings for external services to "real" implementations
    // Bindings to test infra (fakes & mocks)
    DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(false);
    DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
    bind(DataBroker.class).toInstance(dataBroker);
    bind(DataTreeEventCallbackRegistrar.class).toInstance(mock(DataTreeEventCallbackRegistrar.class));
    bind(ManagedNewTransactionRunner.class).toInstance(mock(ManagedNewTransactionRunner.class));
    bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {
    });
    bind(LockManagerService.class).to(LockManagerServiceImpl.class);
    bind(LockListener.class);
    bind(IdManagerService.class).to(IdManager.class);
    bind(ShardStatusMonitor.class).toInstance(TestShardStatusMonitor.newInstance());
    bind(IInterfaceManager.class).to(InterfacemgrProvider.class);
    TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();
    bind(IMdsalApiManager.class).toInstance(mdsalManager);
    bind(TestIMdsalApiManager.class).toInstance(mdsalManager);
    bind(AbstractTestableListener.class).to(TestableDataTreeChangeListener.class);
    bind(JobCoordinatorCountedEventsWaiter.class).to(TestableJobCoordinatorCountedEventsWaiter.class);
    bind(InterfaceManagerService.class).to(InterfaceManagerServiceImpl.class);
    bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
    EntityOwnershipService entityOwnershipService = new BindingDOMEntityOwnershipServiceAdapter(new SimpleDOMEntityOwnershipService(), new ConstantAdapterContext(dataBrokerTestModule.getBindingToNormalizedNodeCodec()));
    bind(EntityOwnershipService.class).toInstance(entityOwnershipService);
    bind(EntityOwnershipUtils.class);
    bind(AlivenessMonitorService.class).toInstance(mock(AlivenessMonitorService.class));
    bind(TombstonedNodeManager.class).toInstance(mock(TombstonedNodeManager.class));
    bind(OdlInterfaceRpcService.class).to(InterfaceManagerRpcService.class);
    bind(CacheBridgeEntryConfigListener.class);
    bind(CacheBridgeRefEntryListener.class);
    bind(FlowBasedServicesConfigListener.class);
    bind(FlowBasedServicesInterfaceStateListener.class);
    bind(HwVTEPConfigListener.class);
    bind(HwVTEPTunnelsStateListener.class);
    bind(InterfaceConfigListener.class);
    bind(InterfaceInventoryStateListener.class);
    bind(InterfaceTopologyStateListener.class);
    bind(TerminationPointStateListener.class);
    bind(VlanMemberConfigListener.class);
    bind(InterfaceStateListener.class);
    bind(HwvtepHACache.class).toInstance(mock(HwvtepHACache.class));
    bind(IfmConfig.class).toInstance(mock(IfmConfig.class));
    bind(CacheProvider.class).toInstance(mock(CacheProvider.class));
    bind(IfmDiagStatusProvider.class).toInstance(mock(IfmDiagStatusProvider.class));
}
Also used : ShardStatusMonitor(org.opendaylight.genius.mdsalutil.interfaces.ShardStatusMonitor) TestShardStatusMonitor(org.opendaylight.genius.mdsalutil.testutils.TestShardStatusMonitor) InterfaceManagerService(org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) AbstractTestableListener(org.opendaylight.genius.datastoreutils.testutils.AbstractTestableListener) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext) IfmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig) JobCoordinatorCountedEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorCountedEventsWaiter) TestableJobCoordinatorCountedEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorCountedEventsWaiter) ManagedNewTransactionRunner(org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) BindingDOMEntityOwnershipServiceAdapter(org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter) IfmDiagStatusProvider(org.opendaylight.genius.interfacemanager.diagstatus.IfmDiagStatusProvider) HwvtepHACache(org.opendaylight.genius.utils.hwvtep.HwvtepHACache) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) AlivenessMonitorService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService) CacheProvider(org.opendaylight.infrautils.caches.CacheProvider) DataBrokerTestModule(org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule) TombstonedNodeManager(org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager) EntityOwnershipService(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) ServiceRecoveryRegistry(org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady)

Example 2 with DataBrokerTestModule

use of org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule in project genius by opendaylight.

the class ItmTestModule method configureBindings.

@Override
protected void configureBindings() {
    // Bindings for services from this project
    bind(ItmRpcService.class).to(ItmManagerRpcService.class);
    bind(ItmProvider.class);
    ItmConfig itmConfigObj = new ItmConfigBuilder().setDefTzEnabled(true).setDefTzTunnelType(ITMConstants.TUNNEL_TYPE_VXLAN).setGpeExtensionEnabled(false).setPortname("").setVlanId(Uint16.ZERO).setUseOfTunnels(true).build();
    bind(ItmConfig.class).toInstance(itmConfigObj);
    IfmConfig interfaceConfig = new IfmConfigBuilder().setItmDirectTunnels(false).setItmOfTunnels(false).build();
    bind(IfmConfig.class).toInstance(interfaceConfig);
    bind(TunnelMonitorIntervalListener.class);
    bind(TransportZoneListener.class);
    bind(OvsdbNodeListener.class);
    bind(InterfaceStateListener.class);
    bind(TunnelMonitorChangeListener.class);
    bind(ItmTunnelEventListener.class);
    // Bindings for external services to "real" implementations
    bind(IdManagerService.class).to(IdManager.class);
    bind(LockManagerService.class).to(LockManagerServiceImpl.class);
    bind(JobCoordinatorEventsWaiter.class).to(TestableJobCoordinatorEventsWaiter.class);
    DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(false);
    DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
    bind(DataBroker.class).toInstance(dataBroker);
    DataTreeEventCallbackRegistrar dataTreeEventCallbackRegistrar = new DataTreeEventCallbackRegistrarImpl(dataBroker);
    bind(DataTreeEventCallbackRegistrar.class).toInstance(dataTreeEventCallbackRegistrar);
    bind(InterfaceManagerService.class).to(InterfaceManagerServiceImpl.class);
    bind(OdlInterfaceRpcService.class).to(InterfaceManagerRpcService.class);
    bind(IInterfaceManager.class).to(InterfacemgrProvider.class);
    bind(ServiceRecoveryRegistry.class).toInstance(mock(ServiceRecoveryRegistry.class));
    bind(ItmDiagStatusProvider.class).toInstance(mock(ItmDiagStatusProvider.class));
    EntityOwnershipService entityOwnershipService = new BindingDOMEntityOwnershipServiceAdapter(new SimpleDOMEntityOwnershipService(), new ConstantAdapterContext(dataBrokerTestModule.getBindingToNormalizedNodeCodec()));
    bind(EntityOwnershipService.class).toInstance(entityOwnershipService);
    bind(EntityOwnershipUtils.class);
    bind(TombstonedNodeManager.class).to(TombstonedNodeManagerImpl.class);
    // Bindings to test infra (fakes & mocks)
    TestIMdsalApiManager mdsalManager = TestIMdsalApiManager.newInstance();
    bind(IMdsalApiManager.class).toInstance(mdsalManager);
    bind(TestIMdsalApiManager.class).toInstance(mdsalManager);
    bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {
    });
    bind(DiagStatusService.class).toInstance(mock(DiagStatusService.class));
    bind(ShardStatusMonitor.class).toInstance(TestShardStatusMonitor.newInstance());
}
Also used : InterfaceManagerService(org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService) ShardStatusMonitor(org.opendaylight.genius.mdsalutil.interfaces.ShardStatusMonitor) TestShardStatusMonitor(org.opendaylight.genius.mdsalutil.testutils.TestShardStatusMonitor) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) DataTreeEventCallbackRegistrar(org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) ItmDiagStatusProvider(org.opendaylight.genius.itm.diagstatus.ItmDiagStatusProvider) DataTreeEventCallbackRegistrarImpl(org.opendaylight.genius.datastoreutils.listeners.internal.DataTreeEventCallbackRegistrarImpl) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) ItmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfig) ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext) IfmConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) BindingDOMEntityOwnershipServiceAdapter(org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter) JobCoordinatorEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorEventsWaiter) TestableJobCoordinatorEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.TestableJobCoordinatorEventsWaiter) ItmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.ItmConfigBuilder) TestIMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager) IMdsalApiManager(org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager) ItmRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.ItmRpcService) DataBrokerTestModule(org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule) TombstonedNodeManager(org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager) EntityOwnershipService(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) SimpleDOMEntityOwnershipService(org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService) IfmConfigBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfigBuilder) ServiceRecoveryRegistry(org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady) DiagStatusService(org.opendaylight.infrautils.diagstatus.DiagStatusService)

Example 3 with DataBrokerTestModule

use of org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule in project genius by opendaylight.

the class ManagedNewTransactionRunnerImplTest method beforeTest.

@Before
public void beforeTest() {
    testableDataBroker = new DataBrokerFailuresImpl(new DataBrokerTestModule(true).getDataBroker());
    managedNewTransactionRunner = createManagedNewTransactionRunnerToTest(testableDataBroker);
    singleTransactionDataBroker = new SingleTransactionDataBroker(testableDataBroker);
}
Also used : DataBrokerTestModule(org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule) DataBrokerFailuresImpl(org.opendaylight.genius.datastoreutils.testutils.DataBrokerFailuresImpl) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) Before(org.junit.Before)

Example 4 with DataBrokerTestModule

use of org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule in project genius by opendaylight.

the class NetworkUtilTestModule method configureBindings.

@Override
protected void configureBindings() throws Exception {
    DataBrokerTestModule dataBrokerTestModule = new DataBrokerTestModule(false);
    DataBroker dataBroker = dataBrokerTestModule.getDataBroker();
    bind(DataBroker.class).toInstance(dataBroker);
    bind(NetworkConfig.class).toInstance(mock(NetworkConfig.class));
    bind(IdManagerService.class).to(IdManager.class);
    bind(ShardStatusMonitor.class).toInstance(TestShardStatusMonitor.newInstance());
    bind(DataImportBootReady.class).toInstance(new DataImportBootReady() {
    });
    bind(LockManagerService.class).to(LockManagerServiceImpl.class);
    bind(VniUtils.class).to(VniUtilsImpl.class);
    bind(RDUtils.class).to(RDUtilsImpl.class);
}
Also used : ShardStatusMonitor(org.opendaylight.genius.mdsalutil.interfaces.ShardStatusMonitor) TestShardStatusMonitor(org.opendaylight.genius.mdsalutil.testutils.TestShardStatusMonitor) DataBrokerTestModule(org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule) VniUtils(org.opendaylight.genius.networkutils.VniUtils) RDUtils(org.opendaylight.genius.networkutils.RDUtils) IdManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService) NetworkConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.networkutils.config.rev181129.NetworkConfig) LockManagerService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) DataImportBootReady(org.opendaylight.daexim.DataImportBootReady)

Aggregations

DataBrokerTestModule (org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule)4 DataImportBootReady (org.opendaylight.daexim.DataImportBootReady)3 ShardStatusMonitor (org.opendaylight.genius.mdsalutil.interfaces.ShardStatusMonitor)3 TestShardStatusMonitor (org.opendaylight.genius.mdsalutil.testutils.TestShardStatusMonitor)3 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)3 IdManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService)3 LockManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService)3 TombstonedNodeManager (org.opendaylight.genius.cloudscaler.api.TombstonedNodeManager)2 DataTreeEventCallbackRegistrar (org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar)2 IInterfaceManager (org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager)2 InterfaceManagerService (org.opendaylight.genius.interfacemanager.interfaces.InterfaceManagerService)2 IMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager)2 TestIMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager)2 ConstantAdapterContext (org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)2 EntityOwnershipService (org.opendaylight.mdsal.eos.binding.api.EntityOwnershipService)2 BindingDOMEntityOwnershipServiceAdapter (org.opendaylight.mdsal.eos.binding.dom.adapter.BindingDOMEntityOwnershipServiceAdapter)2 SimpleDOMEntityOwnershipService (org.opendaylight.mdsal.eos.dom.simple.SimpleDOMEntityOwnershipService)2 ServiceRecoveryRegistry (org.opendaylight.serviceutils.srm.ServiceRecoveryRegistry)2 IfmConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.config.rev160406.IfmConfig)2 OdlInterfaceRpcService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService)2