use of ddf.catalog.cache.solr.impl.ValidationQueryFactory in project ddf by codice.
the class CatalogFrameworkImplTest method createDummyCatalogFramework.
private CatalogFramework createDummyCatalogFramework(CatalogProvider provider, Map<String, CatalogStore> stores, Map<String, FederatedSource> sources, MockEventProcessor eventAdmin) {
SourcePoller mockPoller = mock(SourcePoller.class);
when(mockPoller.getCachedSource(isA(Source.class))).thenReturn(null);
FederationStrategy federationStrategy = new FederationStrategy() {
@Override
public QueryResponse federate(List<Source> sources, QueryRequest query) throws FederationException {
List<Result> results = new ArrayList<>();
for (Source source : sources) {
try {
SourceResponse response = source.query(query);
results.addAll(response.getResults());
} catch (UnsupportedQueryException e) {
}
}
return new QueryResponseImpl(query, results, results.size());
}
};
ArrayList<PostIngestPlugin> postIngestPlugins = new ArrayList<>();
postIngestPlugins.add(eventAdmin);
FrameworkProperties frameworkProperties = new FrameworkProperties();
frameworkProperties.setCatalogProviders(Collections.singletonList(provider));
frameworkProperties.setStorageProviders(Collections.singletonList(storageProvider));
frameworkProperties.setCatalogStoresMap(stores);
frameworkProperties.setSourcePoller(mockPoller);
frameworkProperties.setPreIngest(new ArrayList<>());
frameworkProperties.setPostIngest(postIngestPlugins);
frameworkProperties.setPreQuery(new ArrayList<>());
frameworkProperties.setPostQuery(new ArrayList<>());
frameworkProperties.setPolicyPlugins(new ArrayList<>());
frameworkProperties.setAccessPlugins(new ArrayList<>());
frameworkProperties.setFederatedSources(sources);
frameworkProperties.setConnectedSources(new ArrayList<>());
frameworkProperties.setFederationStrategy(federationStrategy);
frameworkProperties.setQueryResponsePostProcessor(new QueryResponsePostProcessor(null, null));
frameworkProperties.setFilterBuilder(new GeotoolsFilterBuilder());
frameworkProperties.setValidationQueryFactory(new ValidationQueryFactory(new GeotoolsFilterAdapterImpl(), new GeotoolsFilterBuilder()));
frameworkProperties.setDefaultAttributeValueRegistry(defaultAttributeValueRegistry);
return createFramework(frameworkProperties);
}
Aggregations