use of org.geotoolkit.wcs.xml.v200.CapabilitiesType in project ddf by codice.
the class CswEndpointTest method testGetCapabilitiesTypeFilterCapabilities.
@Test
public void testGetCapabilitiesTypeFilterCapabilities() {
// Should only return the Filter_Capabilities section
GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
SectionsType stv = new SectionsType();
stv.setSection(Arrays.asList(CswEndpoint.FILTER_CAPABILITIES));
gct.setSections(stv);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gct);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
verifyFilterCapabilities(ct);
assertThat(ct.getOperationsMetadata(), nullValue());
assertThat(ct.getServiceIdentification(), nullValue());
assertThat(ct.getServiceProvider(), nullValue());
}
use of org.geotoolkit.wcs.xml.v200.CapabilitiesType in project ddf by codice.
the class CswEndpointTest method testGetCapabilitiesTypeBadSection.
@Test
public void testGetCapabilitiesTypeBadSection() {
// Shouldn't return any sections
GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
SectionsType stv = new SectionsType();
stv.setSection(Arrays.asList("bad"));
gct.setSections(stv);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gct);
} 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());
assertThat(ct.getOperationsMetadata(), nullValue());
}
use of org.geotoolkit.wcs.xml.v200.CapabilitiesType in project ddf by codice.
the class CswEndpointTest method testThirdPartyTypeNames.
@Test
public void testThirdPartyTypeNames() throws Exception {
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(countTypeNames(ct, CswConstants.DESCRIBE_RECORD, CswConstants.TYPE_NAME_PARAMETER, THIRD_PARTY_TYPE_NAME), is(1L));
assertThat(countTypeNames(ct, CswConstants.GET_RECORDS, CswConstants.TYPE_NAMES_PARAMETER, THIRD_PARTY_TYPE_NAME), is(1L));
}
use of org.geotoolkit.wcs.xml.v200.CapabilitiesType in project arctic-sea by 52North.
the class GetCapabilitiesResponseEncoder method create.
@Override
protected XmlObject create(GetCapabilitiesResponse response) throws EncodingException {
CapabilitiesDocument doc = CapabilitiesDocument.Factory.newInstance(getXmlOptions());
CapabilitiesType xbCaps = doc.addNewCapabilities();
if (response.hasExtensions()) {
createExtension(xbCaps, response.getExtensions());
}
if (response.isStatic()) {
String xml = response.getXmlString();
LOGGER.trace("Response is static. XML-String:\n{}\n", xml);
try {
doc.set(XmlObject.Factory.parse(xml));
return doc;
} catch (XmlException ex) {
throw new EncodingException("Error encoding static capabilities", ex);
}
}
// set version.
if (response.getCapabilities().getVersion() != null) {
xbCaps.setVersion(response.getCapabilities().getVersion());
} else {
xbCaps.setVersion(response.getVersion());
}
if (response.getCapabilities().getUpdateSequence().isPresent()) {
xbCaps.setUpdateSequence(response.getCapabilities().getUpdateSequence().get());
}
encodeServiceIdentification(response.getCapabilities(), xbCaps);
encodeServiceProvider(response.getCapabilities(), xbCaps);
encodeOperationsMetadata(response.getCapabilities(), xbCaps);
if (response.getCapabilities() instanceof SosCapabilities) {
SosCapabilities caps = (SosCapabilities) response.getCapabilities();
encodeFilterCapabilities(caps, xbCaps);
encodeContents(caps, xbCaps, response.getVersion());
encodeExtensions(caps, xbCaps);
}
return doc;
}
use of org.geotoolkit.wcs.xml.v200.CapabilitiesType in project geo-platform by geosdi.
the class CatalogContextTest method testJAXBContext.
@Test
public void testJAXBContext() throws Exception {
assertNotNull(cswContext);
Unmarshaller m = cswContext.acquireUnmarshaller();
try {
if (entity != null) {
InputStream content = entity.getContent();
CapabilitiesType cap = ((JAXBElement<CapabilitiesType>) m.unmarshal(content)).getValue();
logger.info("CSW GET_CAPABILITIES VERSION @@@@@@@@@@@@@@@@@@@@@@@ " + cap.getVersion());
logger.info("CSW SERVICE IDENTIFICATION @@@@@@@@@@ " + cap.getServiceIdentification());
String cswFile = "target/csw.xml";
Marshaller ma = cswContext.acquireMarshaller();
try (FileOutputStream fos = new FileOutputStream(cswFile)) {
ma.marshal(cap, fos);
}
}
} catch (IOException ex) {
logger.error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ " + ex.getMessage());
}
}
Aggregations