@Test public void getMap() { LOG.info( "\n===RunResultDaoTest.getMap===\n" ); Map<String, Run> runs = ESSuiteTest.runDao.getMap( ESSuiteTest.COMMIT_ID_1, 2, ESSuiteTest.TEST_NAME_2 ); Run run = runs.get( ESSuiteTest.RUN_ID_5 ); assertNotNull( run ); assertEquals( ESSuiteTest.RUNNER_HOSTNAME_3, run.getRunner() ); Map<Run, List<RunResult>> runResults = ESSuiteTest.runResultDao.getMap( runs ); List<RunResult> results = runResults.get( run ); assertEquals( 3, results.size() ); for ( RunResult result : results ) { LOG.info( result.toString() ); assertEquals( ESSuiteTest.RESULT_RUN_COUNT, result.getRunCount() ); } }
public Map<Run, List<RunResult>> getMap( Map<String, Run> runs ) { String runIds = StringUtils.join( runs.keySet(), ' ' ); SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( multiMatchQuery( runIds, "runId" ) ) .addSort( fieldSort( "createTime" ) ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); HashMap<Run, List<RunResult>> runResults = new HashMap<Run, List<RunResult>>(); for ( SearchHit hit : response.getHits().hits() ) { RunResult runResult = toRunResult( hit ); Run run = runs.get( runResult.getRunId() ); List<RunResult> list = runResults.get( run ); if ( list == null ) { list = new ArrayList<RunResult>(); runResults.put( run, list ); } list.add( runResult ); } return runResults; }
RunResultDao extends Dao { public Map<Run, List<RunResult>> getMap( Map<String, Run> runs ) { String runIds = StringUtils.join( runs.keySet(), ' ' ); SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( multiMatchQuery( runIds, "runId" ) ) .addSort( fieldSort( "createTime" ) ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); HashMap<Run, List<RunResult>> runResults = new HashMap<Run, List<RunResult>>(); for ( SearchHit hit : response.getHits().hits() ) { RunResult runResult = toRunResult( hit ); Run run = runs.get( runResult.getRunId() ); List<RunResult> list = runResults.get( run ); if ( list == null ) { list = new ArrayList<RunResult>(); runResults.put( run, list ); } list.add( runResult ); } return runResults; } }
RunResultDao extends Dao { public Map<Run, List<RunResult>> getMap( Map<String, Run> runs ) { String runIds = StringUtils.join( runs.keySet(), ' ' ); SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( multiMatchQuery( runIds, "runId" ) ) .addSort( fieldSort( "createTime" ) ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); HashMap<Run, List<RunResult>> runResults = new HashMap<Run, List<RunResult>>(); for ( SearchHit hit : response.getHits().hits() ) { RunResult runResult = toRunResult( hit ); Run run = runs.get( runResult.getRunId() ); List<RunResult> list = runResults.get( run ); if ( list == null ) { list = new ArrayList<RunResult>(); runResults.put( run, list ); } list.add( runResult ); } return runResults; } @Inject  RunResultDao( IElasticSearchClient elasticSearchClient ); }
RunResultDao extends Dao { public Map<Run, List<RunResult>> getMap( Map<String, Run> runs ) { String runIds = StringUtils.join( runs.keySet(), ' ' ); SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( multiMatchQuery( runIds, "runId" ) ) .addSort( fieldSort( "createTime" ) ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); HashMap<Run, List<RunResult>> runResults = new HashMap<Run, List<RunResult>>(); for ( SearchHit hit : response.getHits().hits() ) { RunResult runResult = toRunResult( hit ); Run run = runs.get( runResult.getRunId() ); List<RunResult> list = runResults.get( run ); if ( list == null ) { list = new ArrayList<RunResult>(); runResults.put( run, list ); } list.add( runResult ); } return runResults; } @Inject  RunResultDao( IElasticSearchClient elasticSearchClient ); boolean save( RunResult runResult ); boolean delete( String id ); List<RunResult> getAll(); Map<Run, List<RunResult>> getMap( Map<String, Run> runs ); String getFailures( String runResultId ); }
RunResultDao extends Dao { public Map<Run, List<RunResult>> getMap( Map<String, Run> runs ) { String runIds = StringUtils.join( runs.keySet(), ' ' ); SearchResponse response = elasticSearchClient.getClient() .prepareSearch( DAO_INDEX_KEY ) .setTypes( DAO_TYPE_KEY ) .setQuery( multiMatchQuery( runIds, "runId" ) ) .addSort( fieldSort( "createTime" ) ) .setSize( MAX_RESULT_SIZE ) .execute() .actionGet(); HashMap<Run, List<RunResult>> runResults = new HashMap<Run, List<RunResult>>(); for ( SearchHit hit : response.getHits().hits() ) { RunResult runResult = toRunResult( hit ); Run run = runs.get( runResult.getRunId() ); List<RunResult> list = runResults.get( run ); if ( list == null ) { list = new ArrayList<RunResult>(); runResults.put( run, list ); } list.add( runResult ); } return runResults; } @Inject  RunResultDao( IElasticSearchClient elasticSearchClient ); boolean save( RunResult runResult ); boolean delete( String id ); List<RunResult> getAll(); Map<Run, List<RunResult>> getMap( Map<String, Run> runs ); String getFailures( String runResultId ); static final String DAO_INDEX_KEY; static final String DAO_TYPE_KEY; }