private boolean stale(StateChangeHandler handler, IntegrationDeployment integrationDeployment) { if (integrationDeployment == null || handler == null) { return true; } IntegrationDeploymentState desiredState = integrationDeployment.getTargetState(); return desiredState.equals(integrationDeployment.getCurrentState()); }
default IntegrationDeployment deleted() { final Integration integration = new Integration.Builder().createFrom(getSpec()).isDeleted(true).build(); return builder().spec(integration).build(); }
default IntegrationDeployment withCurrentState(IntegrationDeploymentState state) { return builder().currentState(state).build(); }
protected static Integration newIntegration(Step... steps) { for (int i = 0; i < steps.length; i++) { steps[i] = new Step.Builder().createFrom(steps[i]).build(); } return new Integration.Builder() .id("test-integration") .name("Test Integration") .description("This is a test integration!") .addFlow(new Flow.Builder() .steps(Arrays.asList(steps)) .build()) .build(); }
protected final Integration newIntegration() { return new Integration.Builder() .id("test-integration") .name("Test Integration") .description("This is a test integration!") .addFlow(new Flow.Builder().steps(createSteps()).build()) .build(); }
private static IntegrationDeployment deployment(final int version) { return new IntegrationDeployment.Builder().spec(new Integration.Builder().build()).version(version).build(); }
default IntegrationDeployment withTargetState(IntegrationDeploymentState state) { return builder().targetState(state).build(); }
/** * Copy the current immutable object by setting a value for the {@link IntegrationRuntime#getIntegration() integration} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for integration (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableIntegrationRuntime withIntegration(Integration value) { if (this.integration == value) return this; return validate(new ImmutableIntegrationRuntime(this, this.state, value, this.environment, this.id)); }
/** * Construct a new immutable {@code IntegrationEndpoint} instance. * @param protocol The value for the {@code protocol} attribute * @param host The value for the {@code host} attribute * @param contextPath The value for the {@code contextPath} attribute * @param id The value for the {@code id} attribute * @return An immutable IntegrationEndpoint instance */ public static IntegrationEndpoint of(Optional<String> protocol, Optional<String> host, Optional<String> contextPath, Optional<String> id) { return validate(new ImmutableIntegrationEndpoint(protocol, host, contextPath, id)); }
/** * Builds a new {@link IntegrationDeployment IntegrationDeployment}. * @return An immutable instance of IntegrationDeployment * @throws java.lang.IllegalStateException if any required attributes are missing */ public IntegrationDeployment build() { return ImmutableIntegrationDeployment.validate(new ImmutableIntegrationDeployment(this)); }
/** * Builds a new {@link IntegrationDeploymentOverview IntegrationDeploymentOverview}. * @return An immutable instance of IntegrationDeploymentOverview * @throws java.lang.IllegalStateException if any required attributes are missing */ public IntegrationDeploymentOverview build() { return ImmutableIntegrationDeploymentOverview.validate(new ImmutableIntegrationDeploymentOverview(this)); }
/** * Builds a new {@link Flow Flow}. * @return An immutable instance of Flow * @throws java.lang.IllegalStateException if any required attributes are missing */ public Flow build() { return ImmutableFlow.validate(new ImmutableFlow(this)); }
/** * Builds a new {@link IntegrationRuntime IntegrationRuntime}. * @return An immutable instance of IntegrationRuntime * @throws java.lang.IllegalStateException if any required attributes are missing */ public IntegrationRuntime build() { return ImmutableIntegrationRuntime.validate(new ImmutableIntegrationRuntime(null, state, integration, environment, id)); } }
/** * Builds a new {@link IntegrationOverview IntegrationOverview}. * @return An immutable instance of IntegrationOverview * @throws java.lang.IllegalStateException if any required attributes are missing */ public IntegrationOverview build() { return ImmutableIntegrationOverview.validate(new ImmutableIntegrationOverview(this)); }
/** * Builds a new {@link Integration Integration}. * @return An immutable instance of Integration * @throws java.lang.IllegalStateException if any required attributes are missing */ public Integration build() { return ImmutableIntegration.validate(new ImmutableIntegration(this)); }
/** * Builds a new {@link IntegrationEndpoint IntegrationEndpoint}. * @return An immutable instance of IntegrationEndpoint * @throws java.lang.IllegalStateException if any required attributes are missing */ public IntegrationEndpoint build() { return ImmutableIntegrationEndpoint.validate(new ImmutableIntegrationEndpoint(null, protocol, host, contextPath, id)); } }
private static Integration newIntegration(List<Step> steps) { return new Integration.Builder() .id("test") .name("test") .addFlow(new Flow.Builder().steps(steps).build()) .build(); } }
/** * Copy the current immutable object by setting a value for the {@link IntegrationRuntime#getEnvironment() environment} attribute. * A shallow reference equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for environment (can be {@code null}) * @return A modified copy of the {@code this} object */ public final ImmutableIntegrationRuntime withEnvironment(Environment value) { if (this.environment == value) return this; return validate(new ImmutableIntegrationRuntime(this, this.state, this.integration, value, this.id)); }
/** * Construct a new immutable {@code IntegrationRuntime} instance. * @param state The value for the {@code state} attribute * @param integration The value for the {@code integration} attribute * @param environment The value for the {@code environment} attribute * @param id The value for the {@code id} attribute * @return An immutable IntegrationRuntime instance */ public static IntegrationRuntime of(String state, Integration integration, Environment environment, Optional<String> id) { return validate(new ImmutableIntegrationRuntime(state, integration, environment, id)); }