Search in sources :

Example 31 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class DefaultEdgeEventQueryLogicTest method testManditoryFieldEdgeRelationship.

@Test(expected = IllegalArgumentException.class)
public void testManditoryFieldEdgeRelationship() throws Exception {
    Query query = new QueryImpl();
    query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST1' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
    logic.getEventQuery(query);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) Test(org.junit.Test)

Example 32 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class DefaultEdgeEventQueryLogicTest method testBogusType.

@Test(expected = IllegalArgumentException.class)
public void testBogusType() throws Exception {
    Query query = new QueryImpl();
    query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'DOESNTEXIST' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
    // throws because BLAH1 and BLAH2 aren't in the edge dictionary
    logic.getEventQuery(query);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) Test(org.junit.Test)

Example 33 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class DefaultEdgeEventQueryLogicTest method testGroupedNumberedField.

@Test
public void testGroupedNumberedField() throws Exception {
    Query query = new QueryImpl();
    query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST9' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
    String transformed = logic.getEventQuery(query);
    assertEquals("($1_5_R == 'sourceValue' AND $5_6 == 'targetValue' AND $1_5 == 'enrichValue')", transformed);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) Test(org.junit.Test)

Example 34 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class DefaultEdgeEventQueryLogicTest method testEdgesWithPreconditions.

@Test
public void testEdgesWithPreconditions() throws Exception {
    Query query = new QueryImpl();
    query.setQuery("SOURCE == '$200_1_R' AND SINK == '$200_3_R' AND TYPE == 'TEST10' AND RELATION == 'REL1-REL2'");
    String transformed = logic.getEventQuery(query);
    assertEquals("($200_1_R == '$200_1_R' AND $200_3_R == '$200_3_R' AND F05_3_R == 'enrichValue' AND ($200_1_R == $123))", transformed);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) Test(org.junit.Test)

Example 35 with QueryImpl

use of datawave.webservice.query.QueryImpl in project datawave by NationalSecurityAgency.

the class DefaultEdgeEventQueryLogicTest method testMultipleSource.

@Test
public void testMultipleSource() throws Exception {
    Query query = new QueryImpl();
    query.setQuery("SOURCE == 'sourceValue' AND SINK == 'targetValue' AND TYPE == 'TEST2' AND RELATION == 'REL1-REL2' AND ATTRIBUTE1 == 'SOURCE1-SOURCE2'");
    String transformed = logic.getEventQuery(query);
    assertEquals("(SOURCEFIELD1 == 'sourceValue' AND TARGETFIELD1 == 'targetValue' AND ENRICHFIELD1 == 'enrichValue1') OR (SOURCEFIELD2 == 'sourceValue' AND TARGETFIELD2 == 'targetValue' AND ENRICHFIELD2 == 'enrichValue2')", transformed);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) Query(datawave.webservice.query.Query) Test(org.junit.Test)

Aggregations

QueryImpl (datawave.webservice.query.QueryImpl)131 Test (org.junit.Test)96 ArrayList (java.util.ArrayList)54 Query (datawave.webservice.query.Query)40 HashSet (java.util.HashSet)27 BaseQueryLogic (datawave.webservice.query.logic.BaseQueryLogic)18 GenericQueryConfiguration (datawave.webservice.query.configuration.GenericQueryConfiguration)16 Date (java.util.Date)16 QueryParametersImpl (datawave.webservice.query.QueryParametersImpl)14 MultivaluedMapImpl (org.jboss.resteasy.specimpl.MultivaluedMapImpl)13 QueryMetricFactoryImpl (datawave.microservice.querymetric.QueryMetricFactoryImpl)12 QueryParameters (datawave.webservice.query.QueryParameters)12 Value (org.apache.accumulo.core.data.Value)10 Document (datawave.query.attributes.Document)9 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)9 EdgeQueryFunctionalTest (datawave.query.tables.edge.EdgeQueryFunctionalTest)9 QueryLogic (datawave.webservice.query.logic.QueryLogic)9 HashMap (java.util.HashMap)9 Key (org.apache.accumulo.core.data.Key)9 Authorizations (org.apache.accumulo.core.security.Authorizations)9