Search in sources :

Example 16 with CapabilitiesType

use of net.opengis.sos.x20.CapabilitiesType in project ddf by codice.

the class TestCswEndpoint method testCapabilitiesRequestFilterCapabilities.

@Test
public void testCapabilitiesRequestFilterCapabilities() {
    // Should only return the Filter_Capabilities section
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections(CswEndpoint.FILTER_CAPABILITIES);
    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);
}
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 17 with CapabilitiesType

use of net.opengis.sos.x20.CapabilitiesType in project ddf by codice.

the class TestCswEndpoint 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 18 with CapabilitiesType

use of net.opengis.sos.x20.CapabilitiesType in project ddf by codice.

the class TestCswEndpoint method testCapabilitiesRequestAllSections.

@Test
public void testCapabilitiesRequestAllSections() {
    // Should return all sections
    GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
    gcr.setSections(CswEndpoint.SERVICE_IDENTIFICATION + "," + CswEndpoint.SERVICE_PROVIDER + "," + CswEndpoint.OPERATIONS_METADATA + "," + CswEndpoint.FILTER_CAPABILITIES);
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gcr);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    verifyOperationsMetadata(ct);
    verifyServiceIdentification(ct);
    verifyServiceProvider(ct);
    verifyFilterCapabilities(ct);
}
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 19 with CapabilitiesType

use of net.opengis.sos.x20.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.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());
    }
    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 20 with CapabilitiesType

use of net.opengis.sos.x20.CapabilitiesType in project midpoint by Evolveum.

the class AbstractManualResourceTest method test003Connection.

@Test
public void test003Connection() throws Exception {
    final String TEST_NAME = "test003Connection";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    // Check that there is a schema, but no capabilities before test (pre-condition)
    ResourceType resourceBefore = repositoryService.getObject(ResourceType.class, getResourceOid(), null, result).asObjectable();
    Element resourceXsdSchemaElementBefore = ResourceTypeUtil.getResourceXsdSchema(resourceBefore);
    assertResourceSchemaBeforeTest(resourceXsdSchemaElementBefore);
    CapabilitiesType capabilities = resourceBefore.getCapabilities();
    if (capabilities != null) {
        AssertJUnit.assertNull("Native capabilities present before test connection. Bad test setup?", capabilities.getNative());
    }
    // WHEN
    OperationResult testResult = modelService.testResource(getResourceOid(), task);
    // THEN
    display("Test result", testResult);
    TestUtil.assertSuccess("Test resource failed (result)", testResult);
    PrismObject<ResourceType> resourceRepoAfter = repositoryService.getObject(ResourceType.class, getResourceOid(), null, result);
    ResourceType resourceTypeRepoAfter = resourceRepoAfter.asObjectable();
    display("Resource after test", resourceTypeRepoAfter);
    XmlSchemaType xmlSchemaTypeAfter = resourceTypeRepoAfter.getSchema();
    assertNotNull("No schema after test connection", xmlSchemaTypeAfter);
    Element resourceXsdSchemaElementAfter = ResourceTypeUtil.getResourceXsdSchema(resourceTypeRepoAfter);
    assertNotNull("No schema after test connection", resourceXsdSchemaElementAfter);
    String resourceXml = prismContext.serializeObjectToString(resourceRepoAfter, PrismContext.LANG_XML);
    display("Resource XML", resourceXml);
    CachingMetadataType cachingMetadata = xmlSchemaTypeAfter.getCachingMetadata();
    assertNotNull("No caching metadata", cachingMetadata);
    assertNotNull("No retrievalTimestamp", cachingMetadata.getRetrievalTimestamp());
    assertNotNull("No serialNumber", cachingMetadata.getSerialNumber());
    Element xsdElement = ObjectTypeUtil.findXsdElement(xmlSchemaTypeAfter);
    ResourceSchema parsedSchema = ResourceSchemaImpl.parse(xsdElement, resourceBefore.toString(), prismContext);
    assertNotNull("No schema after parsing", parsedSchema);
// schema will be checked in next test
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ResourceSchema(com.evolveum.midpoint.schema.processor.ResourceSchema) CapabilitiesType(com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilitiesType) Element(org.w3c.dom.Element) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) XmlSchemaType(com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType) CachingMetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType) Test(org.testng.annotations.Test) AbstractConfiguredModelIntegrationTest(com.evolveum.midpoint.model.intest.AbstractConfiguredModelIntegrationTest)

Aggregations

CapabilitiesType (net.opengis.cat.csw.v_2_0_2.CapabilitiesType)25 GetCapabilitiesType (net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)21 Test (org.junit.Test)20 CswException (org.codice.ddf.spatial.ogc.csw.catalog.common.CswException)19 GetCapabilitiesRequest (org.codice.ddf.spatial.ogc.csw.catalog.common.GetCapabilitiesRequest)13 CapabilitiesType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilitiesType)8 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)6 SectionsType (net.opengis.ows.v_1_0_0.SectionsType)6 CachingMetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.CachingMetadataType)5 Test (org.testng.annotations.Test)5 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)4 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)4 ResourceSchema (com.evolveum.midpoint.schema.processor.ResourceSchema)3 CapabilityCollectionType (com.evolveum.midpoint.xml.ns._public.common.common_3.CapabilityCollectionType)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)2 Task (com.evolveum.midpoint.task.api.Task)2 XmlSchemaType (com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType)2 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)2 Metacard (ddf.catalog.data.Metacard)2 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)2