use of ddf.catalog.resourceretriever.ResourceRetriever in project ddf by codice.
the class ReliableResourceDownloadManagerTest method testClientCancelProductDownloadCachingContinues.
/**
* Tests that if user/client cancels a product retrieval that is in progress and
* actively being cached, and the admin has configured caching to continue,
* that the caching continues and cached file is placed in the cache map.
*
* @throws Exception
*/
@Test
@Ignore
public void testClientCancelProductDownloadCachingContinues() throws Exception {
mis = new MockInputStream(productInputFilename);
Metacard metacard = getMockMetacard(EXPECTED_METACARD_ID, EXPECTED_METACARD_SOURCE_ID);
resourceResponse = getMockResourceResponse();
ResourceRetriever retriever = getMockResourceRetrieverWithRetryCapability(RetryType.CLIENT_CANCELS_DOWNLOAD);
int chunkSize = 50;
startDownload(true, chunkSize, true, metacard, retriever);
// On second read of ReliableResourceInputStream, client will close the stream simulating a cancel
// of the product download
clientRead(chunkSize, productInputStream, 2);
// Captures the ReliableResource object that should have been put in the ResourceCacheImpl's map
ArgumentCaptor<ReliableResource> argument = ArgumentCaptor.forClass(ReliableResource.class);
verify(resourceCache, timeout(3000)).put(argument.capture());
verifyCaching(argument.getValue(), EXPECTED_CACHE_KEY);
cleanup();
}
Aggregations