use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest in project ddf by codice.
the class CswSubscriptionEndpointTest method testUpdateRecordsSubscription.
@Test
public void testUpdateRecordsSubscription() throws Exception {
GetRecordsRequest getRecordsRequest = createDefaultGetRecordsRequest();
getRecordsRequest.setResponseHandler(RESPONSE_HANDLER_URL);
Response response = cswSubscriptionEndpoint.createRecordsSubscription(getRecordsRequest);
AcknowledgementType createAck = (AcknowledgementType) response.getEntity();
getRecordsRequest = createDefaultGetRecordsRequest();
getRecordsRequest.setResponseHandler(RESPONSE_HANDLER_URL);
getRecordsRequest.setResultType(ResultType.HITS.value());
response = cswSubscriptionEndpoint.updateRecordsSubscription(createAck.getRequestId(), getRecordsRequest.get202RecordsType());
AcknowledgementType updateAck = (AcknowledgementType) response.getEntity();
assertThat(((GetRecordsType) ((JAXBElement) updateAck.getEchoedRequest().getAny()).getValue()).getResultType(), is(ResultType.HITS));
verify(serviceRegistration).unregister();
verify(config).delete();
verify(mockContext, times(2)).registerService(eq(Subscription.class.getName()), any(Subscription.class), any(Dictionary.class));
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest in project ddf by codice.
the class CswSubscriptionEndpointTest method testCreateRecordsSubscriptionPOSTBadResponseHandler.
@Test(expected = CswException.class)
public void testCreateRecordsSubscriptionPOSTBadResponseHandler() throws CswException {
GetRecordsRequest getRecordsRequest = createDefaultGetRecordsRequest();
getRecordsRequest.setResponseHandler("[]@!$&'()*+,;=");
cswSubscriptionEndpoint.createRecordsSubscription(getRecordsRequest.get202RecordsType());
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest in project ddf by codice.
the class CswSubscriptionEndpointTest method testCreateRecordsSubscriptionPOSTwithoutResponseHandler.
@Test(expected = CswException.class)
public void testCreateRecordsSubscriptionPOSTwithoutResponseHandler() throws Exception {
GetRecordsRequest getRecordsRequest = createDefaultGetRecordsRequest();
getRecordsRequest.setResponseHandler(null);
cswSubscriptionEndpoint.createRecordsSubscription(getRecordsRequest.get202RecordsType());
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest in project ddf by codice.
the class CswSubscriptionEndpointTest method createDefaultGetRecordsRequest.
private GetRecordsRequest createDefaultGetRecordsRequest() {
GetRecordsRequest grr = new GetRecordsRequest();
grr.setRequestId(subscriptionId);
grr.setResponseHandler(RESPONSE_HANDLER_URL);
grr.setService(CswConstants.CSW);
grr.setVersion(CswConstants.VERSION_2_0_2);
grr.setRequest(CswConstants.GET_RECORDS);
grr.setNamespace(CswConstants.XMLNS_DEFINITION_PREFIX + CswConstants.CSW_NAMESPACE_PREFIX + CswConstants.EQUALS + CswConstants.CSW_OUTPUT_SCHEMA + CswConstants.XMLNS_DEFINITION_POSTFIX + CswConstants.COMMA + CswConstants.XMLNS_DEFINITION_PREFIX + CswConstants.OGC_NAMESPACE_PREFIX + CswConstants.EQUALS + CswConstants.OGC_SCHEMA + CswConstants.XMLNS_DEFINITION_POSTFIX + CswConstants.COMMA + CswConstants.XMLNS_DEFINITION_PREFIX + CswConstants.GML_NAMESPACE_PREFIX + CswConstants.EQUALS + CswConstants.GML_SCHEMA + CswConstants.XMLNS_DEFINITION_POSTFIX + CswConstants.COMMA);
grr.setOutputSchema(CswConstants.CSW_OUTPUT_SCHEMA);
grr.setOutputFormat(CswConstants.OUTPUT_FORMAT_XML);
grr.setTypeNames(VALID_TYPES);
return grr;
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetRecordsRequest in project ddf by codice.
the class TestCswEndpoint method testGetRecordsValidInput.
@Test
public void testGetRecordsValidInput() throws CswException {
GetRecordsRequest grr = createDefaultGetRecordsRequest();
csw.getRecords(grr);
}
Aggregations