use of ddf.catalog.filter.FilterAdapter in project ddf by codice.
the class FilterAdapterTest method assertFilterEquals.
private void assertFilterEquals(String expected, Filter filter) {
FilterDelegate<String> delegate = new FilterToTextDelegate();
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
String result = null;
try {
result = fa.adapt(filter, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
assertThat(result, is(expected));
}
use of ddf.catalog.filter.FilterAdapter in project ddf by codice.
the class FilterAdapterTest method assertFilterFails.
private void assertFilterFails(Filter filter) {
FilterDelegate<String> delegate = new FilterToTextDelegate();
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
try {
fa.adapt(filter, delegate);
fail("Expected UnsupportedQueryException");
} catch (UnsupportedQueryException e) {
// pass
}
}
use of ddf.catalog.filter.FilterAdapter in project ddf by codice.
the class CopyFilterDelegateTest method assertFilterException.
private void assertFilterException(Filter filterIn) {
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
// the UnsupportedQueryException thrown by the FilterAdapter.
try {
fa.adapt(filterIn, delegate);
fail("Should have gotten an UnsupportedQueryException");
} catch (UnsupportedQueryException e) {
assertTrue(e.getCause() instanceof UnsupportedOperationException);
}
}
use of ddf.catalog.filter.FilterAdapter in project ddf by codice.
the class CopyFilterDelegateTest method assertFilterContentsEqual.
private void assertFilterContentsEqual(Filter filterIn, Filter filterCopy) {
FilterDelegate<String> delegate = new FilterToTextDelegate();
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
String filterInString = null;
String filterCopyString = null;
try {
filterInString = fa.adapt(filterIn, delegate);
filterCopyString = fa.adapt(filterCopy, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
LOGGER.debug("filterInString: {}", filterInString);
LOGGER.debug("filterCopyString: {}", filterCopyString);
assertNotNull(filterInString);
assertNotNull(filterCopyString);
assertEquals(filterInString, filterCopyString);
}
use of ddf.catalog.filter.FilterAdapter in project ddf by codice.
the class CopyFilterDelegateTest method testExcludeFilter.
@Test
public void testExcludeFilter() {
Filter filterIn = Filter.EXCLUDE;
FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
FilterDelegate<Filter> delegate = new CopyFilterDelegate(filterBuilder);
FilterAdapter fa = new GeotoolsFilterAdapterImpl();
Filter filterCopy = null;
try {
filterCopy = fa.adapt(filterIn, delegate);
} catch (UnsupportedQueryException e) {
fail(e.getMessage());
}
assertNotNull(filterCopy);
assertSame(filterIn, filterCopy);
}
Aggregations