use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method getFrameworkException.
private CatalogFramework getFrameworkException(Exception e) throws Exception {
CatalogFramework framework = mock(CatalogFramework.class);
when(framework.getId()).thenReturn(TEST_SITE);
when(framework.getResource(any(ResourceRequest.class), eq(TEST_SITE))).thenThrow(e);
return framework;
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testNullMetacard.
@Test
public void testNullMetacard() 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 = 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 testNullResourceResponse.
@Test
public void testNullResourceResponse() throws Exception {
String filePath = ABSOLUTE_PATH + TEST_PATH + JPEG_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
thrown.expect(CatalogTransformerException.class);
thrown.expectMessage("Unable to retrieve resource.");
thrown.expectMessage("Metacard id: " + TEST_ID);
thrown.expectMessage("Uri: " + uri);
thrown.expectMessage("Source: " + TEST_SITE);
boolean expectSuccess = false;
MimeType mimeType = getMimeType(JPEG_MIME_TYPE);
CatalogFramework framework = getFramework(null);
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testFrameworkThrowsResourceNotFoundException.
@Test
public void testFrameworkThrowsResourceNotFoundException() throws Exception {
String filePath = ABSOLUTE_PATH + TEST_PATH + JPEG_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
thrown.expect(CatalogTransformerException.class);
thrown.expectMessage("Unable to retrieve resource.");
thrown.expectMessage("Metacard id: " + TEST_ID);
thrown.expectMessage("Uri: " + uri);
thrown.expectMessage("Source: " + TEST_SITE);
boolean expectSuccess = false;
MimeType mimeType = getMimeType(JPEG_MIME_TYPE);
CatalogFramework framework = getFrameworkException(new ResourceNotFoundException("Test Resource Not Found Exception"));
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestResourceMetacardTransformer method testFrameworkThrowsResourceNotSupportedException.
@Test
public void testFrameworkThrowsResourceNotSupportedException() throws Exception {
String filePath = ABSOLUTE_PATH + TEST_PATH + JPEG_FILE_NAME_1;
URI uri = getUri(filePath);
Metacard metacard = getMockMetacard(uri);
thrown.expect(CatalogTransformerException.class);
thrown.expectMessage("Unable to retrieve resource.");
thrown.expectMessage("Metacard id: " + TEST_ID);
thrown.expectMessage("Uri: " + uri);
thrown.expectMessage("Source: " + TEST_SITE);
boolean expectSuccess = false;
MimeType mimeType = getMimeType(JPEG_MIME_TYPE);
CatalogFramework framework = getFrameworkException(new ResourceNotSupportedException("Test Resource Not Supported Exception"));
testGetResource(metacard, filePath, mimeType, framework, expectSuccess);
}
Aggregations