use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method testNoAttribute1Source.
@Test
public void testNoAttribute1Source() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST6' AND RELATION == 'REL1-REL2'");
String transformed = logic.getEventQuery(query);
assertEquals("(SOURCEFIELD1 == 'sourceValue' AND TARGETFIELD1 == 'targetValue')", transformed);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method testManditoryFieldEdgeType.
@Test(expected = IllegalArgumentException.class)
public void testManditoryFieldEdgeType() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
logic.getEventQuery(query);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class DefaultEdgeEventQueryLogicTest method testMismatchRelationshipSource.
@Test(expected = IllegalArgumentException.class)
public void testMismatchRelationshipSource() throws Exception {
Query query = new QueryImpl();
query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST7' AND RELATION == 'NOREL1-NOREL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
// throws because BLAH1 and BLAH2 aren't in the edge dictionary
logic.getEventQuery(query);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testPatternWithType.
@Test
public void testPatternWithType() throws Exception {
QueryImpl q = configQuery("(SOURCE =~ 'M.*') && TYPE == 'AdjacentPlanets' ", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
expected.add("mars%00;earth AdjacentPlanets/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mars%00;jupiter AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mercury%00;venus AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
compareResults(logic, expected);
}
use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.
the class EdgeQueryFunctionalTest method testPatternWithLeadingWildcard.
@Test
public void testPatternWithLeadingWildcard() throws Exception {
QueryImpl q = configQuery("(SOURCE =~ 'M.*') && SINK =~ '.*S' && (RELATION == 'FROM-TO' || RELATION == 'TO-FROM')", auths);
EdgeQueryLogic logic = runLogic(q, auths);
List<String> expected = new ArrayList<>();
expected.add("mars%00;ceres AdjacentCelestialBodies/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [B]");
expected.add("mars STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
expected.add("mercury STATS/ACTIVITY/Planets/TO:20150713/COSMOS_DATA [B]");
expected.add("mercury%00;venus AdjacentPlanets/FROM-TO:20150713/COSMOS_DATA-COSMOS_DATA [A]");
expected.add("mars%00;ceres AdjacentDwarfPlanets/TO-FROM:20150713/COSMOS_DATA-COSMOS_DATA [B]");
compareResults(logic, expected);
}
Aggregations