private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){ this.name = name; this.host = httpHealthCheckCreationOptions.host(); this.requestPath = httpHealthCheckCreationOptions.requestPath(); this.port = httpHealthCheckCreationOptions.port(); this.checkIntervalSec = httpHealthCheckCreationOptions.checkIntervalSec(); this.timeoutSec = httpHealthCheckCreationOptions.timeoutSec(); this.unhealthyThreshold = httpHealthCheckCreationOptions.unhealthyThreshold(); this.healthyThreshold = httpHealthCheckCreationOptions.healthyThreshold(); this.description = httpHealthCheckCreationOptions.description(); } }
/** * Useful when performing a PATCH operation and you do not want to overwrite * unspecified values with the default values. */ public HttpHealthCheckCreationOptions buildForPatch() { return HttpHealthCheckCreationOptions.create(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); } }
/** * Fields left as null will be replaced with their default before the request * is made. * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ public HttpHealthCheckCreationOptions buildWithDefaults() { return HttpHealthCheckCreationOptions.createWithDefaults(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); }
@Test(groups = "live", dependsOnMethods = "testInsertHttpHealthCheck") public void testGetHttpHealthCheck() { HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); assertEquals(httpHealthCheck.port(), options.port()); assertEquals(httpHealthCheck.checkIntervalSec(), options.checkIntervalSec()); assertEquals(httpHealthCheck.timeoutSec(), options.timeoutSec()); assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold()); assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold()); assertEquals(httpHealthCheck.description(), options.description()); }
@Test(groups = "live", dependsOnMethods = "testGetHttpHealthCheck") public void testPatchHttpHealthCheck() { HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions.Builder() .port(options.port() + OFFSET) .checkIntervalSec(options.checkIntervalSec() + OFFSET) .timeoutSec(options.timeoutSec() + OFFSET) .buildForPatch(); assertOperationDoneSuccessfully(api().patch(HTTP_HEALTH_CHECK_NAME, newOptions)); // Check changes happened and others unchanged. HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); assertEquals(httpHealthCheck.port(), newOptions.port()); assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec()); assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec()); assertEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold()); assertEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold()); assertEquals(httpHealthCheck.description(), options.description()); }
private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){ this.name = name; this.host = httpHealthCheckCreationOptions.host(); this.requestPath = httpHealthCheckCreationOptions.requestPath(); this.port = httpHealthCheckCreationOptions.port(); this.checkIntervalSec = httpHealthCheckCreationOptions.checkIntervalSec(); this.timeoutSec = httpHealthCheckCreationOptions.timeoutSec(); this.unhealthyThreshold = httpHealthCheckCreationOptions.unhealthyThreshold(); this.healthyThreshold = httpHealthCheckCreationOptions.healthyThreshold(); this.description = httpHealthCheckCreationOptions.description(); } }
@Test(groups = "live", dependsOnMethods = "testPatchHttpHealthCheck") public void testUpdateHttpHealthCheck() { HttpHealthCheckCreationOptions newOptions = new HttpHealthCheckCreationOptions.Builder() .checkIntervalSec(options.checkIntervalSec() - OFFSET) .timeoutSec(options.timeoutSec() - OFFSET) .buildWithDefaults(); assertOperationDoneSuccessfully(api().update(HTTP_HEALTH_CHECK_NAME, newOptions)); // Check changes happened. HttpHealthCheck httpHealthCheck = api().get(HTTP_HEALTH_CHECK_NAME); assertNotNull(httpHealthCheck); assertEquals(httpHealthCheck.name(), HTTP_HEALTH_CHECK_NAME); assertEquals(httpHealthCheck.checkIntervalSec(), newOptions.checkIntervalSec()); assertEquals(httpHealthCheck.timeoutSec(), newOptions.timeoutSec()); // Update overwrites unspecified parameters to their defaults. assertNotEquals(httpHealthCheck.healthyThreshold(), options.healthyThreshold()); assertNotEquals(httpHealthCheck.unhealthyThreshold(), options.unhealthyThreshold()); assertNotEquals(httpHealthCheck.description(), options.description()); }
/** * Useful when performing a PATCH operation and you do not want to overwrite * unspecified values with the default values. */ public HttpHealthCheckCreationOptions buildForPatch() { return HttpHealthCheckCreationOptions.create(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); } }
/** * Fields left as null will be replaced with their default before the request * is made. * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ public HttpHealthCheckCreationOptions buildWithDefaults() { return HttpHealthCheckCreationOptions.createWithDefaults(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); }
private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){ this.name = name; this.host = httpHealthCheckCreationOptions.host(); this.requestPath = httpHealthCheckCreationOptions.requestPath(); this.port = httpHealthCheckCreationOptions.port(); this.checkIntervalSec = httpHealthCheckCreationOptions.checkIntervalSec(); this.timeoutSec = httpHealthCheckCreationOptions.timeoutSec(); this.unhealthyThreshold = httpHealthCheckCreationOptions.unhealthyThreshold(); this.healthyThreshold = httpHealthCheckCreationOptions.healthyThreshold(); this.description = httpHealthCheckCreationOptions.description(); } }
/** * Useful when performing a PATCH operation and you do not want to overwrite * unspecified values with the default values. */ public HttpHealthCheckCreationOptions buildForPatch() { return HttpHealthCheckCreationOptions.create(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); } }
/** * Fields left as null will be replaced with their default before the request * is made. * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ public HttpHealthCheckCreationOptions buildWithDefaults() { return HttpHealthCheckCreationOptions.createWithDefaults(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); }
private HttpHealthCheckBinderHelper(String name, HttpHealthCheckCreationOptions httpHealthCheckCreationOptions){ this.name = name; this.host = httpHealthCheckCreationOptions.host(); this.requestPath = httpHealthCheckCreationOptions.requestPath(); this.port = httpHealthCheckCreationOptions.port(); this.checkIntervalSec = httpHealthCheckCreationOptions.checkIntervalSec(); this.timeoutSec = httpHealthCheckCreationOptions.timeoutSec(); this.unhealthyThreshold = httpHealthCheckCreationOptions.unhealthyThreshold(); this.healthyThreshold = httpHealthCheckCreationOptions.healthyThreshold(); this.description = httpHealthCheckCreationOptions.description(); } }
/** * Useful when performing a PATCH operation and you do not want to overwrite * unspecified values with the default values. */ public HttpHealthCheckCreationOptions buildForPatch() { return HttpHealthCheckCreationOptions.create(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); } }
/** * Fields left as null will be replaced with their default before the request * is made. * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ public HttpHealthCheckCreationOptions buildWithDefaults() { return HttpHealthCheckCreationOptions.createWithDefaults(host, requestPath, port, checkIntervalSec, timeoutSec, unhealthyThreshold, healthyThreshold, description); }
/** * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ static HttpHealthCheckCreationOptions createWithDefaults(String host, String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold, Integer healthyThreshold, String description) { return create(host, requestPath != null ? requestPath : DEFAULT_REQUEST_PATH, port != null ? port : DEFAULT_PORT, checkIntervalSec != null ? checkIntervalSec : DEFAULT_CHECK_INTERVAL_SEC, timeoutSec != null ? timeoutSec : DEFAULT_TIMEOUT_SEC, unhealthyThreshold != null ? unhealthyThreshold : DEFAULT_UNHEALTHY_THRESHOLD, healthyThreshold != null ? healthyThreshold : DEFAULT_HEALTHY_THRESHOLD, description); }
/** * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ static HttpHealthCheckCreationOptions createWithDefaults(String host, String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold, Integer healthyThreshold, String description) { return create(host, requestPath != null ? requestPath : DEFAULT_REQUEST_PATH, port != null ? port : DEFAULT_PORT, checkIntervalSec != null ? checkIntervalSec : DEFAULT_CHECK_INTERVAL_SEC, timeoutSec != null ? timeoutSec : DEFAULT_TIMEOUT_SEC, unhealthyThreshold != null ? unhealthyThreshold : DEFAULT_UNHEALTHY_THRESHOLD, healthyThreshold != null ? healthyThreshold : DEFAULT_HEALTHY_THRESHOLD, description); }
/** * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ static HttpHealthCheckCreationOptions createWithDefaults(String host, String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold, Integer healthyThreshold, String description) { return create(host, requestPath != null ? requestPath : DEFAULT_REQUEST_PATH, port != null ? port : DEFAULT_PORT, checkIntervalSec != null ? checkIntervalSec : DEFAULT_CHECK_INTERVAL_SEC, timeoutSec != null ? timeoutSec : DEFAULT_TIMEOUT_SEC, unhealthyThreshold != null ? unhealthyThreshold : DEFAULT_UNHEALTHY_THRESHOLD, healthyThreshold != null ? healthyThreshold : DEFAULT_HEALTHY_THRESHOLD, description); }
/** * @param requestPath Defaults to {@value #DEFAULT_REQUEST_PATH} when null. * @param port Defaults to {@value #DEFAULT_PORT} when null. * @param checkIntervalSec Defaults to {@value #DEFAULT_CHECK_INTERVAL_SEC} when null. * @param timeoutSec Defaults to {@value #DEFAULT_TIMEOUT_SEC} when null. * @param unhealthyThreshold Defaults to {@value #DEFAULT_UNHEALTHY_THRESHOLD} when null. * @param healthyThreshold Defaults to {@value #DEFAULT_HEALTHY_THRESHOLD} when null. */ static HttpHealthCheckCreationOptions createWithDefaults(String host, String requestPath, Integer port, Integer checkIntervalSec, Integer timeoutSec, Integer unhealthyThreshold, Integer healthyThreshold, String description) { return create(host, requestPath != null ? requestPath : DEFAULT_REQUEST_PATH, port != null ? port : DEFAULT_PORT, checkIntervalSec != null ? checkIntervalSec : DEFAULT_CHECK_INTERVAL_SEC, timeoutSec != null ? timeoutSec : DEFAULT_TIMEOUT_SEC, unhealthyThreshold != null ? unhealthyThreshold : DEFAULT_UNHEALTHY_THRESHOLD, healthyThreshold != null ? healthyThreshold : DEFAULT_HEALTHY_THRESHOLD, description); }