public void testOnModuleExceptionsArePropagated() {
   Settings settings = Settings.builder().put("path.home", createTempDir()).build();
   PluginsService service = newPluginsService(settings, FailOnModule.class);
   try {
     service.processModule(new BrokenModule());
     fail("boom");
   } catch (ElasticsearchException ex) {
     assertEquals("failed to invoke onModule", ex.getMessage());
     assertEquals("boom", ex.getCause().getCause().getMessage());
   }
 }
Esempio n. 2
0
 public final boolean open() {
   if (client == null) {
     client = createClient();
   }
   try {
     connect();
   } catch (ElasticsearchException e) {
     logger.error(
         "Failed to connect to " + getClusterName() + ", reason='" + e.getMessage() + "'");
     close();
     return false;
   }
   return true;
 }