use of org.codice.ddf.cxf.client.impl.ClientBuilderFactoryImpl in project ddf by codice.
the class URLResourceReaderTest method setUp.
@Before
public void setUp() {
MimeTypeResolver tikaResolver = new TikaMimeTypeResolver();
this.customResolver = new CustomMimeTypeResolver();
List<MimeTypeResolver> resolvers = new ArrayList<MimeTypeResolver>();
resolvers.add(tikaResolver);
resolvers.add(this.customResolver);
this.mimeTypeMapper = new MimeTypeMapperImpl(resolvers);
this.clientBuilderFactory = new ClientBuilderFactoryImpl();
}
use of org.codice.ddf.cxf.client.impl.ClientBuilderFactoryImpl in project ddf by codice.
the class DownloadsStatusEventListenerTest method testGetDownloadStatus.
@Test
public void testGetDownloadStatus() throws URISyntaxException, DownloadException, InterruptedException, IOException {
File downloadSrcFile = new File(this.getClass().getResource("/125bytes.txt").toURI());
File downloadFile = prepareDownloadFile(downloadSrcFile);
MetacardImpl testMetacard = new MetacardImpl();
testMetacard.setId("easyas123");
testMetacard.setResourceURI(downloadFile.toURI());
testMetacard.setResourceSize("125");
ClientBuilderFactory clientBuilderFactory = new ClientBuilderFactoryImpl();
URLResourceReader testURLResourceReader = new URLResourceReader(clientBuilderFactory);
testURLResourceReader.setRootResourceDirectories(new HashSet<String>(Arrays.asList(localResourcePath.toString())));
List<ResourceReader> testResourceReaderList = Collections.singletonList((ResourceReader) testURLResourceReader);
Map<String, Serializable> tmpMap = Collections.emptyMap();
Map<String, Integer> idToBytes = new HashMap<String, Integer>();
testGetDownloadStatusHelper(null, null, null);
testDownloadManager.download(mock(ResourceRequest.class), testMetacard, new LocalResourceRetriever(testResourceReaderList, testMetacard.getResourceURI(), null, tmpMap));
TimeUnit.SECONDS.sleep(2);
testGetDownloadStatusHelper(idToBytes, DownloadManagerState.DownloadState.COMPLETED.name(), downloadFile.getName());
}
Aggregations