@Test public void testCheck_notConfiguredNotEnabled() throws Exception { Result result = underTest.check(); assertThat(result.isHealthy(), is(true)); }
@Override protected Result check() throws Exception { if (!realmManager.isRealmEnabled(DefaultRoleRealm.NAME)) { return Result.healthy("Default Role Realm not in use."); } if (defaultRoleRealm.getRole() == null) { return Result.unhealthy("Default Role Realm is enabled but not configured."); } Role matched = securitySystem.listRoles(DEFAULT_SOURCE).stream() .filter(role -> role.getRoleId().equals(defaultRoleRealm.getRole())).findFirst().orElse(null); if (matched == null) { return Result .unhealthy("Default Role Realm configured to use role %s which doesn't exist.", defaultRoleRealm.getRole()); } return Result.healthy("Default Role Realm configured to use role %s.", defaultRoleRealm.getRole()); }
DefaultRoleHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { if (!realmManager.isRealmEnabled(DefaultRoleRealm.NAME)) { return Result.healthy("Default Role Realm not in use."); } if (defaultRoleRealm.getRole() == null) { return Result.unhealthy("Default Role Realm is enabled but not configured."); } Role matched = securitySystem.listRoles(DEFAULT_SOURCE).stream() .filter(role -> role.getRoleId().equals(defaultRoleRealm.getRole())).findFirst().orElse(null); if (matched == null) { return Result .unhealthy("Default Role Realm configured to use role %s which doesn't exist.", defaultRoleRealm.getRole()); } return Result.healthy("Default Role Realm configured to use role %s.", defaultRoleRealm.getRole()); } }
DefaultRoleHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { if (!realmManager.isRealmEnabled(DefaultRoleRealm.NAME)) { return Result.healthy("Default Role Realm not in use."); } if (defaultRoleRealm.getRole() == null) { return Result.unhealthy("Default Role Realm is enabled but not configured."); } Role matched = securitySystem.listRoles(DEFAULT_SOURCE).stream() .filter(role -> role.getRoleId().equals(defaultRoleRealm.getRole())).findFirst().orElse(null); if (matched == null) { return Result .unhealthy("Default Role Realm configured to use role %s which doesn't exist.", defaultRoleRealm.getRole()); } return Result.healthy("Default Role Realm configured to use role %s.", defaultRoleRealm.getRole()); } @Inject  DefaultRoleHealthCheck(
      final RealmManager realmManager,
      final DefaultRoleRealm defaultRoleRealm,
      final SecuritySystem securitySystem); }
DefaultRoleHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { if (!realmManager.isRealmEnabled(DefaultRoleRealm.NAME)) { return Result.healthy("Default Role Realm not in use."); } if (defaultRoleRealm.getRole() == null) { return Result.unhealthy("Default Role Realm is enabled but not configured."); } Role matched = securitySystem.listRoles(DEFAULT_SOURCE).stream() .filter(role -> role.getRoleId().equals(defaultRoleRealm.getRole())).findFirst().orElse(null); if (matched == null) { return Result .unhealthy("Default Role Realm configured to use role %s which doesn't exist.", defaultRoleRealm.getRole()); } return Result.healthy("Default Role Realm configured to use role %s.", defaultRoleRealm.getRole()); } @Inject  DefaultRoleHealthCheck(
      final RealmManager realmManager,
      final DefaultRoleRealm defaultRoleRealm,
      final SecuritySystem securitySystem);  }
DefaultRoleHealthCheck extends HealthCheck { @Override protected Result check() throws Exception { if (!realmManager.isRealmEnabled(DefaultRoleRealm.NAME)) { return Result.healthy("Default Role Realm not in use."); } if (defaultRoleRealm.getRole() == null) { return Result.unhealthy("Default Role Realm is enabled but not configured."); } Role matched = securitySystem.listRoles(DEFAULT_SOURCE).stream() .filter(role -> role.getRoleId().equals(defaultRoleRealm.getRole())).findFirst().orElse(null); if (matched == null) { return Result .unhealthy("Default Role Realm configured to use role %s which doesn't exist.", defaultRoleRealm.getRole()); } return Result.healthy("Default Role Realm configured to use role %s.", defaultRoleRealm.getRole()); } @Inject  DefaultRoleHealthCheck(
      final RealmManager realmManager,
      final DefaultRoleRealm defaultRoleRealm,
      final SecuritySystem securitySystem);   }