use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method likeFuzzy.
@Test
public void likeFuzzy() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute(FOO_ATTRIBUTE).is().like().fuzzyText("bar");
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(PropertyIsLike.class), anyObject());
// TODO check for fuzzy
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method operatorWithinBufferNull.
@Test(expected = IllegalArgumentException.class)
public void operatorWithinBufferNull() {
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.attribute("something").withinBuffer().wkt(null);
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class FilterBuilderTest method orNull.
@Test
public void orNull() {
FilterVisitor visitor = spy(new DefaultFilterVisitor() {
});
FilterBuilder builder = new GeotoolsFilterBuilder();
Filter filter = builder.anyOf(builder.attribute(FOO_ATTRIBUTE).is().empty());
filter.accept(visitor, null);
InOrder inOrder = inOrder(visitor);
inOrder.verify(visitor, times(1)).visit(isA(Or.class), anyObject());
inOrder.verify(visitor).visit(isA(PropertyIsNull.class), anyObject());
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder in project ddf by codice.
the class CachingFederationStrategyTest method setup.
@Before
public void setup() throws Exception {
cacheExecutor = MoreExecutors.newDirectExecutorService();
queryExecutor = MoreExecutors.newDirectExecutorService();
preQueryPlugin = mock(PreFederatedQueryPlugin.class);
when(preQueryPlugin.process(any(), any())).thenAnswer(invocation -> invocation.getArguments()[1]);
clientAdaptor = mock(SolrClientAdaptor.class);
cache = mock(SolrCache.class);
cacheBulkProcessor = mock(CacheBulkProcessor.class);
cacheCommitPhaser = mock(CacheCommitPhaser.class);
cacheArgs = ArgumentCaptor.forClass((Class) List.class);
validationQueryFactory = mock(ValidationQueryFactory.class);
strategy = new CachingFederationStrategy(queryExecutor, Arrays.asList(preQueryPlugin), new ArrayList<>(), cache, cacheExecutor, validationQueryFactory, new CacheQueryFactory(new GeotoolsFilterBuilder()));
mockSortedQueryMonitorFactory = mock(SortedQueryMonitorFactory.class);
mockSortedQueryMonitor = mock(SortedQueryMonitor.class);
responseArgumentCaptor = ArgumentCaptor.forClass(QueryResponseImpl.class);
requestArgumentCaptor = ArgumentCaptor.forClass(QueryRequestImpl.class);
when(mockSortedQueryMonitorFactory.createMonitor(any(CompletionService.class), any(Map.class), responseArgumentCaptor.capture(), requestArgumentCaptor.capture(), any(List.class))).thenReturn(mockSortedQueryMonitor);
strategy.setSortedQueryMonitorFactory(mockSortedQueryMonitorFactory);
strategy.setCacheCommitPhaser(cacheCommitPhaser);
strategy.setCacheBulkProcessor(cacheBulkProcessor);
mockQuery = mock(Query.class);
when(mockQuery.getTimeoutMillis()).thenReturn(LONG_TIMEOUT);
when(mockQuery.getPageSize()).thenReturn(-1);
mockMetacard = new MetacardImpl();
mockMetacard.setId("mock metacard");
mockResult = new ResultImpl(mockMetacard);
mockResponse = mock(SourceResponse.class);
results = Arrays.asList(mockResult);
when(mockResponse.getResults()).thenReturn(results);
// Set general properties
properties = new HashMap<>();
properties.put(QUERY_MODE, NATIVE_QUERY_MODE);
}
use of ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder 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);
}
}
Aggregations