use of net.opengis.filter.v_1_1_0.FilterCapabilities 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);
}
}
use of net.opengis.filter.v_1_1_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));
}
use of net.opengis.filter.v_1_1_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));
}
use of net.opengis.filter.v_1_1_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);
}
use of net.opengis.filter.v_1_1_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;
}
Aggregations