ProbeGenerator { public static io.fabric8.kubernetes.api.model.Probe httpProbe(Probe probeConfig, String path, String port) { if (path == null || path.isEmpty() || port == null || port.isEmpty()) { throw new IllegalArgumentException(); } io.fabric8.kubernetes.api.model.Probe probe = defaultBuilder(probeConfig) .withNewHttpGet() .withNewPath(path) .withNewPort(port) .endHttpGet() .build(); return probe; } private  ProbeGenerator(); static ProbeBuilder defaultBuilder(Probe probeConfig); static io.fabric8.kubernetes.api.model.Probe httpProbe(Probe probeConfig, String path, String port); static io.fabric8.kubernetes.api.model.Probe execProbe(Probe probeConfig, List<String> command); static final io.strimzi.api.kafka.model.Probe DEFAULT_TLS_SIDECAR_PROBE; }
@Test public void testHttpProbe() { Probe probe = ProbeGenerator.httpProbe(DEFAULT_CONFIG, "path", "1001"); assertThat(probe, is(new ProbeBuilder() .withNewHttpGet() .withNewPath("path") .withNewPort("1001") .endHttpGet() .withInitialDelaySeconds(1) .withTimeoutSeconds(2) .withPeriodSeconds(3) .withSuccessThreshold(4) .withFailureThreshold(5) .build() )); }
@Test public void testHttpProbeMissingPathThrows() { assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.httpProbe(DEFAULT_CONFIG, null, "1001")); assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.httpProbe(DEFAULT_CONFIG, "", "1001")); }
@Test public void testHttpProbeMissingPortThrows() { assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.httpProbe(DEFAULT_CONFIG, "path", null)); assertThrows(IllegalArgumentException.class, () -> ProbeGenerator.httpProbe(DEFAULT_CONFIG, "path", "")); }