use of ogc.schema.opengis.filter_capabilities.v_1_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));
}
use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.
the class TestWfsFilterDelegate method makeDelegateForLogicalSupportTests.
private WfsFilterDelegate makeDelegateForLogicalSupportTests() {
String mockProperty = "myPropertyName";
String mockType = "myType";
List<String> mockProperties = new ArrayList<>(1);
mockProperties.add(mockProperty);
when(mockFeatureMetacardType.getProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getGmlProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getTextualProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getTemporalProperties()).thenReturn(mockProperties);
when(mockFeatureMetacardType.getName()).thenReturn(mockType);
FeatureAttributeDescriptor mockFeatureAttributeDescriptor = mock(FeatureAttributeDescriptor.class);
when(mockFeatureAttributeDescriptor.isIndexed()).thenReturn(true);
when(mockFeatureAttributeDescriptor.getPropertyName()).thenReturn(mockProperty);
when(mockFeatureMetacardType.getAttributeDescriptor(mockProperty)).thenReturn(mockFeatureAttributeDescriptor);
FilterCapabilities filterCap = MockWfsServer.getFilterCapabilities();
//Create new ScalarCapabiltiesType without Logical Operator support
ScalarCapabilitiesType scalar = new ScalarCapabilitiesType();
scalar.setComparisonOperators(new ComparisonOperatorsType());
for (COMPARISON_OPERATORS compOp : COMPARISON_OPERATORS.values()) {
ComparisonOperatorType operator = new ComparisonOperatorType();
operator.setName(compOp.toString());
scalar.getComparisonOperators().getComparisonOperator().add(operator);
}
filterCap.setScalarCapabilities(scalar);
return new WfsFilterDelegate(mockFeatureMetacardType, filterCap, GeospatialUtil.EPSG_4326_URN, null, GeospatialUtil.LAT_LON_ORDER);
}
use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.
the class TestCswEndpoint method verifyFilterCapabilities.
/**
* Helper method to verify the FilterCapabilities section matches the endpoint's definition
*
* @param ct The CapabilitiesType to verify
*/
private void verifyFilterCapabilities(CapabilitiesType ct) {
FilterCapabilities fc = ct.getFilterCapabilities();
assertThat(fc.getIdCapabilities(), notNullValue());
assertThat(fc.getIdCapabilities().getEIDOrFID(), hasSize(1));
assertThat(fc.getScalarCapabilities(), notNullValue());
assertThat(CswEndpoint.COMPARISON_OPERATORS, hasSize(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator().size()));
for (ComparisonOperatorType cot : CswEndpoint.COMPARISON_OPERATORS) {
assertThat(fc.getScalarCapabilities().getComparisonOperators().getComparisonOperator(), hasItem(cot));
}
assertThat(fc.getSpatialCapabilities(), notNullValue());
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasSize(fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator().size()));
for (SpatialOperatorType sot : fc.getSpatialCapabilities().getSpatialOperators().getSpatialOperator()) {
assertThat(CswEndpoint.SPATIAL_OPERATORS, hasItem(sot.getName()));
}
}
use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.
the class TestCswFilterDelegate method getMockFilterCapabilitiesForSpatialFallback.
private FilterCapabilities getMockFilterCapabilitiesForSpatialFallback(List<SpatialOperatorNameType> spatialOperatorNameTypes, List<String> geometries) {
FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
List<SpatialOperatorType> spatialOperatorList = new ArrayList<>();
for (SpatialOperatorNameType spatialOperatorNameType : spatialOperatorNameTypes) {
SpatialOperatorType spatialOperatorType = new SpatialOperatorType();
spatialOperatorType.setName(spatialOperatorNameType);
spatialOperatorList.add(spatialOperatorType);
}
SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(spatialOperatorList);
SpatialCapabilitiesType mockSpatialCapabilities = getSpatialCapabilities(geometries);
when(mockSpatialCapabilities.getSpatialOperators()).thenReturn(mockSpatialOperatorsType);
ScalarCapabilitiesType mockScalarCapabilities = mock(ScalarCapabilitiesType.class);
when(mockScalarCapabilities.getComparisonOperators()).thenReturn(mockComparisonOps);
when(mockFilterCapabilities.getScalarCapabilities()).thenReturn(mockScalarCapabilities);
when(mockFilterCapabilities.getSpatialCapabilities()).thenReturn(mockSpatialCapabilities);
when(mockScalarCapabilities.getLogicalOperators()).thenReturn(mock(LogicalOperators.class));
return mockFilterCapabilities;
}
use of ogc.schema.opengis.filter_capabilities.v_1_0_0.FilterCapabilities in project ddf by codice.
the class TestCswFilterDelegate method getMockFilterCapabilities.
private static FilterCapabilities getMockFilterCapabilities() {
FilterCapabilities mockFilterCapabilities = mock(FilterCapabilities.class);
ComparisonOperatorsType mockComparisonOps = mock(ComparisonOperatorsType.class);
when(mockComparisonOps.getComparisonOperator()).thenReturn(getFullComparisonOpsList());
SpatialOperatorsType mockSpatialOperatorsType = mock(SpatialOperatorsType.class);
when(mockSpatialOperatorsType.getSpatialOperator()).thenReturn(getSpatialOperatorsList());
SpatialCapabilitiesType mockSpatialCapabilities = getAllSpatialCapabilities();
when(mockSpatialCapabilities.getSpatialOperators()).thenReturn(mockSpatialOperatorsType);
ScalarCapabilitiesType mockScalarCapabilities = mock(ScalarCapabilitiesType.class);
when(mockScalarCapabilities.getComparisonOperators()).thenReturn(mockComparisonOps);
when(mockFilterCapabilities.getScalarCapabilities()).thenReturn(mockScalarCapabilities);
when(mockFilterCapabilities.getSpatialCapabilities()).thenReturn(mockSpatialCapabilities);
when(mockScalarCapabilities.getLogicalOperators()).thenReturn(mock(LogicalOperators.class));
return mockFilterCapabilities;
}
Aggregations