Search in sources :

Example 1 with ClientBuilderFactoryImpl

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();
}
Also used : TikaMimeTypeResolver(ddf.mime.tika.TikaMimeTypeResolver) MimeTypeResolver(ddf.mime.MimeTypeResolver) CustomMimeTypeResolver(ddf.mime.custom.CustomMimeTypeResolver) ClientBuilderFactoryImpl(org.codice.ddf.cxf.client.impl.ClientBuilderFactoryImpl) TikaMimeTypeResolver(ddf.mime.tika.TikaMimeTypeResolver) ArrayList(java.util.ArrayList) MimeTypeMapperImpl(ddf.mime.mapper.MimeTypeMapperImpl) CustomMimeTypeResolver(ddf.mime.custom.CustomMimeTypeResolver) Before(org.junit.Before)

Example 2 with 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());
}
Also used : URLResourceReader(ddf.catalog.resource.impl.URLResourceReader) ResourceReader(ddf.catalog.resource.ResourceReader) Serializable(java.io.Serializable) HashMap(java.util.HashMap) ClientBuilderFactoryImpl(org.codice.ddf.cxf.client.impl.ClientBuilderFactoryImpl) ClientBuilderFactory(org.codice.ddf.cxf.client.ClientBuilderFactory) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) URLResourceReader(ddf.catalog.resource.impl.URLResourceReader) LocalResourceRetriever(ddf.catalog.resourceretriever.LocalResourceRetriever) ResourceRequest(ddf.catalog.operation.ResourceRequest) File(java.io.File) Test(org.junit.Test)

Aggregations

ClientBuilderFactoryImpl (org.codice.ddf.cxf.client.impl.ClientBuilderFactoryImpl)2 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)1 ResourceRequest (ddf.catalog.operation.ResourceRequest)1 ResourceReader (ddf.catalog.resource.ResourceReader)1 URLResourceReader (ddf.catalog.resource.impl.URLResourceReader)1 LocalResourceRetriever (ddf.catalog.resourceretriever.LocalResourceRetriever)1 MimeTypeResolver (ddf.mime.MimeTypeResolver)1 CustomMimeTypeResolver (ddf.mime.custom.CustomMimeTypeResolver)1 MimeTypeMapperImpl (ddf.mime.mapper.MimeTypeMapperImpl)1 TikaMimeTypeResolver (ddf.mime.tika.TikaMimeTypeResolver)1 File (java.io.File)1 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ClientBuilderFactory (org.codice.ddf.cxf.client.ClientBuilderFactory)1 Before (org.junit.Before)1 Test (org.junit.Test)1