Search in sources :

Example 26 with CapabilitiesType

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());
}
Also used : SectionsType(net.opengis.ows.v_1_0_0.SectionsType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 27 with CapabilitiesType

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());
}
Also used : SectionsType(net.opengis.ows.v_1_0_0.SectionsType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 28 with CapabilitiesType

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));
}
Also used : GetCapabilitiesRequest(org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType) CswException(org.codice.ddf.spatial.ogc.csw.catalog.common.CswException) Test(org.junit.Test)

Example 29 with CapabilitiesType

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;
}
Also used : EncodingException(org.n52.svalbard.encode.exception.EncodingException) CapabilitiesType(net.opengis.sos.x20.CapabilitiesType) InsertionCapabilitiesType(net.opengis.sos.x20.InsertionCapabilitiesType) XmlException(org.apache.xmlbeans.XmlException) SosCapabilities(org.n52.shetland.ogc.sos.SosCapabilities) CapabilitiesDocument(net.opengis.sos.x20.CapabilitiesDocument) InsertionCapabilitiesDocument(net.opengis.sos.x20.InsertionCapabilitiesDocument)

Example 30 with CapabilitiesType

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());
    }
}
Also used : Marshaller(javax.xml.bind.Marshaller) InputStream(java.io.InputStream) CapabilitiesType(org.geosdi.geoplatform.xml.csw.v202.CapabilitiesType) FileOutputStream(java.io.FileOutputStream) JAXBElement(javax.xml.bind.JAXBElement) IOException(java.io.IOException) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test)

Aggregations

CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)45 Test (org.junit.Test)44 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)40 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)38 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)24 SectionsType (net.opengis.ows.v_1_0_0.SectionsType)12 CapabilitiesType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilitiesType)6 DomainType (net.opengis.ows.v_1_0_0.DomainType)5 Operation (net.opengis.ows.v_1_0_0.Operation)5 CapabilitiesType (org.geosdi.geoplatform.xml.csw.v202.CapabilitiesType)5 CachingMetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)4 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)4 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)4 Test (org.testng.annotations.Test)4 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)2 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)2 Metacard (ddf.catalog.data.Metacard)2