Search in sources :

Example 36 with CapabilitiesType

use of net.opengis.cat.csw._3.CapabilitiesType in project ddf by codice.

the class CswEndpointTest method testGetCapabilitiesTypeServiceIdentification.

@Test
public void testGetCapabilitiesTypeServiceIdentification() {
    // Should only return the ServiceIdentification section
    GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
    SectionsType stv = new SectionsType();
    stv.setSection(Arrays.asList(CswEndpoint.SERVICE_IDENTIFICATION));
    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());
    verifyServiceIdentification(ct);
    verifyFilterCapabilities(ct);
    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 37 with CapabilitiesType

use of net.opengis.cat.csw._3.CapabilitiesType in project ddf by codice.

the class CswEndpointTest method testGetCapabilitiesTypeServiceProvider.

@Test
public void testGetCapabilitiesTypeServiceProvider() {
    // Should only return the ServiceProvider section
    GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
    SectionsType stv = new SectionsType();
    stv.setSection(Arrays.asList(CswEndpoint.SERVICE_PROVIDER));
    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());
    verifyServiceProvider(ct);
    verifyFilterCapabilities(ct);
    assertThat(ct.getServiceIdentification(), 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 38 with CapabilitiesType

use of net.opengis.cat.csw._3.CapabilitiesType in project ddf by codice.

the class CswEndpointTest method testGetCapabilitiesTypeFederatedCatalogs.

@Test
public void testGetCapabilitiesTypeFederatedCatalogs() {
    GetCapabilitiesType gct = createDefaultGetCapabilitiesType();
    CapabilitiesType ct = null;
    try {
        ct = csw.getCapabilities(gct);
    } catch (CswException e) {
        fail("CswException caught during getCapabilities GET request: " + e.getMessage());
    }
    assertThat(ct, notNullValue());
    assertThat(ct.getOperationsMetadata(), notNullValue());
    for (Operation operation : ct.getOperationsMetadata().getOperation()) {
        if (StringUtils.equals(operation.getName(), CswConstants.GET_RECORDS)) {
            for (DomainType constraint : operation.getConstraint()) {
                if (StringUtils.equals(constraint.getName(), CswConstants.FEDERATED_CATALOGS)) {
                    assertThat(constraint.getValue().size(), is(3));
                    return;
                }
            }
        }
    }
    fail("Didn't find [" + CswConstants.FEDERATED_CATALOGS + "] in request [" + CswConstants.GET_RECORDS + "]");
}
Also used : DomainType(net.opengis.ows.v_1_0_0.DomainType) 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) Operation(net.opengis.ows.v_1_0_0.Operation) Test(org.junit.Test)

Example 39 with CapabilitiesType

use of net.opengis.cat.csw._3.CapabilitiesType in project ddf by codice.

the class CswEndpoint method buildCapabilitiesType.

/**
 * Creates a CapabilitiesType object with only specified sections to be returned as a
 * GetCapabilities response.
 *
 * @param sections The list of desired sections for the GetCapabilities response
 * @return The constructed CapabilitiesType object, containing only the user-specified sections
 */
private CapabilitiesType buildCapabilitiesType(List<String> sections) {
    // If no sections are specified, return them all
    if (sections == null || sections.size() == 0) {
        return capabilitiesType;
    }
    CapabilitiesType cswCapabilities = new CapabilitiesType();
    cswCapabilities.setVersion(capabilitiesType.getVersion());
    // Grab the desired sections from the global capabilitiesType variable
    for (String section : sections) {
        if (section.equalsIgnoreCase(SERVICE_IDENTIFICATION)) {
            cswCapabilities.setServiceIdentification(capabilitiesType.getServiceIdentification());
        } else if (section.equalsIgnoreCase(SERVICE_PROVIDER)) {
            cswCapabilities.setServiceProvider(capabilitiesType.getServiceProvider());
        } else if (section.equalsIgnoreCase(OPERATIONS_METADATA)) {
            cswCapabilities.setOperationsMetadata(capabilitiesType.getOperationsMetadata());
        }
    }
    // filterCapabilities is required.  Add it even if it isn't in the sections list.
    cswCapabilities.setFilterCapabilities(capabilitiesType.getFilterCapabilities());
    return cswCapabilities;
}
Also used : ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType) IdCapabilitiesType(net.opengis.filter.v_1_1_0.IdCapabilitiesType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)

Example 40 with CapabilitiesType

use of net.opengis.cat.csw._3.CapabilitiesType in project ddf by codice.

the class CswEndpoint method buildCapabilitiesType.

/**
 * Creates a full CapabilitiesType element to be returned as the GetCapabilities response
 *
 * @return The constructed CapabilitiesType object
 */
private CapabilitiesType buildCapabilitiesType() {
    if (capabilitiesType == null) {
        CapabilitiesType cswCapabilities = new CapabilitiesType();
        cswCapabilities.setVersion(CswConstants.VERSION_2_0_2);
        cswCapabilities.setServiceIdentification(buildServiceIdentification());
        cswCapabilities.setServiceProvider(buildServiceProvider());
        cswCapabilities.setOperationsMetadata(buildOperationsMetadata());
        cswCapabilities.setFilterCapabilities(buildFilterCapabilities());
        return cswCapabilities;
    } else {
        capabilitiesType.setOperationsMetadata(buildOperationsMetadata());
        return capabilitiesType;
    }
}
Also used : ScalarCapabilitiesType(net.opengis.filter.v_1_1_0.ScalarCapabilitiesType) SpatialCapabilitiesType(net.opengis.filter.v_1_1_0.SpatialCapabilitiesType) IdCapabilitiesType(net.opengis.filter.v_1_1_0.IdCapabilitiesType) CapabilitiesType(net.opengis.cat.csw.v_2_0_2.CapabilitiesType) GetCapabilitiesType(net.opengis.cat.csw.v_2_0_2.GetCapabilitiesType)

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