@Test public void test_get_one_river() throws InterruptedException { Assert.assertNotNull(adminService); XContentBuilder xb = new FSRiverHelper() .toXContent( new FSRiver( "mytestriver", SMDSearchProperties.INDEX_NAME, SMDSearchProperties.INDEX_TYPE_DOC, "tmp", "/tmp_es", 30L, "standard", false)); client .prepareIndex( SMDSearchProperties.ES_META_INDEX, SMDSearchProperties.ES_META_RIVERS, "mytestriver") .setSource(xb) .execute() .actionGet(); // We have to refresh docs client .admin() .indices() .prepareRefresh(SMDSearchProperties.ES_META_INDEX) .execute() .actionGet(); FSRiver fsriver = adminService.get("mytestriver"); Assert.assertNotNull("Rivers should exist", fsriver); }
@Test public void test_get_nonexisting_river() throws InterruptedException { Assert.assertNotNull(adminService); FSRiver fsriver = adminService.get("iamariverthatdoesntexist"); Assert.assertNull("Rivers should not exist", fsriver); }