Search in sources :

Example 1 with ReliableResourceDownloadManager

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

the class DownloadsStatusEventListenerTest method setUp.

@Before
public void setUp() throws IOException {
    testFolder.create();
    String productCacheDir = testFolder.newFolder("cache").toString();
    localResourcePath = testFolder.newFolder("resources").toPath();
    ReliableResourceDownloaderConfig downloaderConfig = new ReliableResourceDownloaderConfig();
    testDownloadStatusInfo = new DownloadStatusInfoImpl();
    testDownloadStatusInfo.setSubjectOperations(new SubjectUtils());
    ResourceCacheImpl testResourceCache = new ResourceCacheImpl();
    DownloadsStatusEventPublisher testEventPublisher = mock(DownloadsStatusEventPublisher.class);
    DownloadsStatusEventListener 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 : SubjectUtils(ddf.security.service.impl.SubjectUtils) ResourceCacheImpl(ddf.catalog.cache.impl.ResourceCacheImpl) ReliableResourceDownloadManager(ddf.catalog.resource.download.ReliableResourceDownloadManager) ReliableResourceDownloaderConfig(ddf.catalog.resource.download.ReliableResourceDownloaderConfig) Before(org.junit.Before)

Aggregations

ResourceCacheImpl (ddf.catalog.cache.impl.ResourceCacheImpl)1 ReliableResourceDownloadManager (ddf.catalog.resource.download.ReliableResourceDownloadManager)1 ReliableResourceDownloaderConfig (ddf.catalog.resource.download.ReliableResourceDownloaderConfig)1 SubjectUtils (ddf.security.service.impl.SubjectUtils)1 Before (org.junit.Before)1