Search in sources :

Example 1 with QueryMetricFactory

use of datawave.microservice.querymetric.QueryMetricFactory in project datawave by NationalSecurityAgency.

the class AbstractFunctionalQuery method runTestQuery.

/**
 * Executes the query and performs validation of the results.
 *
 * @param expected
 *            expected results from the query
 * @param queryStr
 *            execution query string
 * @param startDate
 *            start date for query (inclusive)
 * @param endDate
 *            end date for query (exclusive)
 * @param options
 *            optional parameters to query
 * @param checkers
 *            optional list of assert checker methods
 * @param authSet
 *            optional set of authorizations to use. If null or empty, will use default auths.
 */
protected void runTestQuery(Collection<String> expected, String queryStr, Date startDate, Date endDate, Map<String, String> options, List<DocumentChecker> checkers, Set<Authorizations> authSet) throws Exception {
    if (log.isDebugEnabled()) {
        log.debug("  query[" + queryStr + "]  start(" + YMD_DateFormat.format(startDate) + ")  end(" + YMD_DateFormat.format(endDate) + ")");
    }
    if (authSet == null || authSet.isEmpty()) {
        authSet = this.authSet;
    }
    QueryImpl q = new QueryImpl();
    q.setBeginDate(startDate);
    q.setEndDate(endDate);
    q.setQuery(queryStr);
    q.setParameters(options);
    q.setId(UUID.randomUUID());
    q.setPagesize(Integer.MAX_VALUE);
    q.setQueryAuthorizations(auths.toString());
    if (useRunningQuery) {
        QueryMetricFactory queryMetricFactory = (metricFactory == null) ? new QueryMetricFactoryImpl() : metricFactory;
        new RunningQuery(connector, AccumuloConnectionFactory.Priority.NORMAL, this.logic, q, "", principal, queryMetricFactory);
    } else {
        GenericQueryConfiguration config = this.logic.initialize(connector, q, authSet);
        this.logic.setupQuery(config);
        if (log.isDebugEnabled()) {
            log.debug("Plan: " + config.getQueryString());
        }
    }
    testHarness.assertLogicResults(this.logic, expected, checkers);
}
Also used : QueryImpl(datawave.webservice.query.QueryImpl) RunningQuery(datawave.webservice.query.runner.RunningQuery) QueryMetricFactoryImpl(datawave.microservice.querymetric.QueryMetricFactoryImpl) QueryMetricFactory(datawave.microservice.querymetric.QueryMetricFactory) GenericQueryConfiguration(datawave.webservice.query.configuration.GenericQueryConfiguration)

Aggregations

QueryMetricFactory (datawave.microservice.querymetric.QueryMetricFactory)1 QueryMetricFactoryImpl (datawave.microservice.querymetric.QueryMetricFactoryImpl)1 QueryImpl (datawave.webservice.query.QueryImpl)1 GenericQueryConfiguration (datawave.webservice.query.configuration.GenericQueryConfiguration)1 RunningQuery (datawave.webservice.query.runner.RunningQuery)1