use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestRestEndpoint method testGetDocumentFedNullQueryResponse.
/**
* Tests federated retrieve with a null QueryResponse
*
* @throws Exception
*/
@Test(expected = ServerErrorException.class)
public void testGetDocumentFedNullQueryResponse() throws Exception {
CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);
String transformer = mockTestSetup(framework, TestType.QUERY_RESPONSE_TEST);
executeTest(framework, transformer, false, null);
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestRestEndpoint method testGetDocumentLocalSuccess.
/**
* Tests local retrieve with a successful response
*
* @throws Exception
*/
@Test
public void testGetDocumentLocalSuccess() throws Exception {
CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);
String transformer = mockTestSetup(framework, TestType.SUCCESS_TEST);
Response response = executeTest(framework, transformer, true, null);
String responseMessage = IOUtils.toString((ByteArrayInputStream) response.getEntity());
assertEquals(GET_STREAM, responseMessage);
assertEquals(OK, response.getStatus());
assertEquals(GET_TYPE_OUTPUT, response.getMetadata().toString());
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestRestEndpoint method testGetDocumentKml.
@Test
public void testGetDocumentKml() throws Exception {
CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);
String transformer = mockTestSetup(framework, TestType.KML_TEST);
Response response = executeTest(framework, transformer, true, null);
String responseMessage = IOUtils.toString((ByteArrayInputStream) response.getEntity());
assertEquals(GET_STREAM, responseMessage);
assertEquals(OK, response.getStatus());
assertEquals(GET_KML_TYPE_OUTPUT, response.getMetadata().toString());
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestRestEndpoint method testAddDocumentPositiveCase.
@Test
public void testAddDocumentPositiveCase() throws IOException, CatalogTransformerException, IngestException, SourceUnavailableException, URISyntaxException {
CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);
HttpHeaders headers = createHeaders(Arrays.asList(MediaType.APPLICATION_JSON));
RESTEndpoint rest = new RESTEndpoint(framework);
addMatchingService(rest, Arrays.asList(getSimpleTransformer()));
UriInfo info = givenUriInfo(SAMPLE_ID);
Response response = rest.addDocument(headers, info, mock(HttpServletRequest.class), mock(MultipartBody.class), null, new ByteArrayInputStream("".getBytes()));
LOGGER.debug(ToStringBuilder.reflectionToString(response));
assertThat(response.getStatus(), equalTo(201));
assertThat(response.getMetadata(), notNullValue());
assertThat(response.getMetadata().get(Metacard.ID).get(0).toString(), equalTo(SAMPLE_ID));
}
use of ddf.catalog.CatalogFramework in project ddf by codice.
the class TestRestEndpoint method testGetDocumentFedSuccess.
/**
* Tests federated retrieve with a successful response
*
* @throws Exception
*/
@Test
public void testGetDocumentFedSuccess() throws Exception {
CatalogFramework framework = givenCatalogFramework(SAMPLE_ID);
String transformer = mockTestSetup(framework, TestType.SUCCESS_TEST);
Response response = executeTest(framework, transformer, false, null);
String responseMessage = IOUtils.toString((ByteArrayInputStream) response.getEntity());
assertEquals(GET_STREAM, responseMessage);
assertEquals(OK, response.getStatus());
assertEquals(GET_TYPE_OUTPUT, response.getMetadata().toString());
}
Aggregations