Search in sources :

Example 51 with FilterType

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

the class TestWfsFilterDelegate method intersectsMultiple.

private void intersectsMultiple(boolean indexed) {
    List<String> gmlProps = new ArrayList<>();
    gmlProps.add(MOCK_GEOM);
    gmlProps.add(MOCK_GEOM2);
    when(mockFeatureMetacardType.getGmlProperties()).thenReturn(gmlProps);
    for (String gmlProp : gmlProps) {
        when(mockFeatureMetacardType.getAttributeDescriptor(gmlProp)).thenReturn(new FeatureAttributeDescriptor(gmlProp, gmlProp, indexed, false, false, false, BasicTypes.STRING_TYPE));
    }
    SpatialOperatorType operator = new SpatialOperatorType();
    operator.setName(SPATIAL_OPERATORS.Intersects.toString());
    FilterCapabilities capabilities = MockWfsServer.getFilterCapabilities();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().clear();
    capabilities.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().add(operator);
    WfsFilterDelegate delegate = new WfsFilterDelegate(mockFeatureMetacardType, capabilities, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    if (indexed) {
        assertNotNull(filter);
        assertTrue(filter.isSetLogicOps());
        assertNotNull(filter.getLogicOps());
    } else {
        assertNull(filter);
    }
}
Also used : FilterCapabilities(net.opengis.filter.v_2_0_0.FilterCapabilities) FilterType(net.opengis.filter.v_2_0_0.FilterType) FeatureAttributeDescriptor(org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor) SpatialOperatorType(net.opengis.filter.v_2_0_0.SpatialOperatorType) ArrayList(java.util.ArrayList)

Example 52 with FilterType

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

the class TestWfsFilterDelegate method testIsInFilterSequenceType.

@Test
public void testIsInFilterSequenceType() throws Exception {
    setupMockMetacardType();
    FilterType beforeFilter = setupBeforeFilterType();
    FilterType afterFilter = setupAfterFilterType();
    FilterType duringFilter = setupDuringFilterType();
    WfsFilterDelegate afterDelegate = setupTemporalFilterDelegate();
    WfsFilterDelegate beforeDelegate = setupTemporalFilterDelegate();
    // Test is before filter type
    assertThat(beforeDelegate.isBeforeFilter(beforeFilter), is(true));
    assertThat(beforeDelegate.isBeforeFilter(afterFilter), is(false));
    assertThat(beforeDelegate.isBeforeFilter(duringFilter), is(false));
    // Test is during filter type
    assertThat(afterDelegate.isDuringFilter(duringFilter), is(true));
    assertThat(afterDelegate.isDuringFilter(beforeFilter), is(false));
    assertThat(afterDelegate.isDuringFilter(afterFilter), is(false));
    // Test is after filter type
    assertThat(afterDelegate.isAfterFilter(afterFilter), is(true));
    assertThat(afterDelegate.isAfterFilter(beforeFilter), is(false));
    assertThat(afterDelegate.isAfterFilter(duringFilter), is(false));
}
Also used : FilterType(net.opengis.filter.v_2_0_0.FilterType) Test(org.junit.Test)

Example 53 with FilterType

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

the class TestWfsFilterDelegate method testIntersectsAsBoundingBox.

@Test
public void testIntersectsAsBoundingBox() throws SAXException, IOException, JAXBException {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.BBOX.toString());
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertNotNull(filter);
    assertTrue(filter.getSpatialOps().getValue() instanceof BBOXType);
    assertFalse(filter.isSetLogicOps());
    assertXMLEqual(MockWfsServer.getBboxXmlFilter(), getXmlFromMarshaller(filter));
}
Also used : FilterType(net.opengis.filter.v_2_0_0.FilterType) BBOXType(net.opengis.filter.v_2_0_0.BBOXType) Test(org.junit.Test)

Example 54 with FilterType

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

the class TestWfsFilterDelegate method testLogicalNotNoLogicalSupport.

@Test(expected = UnsupportedOperationException.class)
public void testLogicalNotNoLogicalSupport() throws Exception {
    WfsFilterDelegate delegate = makeDelegateForLogicalSupportTests();
    FilterType filterToBeNoted = delegate.propertyIsLike(Metacard.ANY_TEXT, LITERAL, true);
    //Perform Test
    delegate.not(filterToBeNoted);
}
Also used : FilterType(net.opengis.filter.v_2_0_0.FilterType) Test(org.junit.Test)

Example 55 with FilterType

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

the class TestWfsFilterDelegate method testIntersectsAsNotDisjoint.

@Test
public void testIntersectsAsNotDisjoint() {
    WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.Disjoint.toString());
    FilterType filter = delegate.intersects(Metacard.ANY_GEO, POLYGON);
    assertTrue(filter.isSetLogicOps());
    assertTrue(filter.getLogicOps().getValue() instanceof UnaryLogicOpType);
    UnaryLogicOpType type = (UnaryLogicOpType) filter.getLogicOps().getValue();
    assertTrue(type.isSetSpatialOps());
    assertTrue(type.getSpatialOps().getValue() instanceof BinarySpatialOpType);
}
Also used : UnaryLogicOpType(net.opengis.filter.v_2_0_0.UnaryLogicOpType) FilterType(net.opengis.filter.v_2_0_0.FilterType) BinarySpatialOpType(net.opengis.filter.v_2_0_0.BinarySpatialOpType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)212 FilterType (net.opengis.filter.v_1_1_0.FilterType)209 FilterType (net.opengis.filter.v_2_0_0.FilterType)58 ArrayList (java.util.ArrayList)50 JAXBElement (javax.xml.bind.JAXBElement)12 CswSourceConfiguration (org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration)12 BinaryTemporalOpType (net.opengis.filter.v_2_0_0.BinaryTemporalOpType)11 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)11 QName (javax.xml.namespace.QName)10 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)10 LineString (com.vividsolutions.jts.geom.LineString)9 Date (java.util.Date)9 DistanceBufferType (net.opengis.filter.v_2_0_0.DistanceBufferType)9 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)9 DateTime (org.joda.time.DateTime)8 Method (java.lang.reflect.Method)7 QueryConstraintType (net.opengis.cat.csw.v_2_0_2.QueryConstraintType)7 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)7 TimePeriodType (net.opengis.gml.v_3_2_1.TimePeriodType)7 TimePositionType (net.opengis.gml.v_3_2_1.TimePositionType)7