View Javadoc
1   package de.dlr.shepard.integrationtests;
2   
3   import java.util.List;
4   import lombok.EqualsAndHashCode;
5   import lombok.Getter;
6   import org.eclipse.microprofile.health.HealthCheckResponse;
7   import org.eclipse.microprofile.health.HealthCheckResponse.Status;
8   
9   @Getter
10  @EqualsAndHashCode
11  public class HealthzIO {
12  
13    private HealthCheckResponse.Status status;
14    private List<ServiceHealthCheckIO> checks;
15  
16    public HealthzIO(Status status, List<ServiceHealthCheckIO> checks) {
17      this.status = status;
18      this.checks = checks;
19    }
20  
21    /**
22     * Helper to create test cases
23     */
24    public static HealthzIO createInstanceWithCheckedServices(
25      HealthCheckResponse.Status status,
26      List<String> checkedServices
27    ) {
28      return new HealthzIO(
29        status,
30        checkedServices
31          .stream()
32          .map(checkedService ->
33            new ServiceHealthCheckIO(checkedService + " connection health check", HealthCheckResponse.Status.UP)
34          )
35          .toList()
36      );
37    }
38  }