### Question:
QueryExecutor { public void execute(QueryExecPlan plan) { final int executeLimit = 2 * plan.getActionCount(); int executeCounter = 0; AbstractAction rootAction = plan.getRootAction(); ExecuteContext context = new ExecuteContext(plan); if (plan.getAggAction() != null) { AggregateAction aggAction = (AggregateAction) plan.getAggAction(); if (aggAction.isOneTableAggregation()) { execute(executeLimit, executeCounter, aggAction, context); } else { executeCounter = execute(executeLimit, executeCounter, rootAction, context); execute(executeLimit, executeCounter, aggAction, context); } } else { execute(executeLimit, executeCounter, rootAction, context); } plan.addExplanations(context.explanations); } QueryExecutor(QueryContext context); void execute(QueryExecPlan plan);  }### Answer:
@Test public void test01() { String query = "Environment{*}.applications[@label = \"srp-app\"]{*}.services[@name = \"srp-app:Raptor-00004\"]{*}.runsOn{*}"; QueryExecPlan plan = getTranslator(raptorContext).translate(raptorParser.parse(query)); QueryOptimizer optimizer = new QueryOptimizer(raptorContext); optimizer.optimize(plan); QueryExecutor executor = new QueryExecutor(raptorContext); executor.execute(plan); QueryServiceImpl.populateResult(plan, raptorContext); IQueryResult result = plan.getQueryResult(); Assert.assertEquals(1, result.getEntities().size()); }
@Test public void test02() { String query = "Manifest{*}.versions[@name=\"Dummy ManifestVersion Bundle-0-0001\"]{*}.packages{*}.versions{*}"; QueryExecPlan plan = getTranslator(deployContext).translate(deployParser.parse(query)); QueryOptimizer optimizer = new QueryOptimizer(deployContext); optimizer.optimize(plan); QueryExecutor executor = new QueryExecutor(deployContext); executor.execute(plan); QueryServiceImpl.populateResult(plan, deployContext); IQueryResult result = plan.getQueryResult(); Assert.assertEquals(1, result.getEntities().size()); }