@Test public void testGetByUsername() { LOG.info( "\n===ProviderParamsDaoTest.testGetByUsername===\n" ); ProviderParams pp = ESSuiteTest.ppDao.getByUser( ESSuiteTest.USER_1 ); assertEquals( ESSuiteTest.IMAGE_ID, pp.getImageId() ); }
public ProviderParams getByUser( String username ) { SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "_id", username ) ) .execute() .actionGet(); LOG.debug( "response: {}", response ); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toProviderParams( hits[ 0 ] ) : null; }
ProviderParamsDao extends Dao { public ProviderParams getByUser( String username ) { SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "_id", username ) ) .execute() .actionGet(); LOG.debug( "response: {}", response ); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toProviderParams( hits[ 0 ] ) : null; } }
ProviderParamsDao extends Dao { public ProviderParams getByUser( String username ) { SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "_id", username ) ) .execute() .actionGet(); LOG.debug( "response: {}", response ); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toProviderParams( hits[ 0 ] ) : null; } @Inject  ProviderParamsDao( IElasticSearchClient e ); }
ProviderParamsDao extends Dao { public ProviderParams getByUser( String username ) { SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "_id", username ) ) .execute() .actionGet(); LOG.debug( "response: {}", response ); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toProviderParams( hits[ 0 ] ) : null; } @Inject  ProviderParamsDao( IElasticSearchClient e ); boolean save( final ProviderParams pp ); ProviderParams getByUser( String username ); List<ProviderParams> getAll(); boolean delete( String username ); }
ProviderParamsDao extends Dao { public ProviderParams getByUser( String username ) { SearchResponse response = getRequest( DAO_INDEX_KEY, DAO_TYPE_KEY ) .setQuery( termQuery( "_id", username ) ) .execute() .actionGet(); LOG.debug( "response: {}", response ); SearchHit hits[] = response.getHits().hits(); return hits.length > 0 ? toProviderParams( hits[ 0 ] ) : null; } @Inject  ProviderParamsDao( IElasticSearchClient e ); boolean save( final ProviderParams pp ); ProviderParams getByUser( String username ); List<ProviderParams> getAll(); boolean delete( String username ); static final String DAO_INDEX_KEY; static final String DAO_TYPE_KEY; }