Search in sources :

Example 6 with FilterCapabilities

use of net.opengis.filter.v_2_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testNoConformance.

@Test
public void testNoConformance() {
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.setConformance(null);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    assertThat(delegate.isLogicalOps(), is(true));
    assertThat(delegate.isEpsg4326(), is(true));
    assertThat(delegate.isSortingSupported(), is(false));
    assertThat(delegate.getSrsName(), is(GeospatialUtil.EPSG_4326_URN));
    assertThat(delegate.getComparisonOps().size(), is(COMPARISON_OPERATORS.values().length));
    assertThat(delegate.getGeometryOperands().size(), greaterThan(0));
    assertThat(delegate.getSpatialOps().size(), is(SPATIAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOps().size(), is(TEMPORAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOperands().size(), greaterThan(0));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) Test(org.junit.Test)

Example 7 with FilterCapabilities

use of net.opengis.filter.v_2_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testConformanceAllowedValues.

@Test
public void testConformanceAllowedValues() {
    // Setup
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    ConformanceType conformance = capabilities.getConformance();
    List<DomainType> domainTypes = conformance.getConstraint();
    for (DomainType domainType : domainTypes) {
        if (StringUtils.equals(domainType.getName(), "ImplementsSorting")) {
            domainType.setNoValues(null);
            ValueType asc = new ValueType();
            asc.setValue("ASC");
            ValueType desc = new ValueType();
            desc.setValue("DESC");
            AllowedValues allowedValues = new AllowedValues();
            List<Object> values = new ArrayList<>();
            values.add(asc);
            values.add(desc);
            allowedValues.setValueOrRange(values);
            domainType.setAllowedValues(allowedValues);
            ValueType defaultValue = new ValueType();
            defaultValue.setValue("ASC");
            domainType.setDefaultValue(defaultValue);
            break;
        }
    }
    // Perform Test
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    // Verify
    assertThat(delegate.isSortingSupported(), is(true));
    assertThat(delegate.getAllowedSortOrders().size(), is(2));
    assertThat(delegate.getAllowedSortOrders().contains(SortOrder.ASCENDING), is(true));
    assertThat(delegate.getAllowedSortOrders().contains(SortOrder.DESCENDING), is(true));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) DomainType(net.opengis.ows.v_1_1_0.DomainType) AllowedValues(net.opengis.ows.v_1_1_0.AllowedValues) ValueType(net.opengis.ows.v_1_1_0.ValueType) ArrayList(java.util.ArrayList) ConformanceType(net.opengis.filter.v_2_0_0.ConformanceType) Test(org.junit.Test)

Example 8 with FilterCapabilities

use of net.opengis.filter.v_2_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method setupFilterDelegate.

private WfsFilterDelegate setupFilterDelegate(String spatialOpType) {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    when(mockFeatureMetacardType.getAttributeDescriptor(MOCK_GEOM)).thenReturn(new FeatureAttributeDescriptor(MOCK_GEOM, MOCK_GEOM, true, false, false, false, BasicTypes.STRING_TYPE));
    SpatialOperatorType operator = new SpatialOperatorType();
    operator.setName(spatialOpType);
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    return new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 9 with FilterCapabilities

use of net.opengis.filter.v_2_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method setupFilterCapabilities.

private FilterCapabilities setupFilterCapabilities() {
    FilterCapabilities filterCapabilities = new FilterCapabilities();
    TemporalCapabilitiesType temporal = new TemporalCapabilitiesType();
    temporal.setTemporalOperators(new TemporalOperatorsType());
    TemporalOperatorType duringOperator = new TemporalOperatorType();
    duringOperator.setName(TEMPORAL_OPERATORS.During.name());
    temporal.getTemporalOperators().getTemporalOperator().add(duringOperator);
    TemporalOperandsType temporalOperands = new TemporalOperandsType();
    List<QName> timeQNames = Arrays.asList(new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimePeriod"), new QName(Wfs20Constants.GML_3_2_NAMESPACE, "TimeInstant"));
    for (QName qName : timeQNames) {
        TemporalOperandsType.TemporalOperand operand = new TemporalOperandsType.TemporalOperand();
        operand.setName(qName);
        temporalOperands.getTemporalOperand().add(operand);
    }
    temporal.setTemporalOperands(temporalOperands);
    filterCapabilities.setTemporalCapabilities(temporal);
    return filterCapabilities;
}
Also used : TemporalCapabilitiesType(net.opengis.filter.v_2_0_0.TemporalCapabilitiesType) FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) TemporalOperatorType(net.opengis.filter.v_2_0_0.TemporalOperatorType) QName(javax.xml.namespace.QName) TemporalOperatorsType(net.opengis.filter.v_2_0_0.TemporalOperatorsType) TemporalOperandsType(net.opengis.filter.v_2_0_0.TemporalOperandsType)

Example 10 with FilterCapabilities

use of net.opengis.filter.v_2_0_0.FilterCapabilities in project ddf by codice.

the class TestWfsFilterDelegate method testNoComparisonOps.

@Test
public void testNoComparisonOps() {
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.setScalarCapabilities(null);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    assertThat(delegate.isLogicalOps(), is(false));
    assertThat(delegate.isEpsg4326(), is(true));
    assertThat(delegate.isSortingSupported(), is(true));
    assertThat(delegate.getSrsName(), is(GeospatialUtil.EPSG_4326_URN));
    assertThat(delegate.getComparisonOps().size(), is(0));
    assertThat(delegate.getGeometryOperands().size(), greaterThan(0));
    assertThat(delegate.getSpatialOps().size(), is(SPATIAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOps().size(), is(TEMPORAL_OPERATORS.values().length));
    assertThat(delegate.getTemporalOperands().size(), greaterThan(0));
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) Test(org.junit.Test)

Aggregations

FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)17 ArrayList (java.util.ArrayList)15 Test (org.junit.Test)12 FilterType (net.opengis.filter.v_2_0_0.FilterType)7 FilterCapabilities (net.opengis.filter.v_1_1_0.FilterCapabilities)6 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)6 QName (javax.xml.namespace.QName)5 ComparisonOperatorsType (net.opengis.filter.v_1_1_0.ComparisonOperatorsType)5 LogicalOperators (net.opengis.filter.v_1_1_0.LogicalOperators)5 ScalarCapabilitiesType (net.opengis.filter.v_1_1_0.ScalarCapabilitiesType)5 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)5 SpatialCapabilitiesType (net.opengis.filter.v_1_1_0.SpatialCapabilitiesType)4 SpatialOperatorsType (net.opengis.filter.v_1_1_0.SpatialOperatorsType)4 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)4 Date (java.util.Date)3 SpatialOperatorType (net.opengis.filter.v_1_1_0.SpatialOperatorType)3 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)3 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)3 ComparisonOperatorType (net.opengis.filter.v_2_0_0.ComparisonOperatorType)3 ComparisonOperatorsType (net.opengis.filter.v_2_0_0.ComparisonOperatorsType)3