use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DatawaveSelectorExtractorTest method extractSelectorsJEXLQuery3.
@Test
public void extractSelectorsJEXLQuery3() {
DatawaveSelectorExtractor extractor = new DatawaveSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("FIELD1 == 'selector1' || _ANY_FIELD_ == 'selector2' || (_ANY_FIELD_ == 'selector3' && _ANY_FIELD_ == 'selector4')");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector2", "selector3", "selector4");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class SplitSelectorExtractorTest method extractSelectorsLuceneQuery1.
@Test
public void extractSelectorsLuceneQuery1() {
SplitSelectorExtractor extractor = new SplitSelectorExtractor();
QueryImpl q = new QueryImpl();
q.setQuery("selector1");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class SplitSelectorExtractorTest method extractSelectorsLuceneQuery2.
@Test
public void extractSelectorsLuceneQuery2() {
SplitSelectorExtractor extractor = new SplitSelectorExtractor();
extractor.setSeparatorCharacter(";");
QueryImpl q = new QueryImpl();
q.setQuery("selector1;selector2;selector3");
List<String> selectorList = extractor.extractSelectors(q);
List<String> expected = Lists.newArrayList("selector1", "selector2", "selector3");
Assert.assertEquals(expected, selectorList);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class ExceededOrThresholdMarkerJexlNodeTest method getQueryRangesIterator.
private Iterator getQueryRangesIterator(String queryString, ShardQueryLogic logic) throws Exception {
MultivaluedMap<String, String> params = new MultivaluedMapImpl<>();
params.putSingle(QUERY_LOGIC_NAME, "EventQuery");
params.putSingle(QUERY_STRING, queryString);
params.putSingle(QUERY_NAME, "geoQuery");
params.putSingle(QUERY_PERSISTENCE, "PERSISTENT");
params.putSingle(QUERY_AUTHORIZATIONS, AUTHS);
params.putSingle(QUERY_EXPIRATION, "20200101 000000.000");
params.putSingle(QUERY_BEGIN, BEGIN_DATE);
params.putSingle(QUERY_END, END_DATE);
QueryParameters queryParams = new QueryParametersImpl();
queryParams.validate(params);
Set<Authorizations> auths = new HashSet<>();
auths.add(new Authorizations(AUTHS));
Query query = new QueryImpl();
query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, null);
ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query);
logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths);
logic.setupQuery(config);
return Iterators.transform(config.getQueries(), queryData -> {
try {
return JexlStringBuildingVisitor.buildQuery(PushdownLargeFieldedListsVisitor.pushdown(config, JexlASTHelper.parseJexlQuery(queryData.getQuery()), null, null));
} catch (ParseException e) {
return null;
}
});
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class ContentFunctionQueryTest method getResultsIterator.
private Iterator getResultsIterator(String queryString, ShardQueryLogic logic, MultiValueMap<String, String> optionalParams) throws Exception {
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
params.set(QUERY_STRING, queryString);
params.set(QUERY_NAME, "contentQuery");
params.set(QUERY_LOGIC_NAME, "EventQueryLogic");
params.set(QUERY_PERSISTENCE, "PERSISTENT");
params.set(QUERY_AUTHORIZATIONS, AUTHS);
params.set(QUERY_EXPIRATION, "20200101 000000.000");
params.set(QUERY_BEGIN, BEGIN_DATE);
params.set(QUERY_END, END_DATE);
QueryParameters queryParams = new QueryParametersImpl();
queryParams.validate(params);
Set<Authorizations> auths = new HashSet<>();
auths.add(new Authorizations(AUTHS));
Query query = new QueryImpl();
query.initialize(USER, Arrays.asList(USER_DN), null, queryParams, optionalParams);
ShardQueryConfiguration config = ShardQueryConfiguration.create(logic, query);
logic.initialize(config, instance.getConnector("root", PASSWORD), query, auths);
logic.setupQuery(config);
return logic.getTransformIterator(query);
}
Aggregations