Search in sources :

Example 1 with ReliableResourceDownloaderConfig

use of ddf.catalog.resource.download.ReliableResourceDownloaderConfig in project ddf by codice.

the class DownloadsStatusEventListenerTest method setUp.

@BeforeClass
public static void setUp() {
    ReliableResourceDownloaderConfig downloaderConfig = new ReliableResourceDownloaderConfig();
    testDownloadStatusInfo = new DownloadStatusInfoImpl();
    hcInstanceFactory = new TestHazelcastInstanceFactory(10);
    ResourceCacheImpl testResourceCache = new ResourceCacheImpl();
    testResourceCache.setCache(hcInstanceFactory.newHazelcastInstance());
    productCacheDir = System.getProperty("user.dir") + "/target" + File.separator + ResourceCacheImpl.DEFAULT_PRODUCT_CACHE_DIRECTORY;
    testResourceCache.setProductCacheDirectory(productCacheDir);
    DownloadsStatusEventPublisher testEventPublisher = mock(DownloadsStatusEventPublisher.class);
    testEventListener = new DownloadsStatusEventListener();
    downloaderConfig.setResourceCache(testResourceCache);
    downloaderConfig.setEventPublisher(testEventPublisher);
    downloaderConfig.setEventListener(testEventListener);
    testDownloadManager = new ReliableResourceDownloadManager(downloaderConfig, testDownloadStatusInfo, Executors.newSingleThreadExecutor());
    testDownloadManager.setMaxRetryAttempts(1);
    testDownloadManager.setDelayBetweenAttempts(0);
    testDownloadManager.setMonitorPeriod(5);
}
Also used : ResourceCacheImpl(ddf.catalog.cache.impl.ResourceCacheImpl) ReliableResourceDownloadManager(ddf.catalog.resource.download.ReliableResourceDownloadManager) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) ReliableResourceDownloaderConfig(ddf.catalog.resource.download.ReliableResourceDownloaderConfig) BeforeClass(org.junit.BeforeClass)

Aggregations

TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)1 ResourceCacheImpl (ddf.catalog.cache.impl.ResourceCacheImpl)1 ReliableResourceDownloadManager (ddf.catalog.resource.download.ReliableResourceDownloadManager)1 ReliableResourceDownloaderConfig (ddf.catalog.resource.download.ReliableResourceDownloaderConfig)1 BeforeClass (org.junit.BeforeClass)1