Search in sources :

Example 1 with GuavaCacheProvider

use of org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider 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 2 with GuavaCacheProvider

use of org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider 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 3 with GuavaCacheProvider

use of org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider 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 4 with GuavaCacheProvider

use of org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider 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)

Example 5 with GuavaCacheProvider

use of org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider in project genius by opendaylight.

the class ItmInternalTunnelDeleteTest method setUp.

@Before
public void setUp() {
    setupMocks();
    tunnelMonitorParamsOptional = Optional.of(tunnelMonitorParams);
    tunnelMonitorIntervalOptional = Optional.of(tunnelMonitorInterval);
    internalTunnelOptional = Optional.of(internalTunnel);
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorParamsOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorParamsInstanceIdentifier);
    doReturn(Futures.immediateCheckedFuture(tunnelMonitorIntervalOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, tunnelMonitorIntervalIdentifier);
    doReturn(Futures.immediateCheckedFuture(internalTunnelOptional)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifier);
    itmInternalTunnelDeleteWorker = new ItmInternalTunnelDeleteWorker(dataBroker, jobCoordinator, new TunnelMonitoringConfig(dataBroker, new GuavaCacheProvider(new CacheManagersRegistryImpl())));
}
Also used : ItmInternalTunnelDeleteWorker(org.opendaylight.genius.itm.confighelpers.ItmInternalTunnelDeleteWorker) CacheManagersRegistryImpl(org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl) GuavaCacheProvider(org.opendaylight.infrautils.caches.guava.internal.GuavaCacheProvider) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)6 CacheManagersRegistryImpl (org.opendaylight.infrautils.caches.baseimpl.internal.CacheManagersRegistryImpl)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 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