use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.
the class AbstractCswSource method getCapabilities.
protected CapabilitiesType getCapabilities() {
CapabilitiesType caps = null;
Subject subject = getSystemSubject();
Csw csw = factory.getClientForSubject(subject);
try {
LOGGER.debug("Doing getCapabilities() call for CSW");
GetCapabilitiesRequest request = new GetCapabilitiesRequest(CswConstants.CSW);
request.setAcceptVersions(CswConstants.VERSION_2_0_2 + "," + CswConstants.VERSION_2_0_1);
caps = csw.getCapabilities(request);
} catch (CswException cswe) {
LOGGER.info(CSW_SERVER_ERROR + " Received HTTP code '{}' from server for source with id='{}'. Set Logging to DEBUG for details.", cswe.getHttpStatus(), cswSourceConfiguration.getId());
LOGGER.debug(CSW_SERVER_ERROR, cswe);
} catch (WebApplicationException wae) {
LOGGER.debug(handleWebApplicationException(wae), wae);
} catch (Exception ce) {
handleClientException(ce);
}
return caps;
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesRequestOperationsMetadata.
@Test
public void testCapabilitiesRequestOperationsMetadata() {
// Should only return the OperationsMetadata section
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
gcr.setSections(CswEndpoint.OPERATIONS_METADATA);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
verifyFilterCapabilities(ct);
assertThat(ct.getServiceIdentification(), nullValue());
assertThat(ct.getServiceProvider(), nullValue());
verifyOperationsMetadata(ct);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesRequestBadSection.
@Test
public void testCapabilitiesRequestBadSection() {
// Shouldn't return any sections
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
gcr.setSections("bad");
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), nullValue());
assertThat(ct.getServiceIdentification(), nullValue());
assertThat(ct.getServiceProvider(), nullValue());
verifyFilterCapabilities(ct);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesRequestServiceIdentification.
@Test
public void testCapabilitiesRequestServiceIdentification() {
// Should only return the ServiceIdentification section
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
gcr.setSections(CswEndpoint.SERVICE_IDENTIFICATION);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), nullValue());
verifyFilterCapabilities(ct);
assertThat(ct.getServiceProvider(), nullValue());
verifyServiceIdentification(ct);
}
use of org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest in project ddf by codice.
the class TestCswEndpoint method createDefaultGetCapabilitiesRequest.
/**
* Creates default GetCapabilities GET request, with no sections specified
*
* @return Vanilla GetCapabilitiesRequest object
*/
private GetCapabilitiesRequest createDefaultGetCapabilitiesRequest() {
GetCapabilitiesRequest gcr = new GetCapabilitiesRequest();
gcr.setService(CswConstants.CSW);
gcr.setAcceptVersions(CswConstants.VERSION_2_0_2);
gcr.setRequest(CswConstants.GET_CAPABILITIES);
return gcr;
}
Aggregations