@Test public void reportsHealthy() throws Exception { JooqHealthCheck healthCheck = new JooqHealthCheck(dataSource, LOG_ONLY); assertThat(healthCheck.check().isHealthy()).isTrue(); healthCheck = new JooqHealthCheck(dataSource, RETURN_UNHEALTHY); assertThat(healthCheck.check().isHealthy()).isTrue(); }
@Override protected Result check() throws Exception { try { databaseAgnostic(dataSource).selectOne().execute(); } catch (DataAccessException | SQLException e) { switch (onFailure) { case LOG_ONLY: logger.warn("Unhealthy connection to database."); break; case RETURN_UNHEALTHY: return Result.unhealthy("Unhealthy connection to database."); } } return Result.healthy(); }
JooqHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { try { databaseAgnostic(dataSource).selectOne().execute(); } catch (DataAccessException | SQLException e) { switch (onFailure) { case LOG_ONLY: logger.warn("Unhealthy connection to database."); break; case RETURN_UNHEALTHY: return Result.unhealthy("Unhealthy connection to database."); } } return Result.healthy(); } }
JooqHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { try { databaseAgnostic(dataSource).selectOne().execute(); } catch (DataAccessException | SQLException e) { switch (onFailure) { case LOG_ONLY: logger.warn("Unhealthy connection to database."); break; case RETURN_UNHEALTHY: return Result.unhealthy("Unhealthy connection to database."); } } return Result.healthy(); } JooqHealthCheck(ManagedDataSource dataSource, OnFailure onFailure); }
JooqHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { try { databaseAgnostic(dataSource).selectOne().execute(); } catch (DataAccessException | SQLException e) { switch (onFailure) { case LOG_ONLY: logger.warn("Unhealthy connection to database."); break; case RETURN_UNHEALTHY: return Result.unhealthy("Unhealthy connection to database."); } } return Result.healthy(); } JooqHealthCheck(ManagedDataSource dataSource, OnFailure onFailure);  }
JooqHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { try { databaseAgnostic(dataSource).selectOne().execute(); } catch (DataAccessException | SQLException e) { switch (onFailure) { case LOG_ONLY: logger.warn("Unhealthy connection to database."); break; case RETURN_UNHEALTHY: return Result.unhealthy("Unhealthy connection to database."); } } return Result.healthy(); } JooqHealthCheck(ManagedDataSource dataSource, OnFailure onFailure);   }