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));
}
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));
}
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());
}
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();
}
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();
}
Aggregations