use of ddf.catalog.CatalogFramework in project ddf by codice.
the class CatalogFrameworkImplTest method testMetacardTransformWithNullMetacard.
@Test(expected = IllegalArgumentException.class)
public void testMetacardTransformWithNullMetacard() throws Exception {
BundleContext context = mock(BundleContext.class);
ServiceReference reference = mock(ServiceReference.class);
ServiceReference[] serviceReferences = new ServiceReference[] { reference };
when(context.getServiceReferences(anyString(), anyString())).thenReturn(serviceReferences);
CatalogFramework framework = this.createDummyCatalogFramework(provider, storageProvider, context, eventAdmin, true);
framework.transform((Metacard) null, "NONE", new HashMap<String, Serializable>());
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testGetResourceJpeg.
@Test
public void testGetResourceJpeg() throws Exception {
String filePath = ABSOLUTE_PATH + TEST_PATH + JPEG_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
boolean expectSuccess = true;
MimeType mimeType = getMimeType(JPEG_MIME_TYPE);
CatalogFramework framework = getFramework(getResourceResponse(getResource(mimeType, uri)));
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testGetResourceTransportStream.
@Test
public void testGetResourceTransportStream() throws Exception {
String filePath = ABSOLUTE_PATH + TEST_PATH + TS_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
boolean expectSuccess = true;
MimeType mimeType = getMimeType(VIDEO_MIME_TYPE);
CatalogFramework framework = getFramework(getResourceResponse(getResource(mimeType, uri)));
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testNullMetacardId.
@Test
public void testNullMetacardId() throws Exception {
thrown.expect(CatalogTransformerException.class);
thrown.expectMessage("Could not transform metacard to a resource because the metacard is not valid.");
String filePath = ABSOLUTE_PATH + TEST_PATH + TS_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
when(metacard.getId()).thenReturn(null);
boolean expectSuccess = false;
MimeType mimeType = getMimeType(VIDEO_MIME_TYPE);
CatalogFramework framework = getFramework(getResourceResponse(getResource(mimeType, uri)));
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testNullResourceUri.
@Test
public void testNullResourceUri() throws Exception {
thrown.expect(CatalogTransformerException.class);
thrown.expectMessage("Unable to retrieve resource.");
Metacard metacard = getMockMetacard(null);
CatalogFramework framework = getFrameworkException(new ResourceNotFoundException(""));
ResourceMetacardTransformer resourceTransformer = new ResourceMetacardTransformer(framework);
resourceTransformer.transform(metacard, new HashMap<String, Serializable>());
}
Aggregations