Search in sources :

Example 1 with CacheManagersRegistryImpl

use of org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl in project infrautils by opendaylight.

the class CacheModule method configure.

@Override
protected void configure() {
    bind(CacheProvider.class).to(providerClass);
    bind(CacheProvider.class).annotatedWith(OsgiService.class).to(providerClass);
    CacheManagersRegistry monitor = new CacheManagersRegistryImpl();
    bind(CacheManagersRegistry.class).toInstance(monitor);
    bind(CacheManagers.class).toInstance(monitor);
}
Also used : CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) StandardCacheProvider(org.opendaylight.infrautils.caches.standard.StandardCacheProvider) CacheProvider(org.opendaylight.infrautils.caches.CacheProvider) CacheManagers(org.opendaylight.infrautils.caches.CacheManagers) CacheManagersRegistry(org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry) OsgiService(org.ops4j.pax.cdi.api.OsgiService)

Example 2 with CacheManagersRegistryImpl

use of org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl in project genius by opendaylight.

the class ItmExternalTunnelAddTest method setUp.

@Before
public void setUp() {
    setupMocks();
    optionalDpnEndPoints = Optional.of(dpnEndpointsVxlan);
    tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
    tunnelMonitorIntervalOptional = Optional.of(tunnelMonitorInterval);
    doReturn(Futures.immediateCheckedFuture(optionalDpnEndPoints)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, dpnEndpointsIdentifier);
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorParamsOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorParamsInstanceIdentifier);
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorIntervalOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorIntervalIdentifier);
    externalTunnelAddWorker = new ItmExternalTunnelAddWorker(dataBroker, itmConfig, new DPNTEPsInfoCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
}
Also used : CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) ItmExternalTunnelAddWorker(org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) DPNTEPsInfoCache(org.opendaylight.genius.itm.cache.DPNTEPsInfoCache) Before(org.junit.Before)

Example 3 with CacheManagersRegistryImpl

use of org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl in project genius by opendaylight.

the class ItmInternalTunnelAddTest method setUp.

@Before
public void setUp() {
    PowerMockito.mockStatic(ITMBatchingUtils.class);
    setupMocks();
    tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
    tunnelMonitorIntervalOptional = Optional.of(tunnelMonitorInterval);
    idOutputOptional1 = RpcResultBuilder.success(expectedId1).buildFuture();
    idOutputOptional2 = RpcResultBuilder.success(expectedId2).buildFuture();
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorParamsOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorParamsInstanceIdentifier);
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorIntervalOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorIntervalIdentifier);
    itmInternalTunnelAddWorker = new ItmInternalTunnelAddWorker(dataBroker, jobCoordinator, new TunnelMonitoringConfig(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())), itmConfig);
}
Also used : ItmInternalTunnelAddWorker(org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelAddWorker) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Example 4 with CacheManagersRegistryImpl

use of org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl in project netvirt by opendaylight.

the class NeutronPortChangeListenerTest method setUp.

@Before
public void setUp() {
    doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
    doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
    when(mockReadTx.read(any(LogicalDatastoreType.class), any(InstanceIdentifier.class))).thenReturn(Futures.immediateCheckedFuture(Optional.of(mockNetwork)));
    neutronPortChangeListener = new NeutronPortChangeListener(dataBroker, neutronvpnManager, neutronvpnNatManager, gwMacResolver, elanService, jobCoordinator, new NeutronvpnUtils(dataBroker, idManager, jobCoordinator, ipV6InternetDefRt), new HostConfigCache(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
    InstanceIdentifier<ElanInstance> elanIdentifierId = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class, new ElanInstanceKey(new Uuid("12345678-1234-1234-1234-123456789012").getValue())).build();
    when(mockReadTx.read(any(LogicalDatastoreType.class), eq(elanIdentifierId))).thenReturn(Futures.immediateCheckedFuture(Optional.of(elanInstance)));
}
Also used : ElanInstance(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance) Uuid(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) ElanInstanceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Example 5 with CacheManagersRegistryImpl

use of org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl in project genius by opendaylight.

the class DataObjectCacheTest method setup.

@Before
public void setup() {
    doReturn(mockReadTx).when(mockDataBroker).newReadOnlyTransaction();
    doReturn(mockListenerReg).when(mockDataBroker).registerDataTreeChangeListener(eq(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)), any());
    cache = new InstanceIdDataObjectCache<>(Config.class, mockDataBroker, LogicalDatastoreType.OPERATIONAL, PATH, new GuavaCacheProvider(new CacheManagersRegistryImpl()));
    verify(mockDataBroker).registerDataTreeChangeListener(eq(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)), listenerCapture.capture());
    doReturn(mockModification).when(mockDataTreeModification).getRootNode();
    doReturn(new DataTreeIdentifier<>(LogicalDatastoreType.OPERATIONAL, PATH)).when(mockDataTreeModification).getRootPath();
    doReturn(CONFIG_OBJ).when(mockModification).getDataAfter();
}
Also used : DataTreeIdentifier(org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier) Config(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.Config) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Aggregations

CacheManagersRegistryImpl (org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl)7 Before (org.junit.Before)6 GuavaCacheProvider (org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider)6 DPNTEPsInfoCache (org.opendaylight.genius.itm.cache.DPNTEPsInfoCache)2 DataTreeIdentifier (org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 ItmExternalTunnelAddWorker (org.opendaylight.genius.itm.confighelpers.ItmExternalTunnelAddWorker)1 ItmInternalTunnelAddWorker (org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelAddWorker)1 ItmInternalTunnelDeleteWorker (org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelDeleteWorker)1 ItmManagerRpcService (org.opendaylight.genius.itm.rpc.ItmManagerRpcService)1 CacheManagers (org.opendaylight.infrautils.caches.CacheManagers)1 CacheProvider (org.opendaylight.infrautils.caches.CacheProvider)1 CacheManagersRegistry (org.opendaylight.infrautils.caches.baseimpl.CacheManagersRegistry)1 StandardCacheProvider (org.opendaylight.infrautils.caches.standard.StandardCacheProvider)1 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)1 ElanInstance (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance)1 ElanInstanceKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey)1 Config (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.mdsalutil.rev170830.Config)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1 OsgiService (org.ops4j.pax.cdi.api.OsgiService)1