* @throws Exception
*/
@Test
public void testMixedQueries() throws Exception {
final int EXPECTED_RESULT_COUNT = 1;
SimpleFeatureSource fs = store.getFeatureSource(testData.getTempTableName());
SimpleFeatureType schema = fs.getSchema();
Filter bboxFilter = ff.bbox(schema.getGeometryDescriptor().getLocalName(), -60, -55, -40,
-20, schema.getCoordinateReferenceSystem().getName().getCode());
Filter sqlFilter = CQL.toFilter("INT32_COL < 5");
LOGGER.fine("Geometry filter: " + bboxFilter);
LOGGER.fine("SQL filter: " + sqlFilter);
And mixedFilter = ff.and(sqlFilter, bboxFilter);
Not not = ff.not(ff.id(Collections.singleton(ff.featureId(testData.getTempTableName()
+ ".90000"))));
mixedFilter = ff.and(mixedFilter, not);
LOGGER.fine("Mixed filter: " + mixedFilter);
// verify both filter constraints are met
try {
testFilter(mixedFilter, fs, EXPECTED_RESULT_COUNT);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
// check that getBounds and size do function
SimpleFeatureIterator reader = null;
SimpleFeatureCollection results = fs.getFeatures(mixedFilter);
Envelope bounds = results.getBounds();
assertNotNull(bounds);
LOGGER.fine("results bounds: " + bounds);
reader = results.features();