Search in sources :

Example 1 with ConstantAdapterContext

use of org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext in project mdsal by opendaylight.

the class BindingDOMEntityOwnershipServiceAdapterTest method testOwnershipChangeWithException.

public void testOwnershipChangeWithException() {
    final DOMEntityOwnershipListenerAdapter domEntityOwnershipListenerAdapter = new DOMEntityOwnershipListenerAdapter(mock(EntityOwnershipListener.class), new ConstantAdapterContext(mockCodecRegistry));
    final DOMEntityOwnershipChange domOwnershipChange = mock(DOMEntityOwnershipChange.class);
    doThrow(IllegalStateException.class).when(domOwnershipChange).getEntity();
    assertThrows(IllegalStateException.class, () -> domEntityOwnershipListenerAdapter.ownershipChanged(domOwnershipChange));
}
Also used : EntityOwnershipListener(org.opendaylight.mdsal.eos.binding.api.EntityOwnershipListener) DOMEntityOwnershipListener(org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipListener) ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext) DOMEntityOwnershipChange(org.opendaylight.mdsal.eos.dom.api.DOMEntityOwnershipChange)

Example 2 with ConstantAdapterContext

use of org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext 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 3 with ConstantAdapterContext

use of org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext 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 4 with ConstantAdapterContext

use of org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext in project lighty-netconf-simulator by PANTHEONtech.

the class TriggerNotificationProcessor method init.

public void init(final NotificationPublishService paramNotificationPublishService) {
    this.notificationPublishService = paramNotificationPublishService;
    final ConstantAdapterContext constantAdapterContext = new ConstantAdapterContext(getNetconfDeviceServices().getAdapterContext().currentSerializer());
    this.adapterSerializer = constantAdapterContext.currentSerializer();
}
Also used : ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)

Example 5 with ConstantAdapterContext

use of org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext in project lighty-netconf-simulator by PANTHEONtech.

the class ToasterServiceAbstractProcessor method init.

@Override
public void init(final NetconfDeviceServices netconfDeviceServices) {
    super.init(netconfDeviceServices);
    final ConstantAdapterContext constantAdapterContext = new ConstantAdapterContext(netconfDeviceServices.getAdapterContext().currentSerializer());
    this.adapterSerializer = constantAdapterContext.currentSerializer();
}
Also used : ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)

Aggregations

ConstantAdapterContext (org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)7 DataImportBootReady (org.opendaylight.daexim.DataImportBootReady)2 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 ShardStatusMonitor (org.opendaylight.genius.mdsalutil.interfaces.ShardStatusMonitor)2 TestIMdsalApiManager (org.opendaylight.genius.mdsalutil.interfaces.testutils.TestIMdsalApiManager)2 TestShardStatusMonitor (org.opendaylight.genius.mdsalutil.testutils.TestShardStatusMonitor)2 DataBroker (org.opendaylight.mdsal.binding.api.DataBroker)2 DataBrokerTestModule (org.opendaylight.mdsal.binding.testutils.DataBrokerTestModule)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 IdManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService)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 LockManagerService (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.lockmanager.rev160413.LockManagerService)2