software.amazon.awscdk.integtests.alpha.IntegTestProps Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) Integration test properties.
*
* Example:
*
*
* IFunction lambdaFunction;
* App app;
* Stack stack = new Stack(app, "cdk-integ-lambda-bundling");
* IntegTest integ = IntegTest.Builder.create(app, "IntegTest")
* .testCases(List.of(stack))
* .build();
* IApiCall invoke = integ.assertions.invokeFunction(LambdaInvokeFunctionProps.builder()
* .functionName(lambdaFunction.getFunctionName())
* .build());
* invoke.expect(ExpectedResult.objectLike(Map.of(
* "Payload", "200")));
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-11T15:56:07.790Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.integtests.alpha.$Module.class, fqn = "@aws-cdk/integ-tests-alpha.IntegTestProps")
@software.amazon.jsii.Jsii.Proxy(IntegTestProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface IntegTestProps extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.cloud_assembly_schema.TestOptions {
/**
* (experimental) List of test cases that make up this test.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.List getTestCases();
/**
* (experimental) Specify a stack to use for assertions.
*
* Default: - a stack is created for you
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.Stack getAssertionStack() {
return null;
}
/**
* (experimental) Enable lookups for this test.
*
* If lookups are enabled
* then stackUpdateWorkflow
must be set to false.
* Lookups should only be enabled when you are explicitly testing
* lookups.
*
* Default: false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getEnableLookups() {
return null;
}
/**
* @return a {@link Builder} of {@link IntegTestProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link IntegTestProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List testCases;
software.amazon.awscdk.Stack assertionStack;
java.lang.Boolean enableLookups;
java.util.List allowDestroy;
software.amazon.awscdk.cloud_assembly_schema.CdkCommands cdkCommandOptions;
java.lang.Boolean diffAssets;
software.amazon.awscdk.cloud_assembly_schema.Hooks hooks;
java.util.List regions;
java.lang.Boolean stackUpdateWorkflow;
/**
* Sets the value of {@link IntegTestProps#getTestCases}
* @param testCases List of test cases that make up this test. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder testCases(java.util.List extends software.amazon.awscdk.Stack> testCases) {
this.testCases = (java.util.List)testCases;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getAssertionStack}
* @param assertionStack Specify a stack to use for assertions.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assertionStack(software.amazon.awscdk.Stack assertionStack) {
this.assertionStack = assertionStack;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getEnableLookups}
* @param enableLookups Enable lookups for this test.
* If lookups are enabled
* then stackUpdateWorkflow
must be set to false.
* Lookups should only be enabled when you are explicitly testing
* lookups.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableLookups(java.lang.Boolean enableLookups) {
this.enableLookups = enableLookups;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getAllowDestroy}
* @param allowDestroy List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test.
* This list should only include resources that for this specific
* integration test we are sure will not cause errors or an outage if
* destroyed. For example, maybe we know that a new resource will be created
* first before the old resource is destroyed which prevents any outage.
*
* e.g. ['AWS::IAM::Role']
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder allowDestroy(java.util.List allowDestroy) {
this.allowDestroy = allowDestroy;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getCdkCommandOptions}
* @param cdkCommandOptions Additional options to use for each CDK command.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cdkCommandOptions(software.amazon.awscdk.cloud_assembly_schema.CdkCommands cdkCommandOptions) {
this.cdkCommandOptions = cdkCommandOptions;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getDiffAssets}
* @param diffAssets Whether or not to include asset hashes in the diff Asset hashes can introduces a lot of unneccessary noise into tests, but there are some cases where asset hashes should be included.
* For example
* any tests involving custom resources or bundling
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder diffAssets(java.lang.Boolean diffAssets) {
this.diffAssets = diffAssets;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getHooks}
* @param hooks Additional commands to run at predefined points in the test workflow.
* e.g. { postDeploy: ['yarn', 'test'] }
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder hooks(software.amazon.awscdk.cloud_assembly_schema.Hooks hooks) {
this.hooks = hooks;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getRegions}
* @param regions Limit deployment to these regions.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder regions(java.util.List regions) {
this.regions = regions;
return this;
}
/**
* Sets the value of {@link IntegTestProps#getStackUpdateWorkflow}
* @param stackUpdateWorkflow Run update workflow on this test case This should only be set to false to test scenarios that are not possible to test as part of the update workflow.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder stackUpdateWorkflow(java.lang.Boolean stackUpdateWorkflow) {
this.stackUpdateWorkflow = stackUpdateWorkflow;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link IntegTestProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public IntegTestProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link IntegTestProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements IntegTestProps {
private final java.util.List testCases;
private final software.amazon.awscdk.Stack assertionStack;
private final java.lang.Boolean enableLookups;
private final java.util.List allowDestroy;
private final software.amazon.awscdk.cloud_assembly_schema.CdkCommands cdkCommandOptions;
private final java.lang.Boolean diffAssets;
private final software.amazon.awscdk.cloud_assembly_schema.Hooks hooks;
private final java.util.List regions;
private final java.lang.Boolean stackUpdateWorkflow;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.testCases = software.amazon.jsii.Kernel.get(this, "testCases", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Stack.class)));
this.assertionStack = software.amazon.jsii.Kernel.get(this, "assertionStack", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Stack.class));
this.enableLookups = software.amazon.jsii.Kernel.get(this, "enableLookups", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.allowDestroy = software.amazon.jsii.Kernel.get(this, "allowDestroy", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.cdkCommandOptions = software.amazon.jsii.Kernel.get(this, "cdkCommandOptions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.cloud_assembly_schema.CdkCommands.class));
this.diffAssets = software.amazon.jsii.Kernel.get(this, "diffAssets", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.hooks = software.amazon.jsii.Kernel.get(this, "hooks", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.cloud_assembly_schema.Hooks.class));
this.regions = software.amazon.jsii.Kernel.get(this, "regions", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.stackUpdateWorkflow = software.amazon.jsii.Kernel.get(this, "stackUpdateWorkflow", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.testCases = (java.util.List)java.util.Objects.requireNonNull(builder.testCases, "testCases is required");
this.assertionStack = builder.assertionStack;
this.enableLookups = builder.enableLookups;
this.allowDestroy = builder.allowDestroy;
this.cdkCommandOptions = builder.cdkCommandOptions;
this.diffAssets = builder.diffAssets;
this.hooks = builder.hooks;
this.regions = builder.regions;
this.stackUpdateWorkflow = builder.stackUpdateWorkflow;
}
@Override
public final java.util.List getTestCases() {
return this.testCases;
}
@Override
public final software.amazon.awscdk.Stack getAssertionStack() {
return this.assertionStack;
}
@Override
public final java.lang.Boolean getEnableLookups() {
return this.enableLookups;
}
@Override
public final java.util.List getAllowDestroy() {
return this.allowDestroy;
}
@Override
public final software.amazon.awscdk.cloud_assembly_schema.CdkCommands getCdkCommandOptions() {
return this.cdkCommandOptions;
}
@Override
public final java.lang.Boolean getDiffAssets() {
return this.diffAssets;
}
@Override
public final software.amazon.awscdk.cloud_assembly_schema.Hooks getHooks() {
return this.hooks;
}
@Override
public final java.util.List getRegions() {
return this.regions;
}
@Override
public final java.lang.Boolean getStackUpdateWorkflow() {
return this.stackUpdateWorkflow;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("testCases", om.valueToTree(this.getTestCases()));
if (this.getAssertionStack() != null) {
data.set("assertionStack", om.valueToTree(this.getAssertionStack()));
}
if (this.getEnableLookups() != null) {
data.set("enableLookups", om.valueToTree(this.getEnableLookups()));
}
if (this.getAllowDestroy() != null) {
data.set("allowDestroy", om.valueToTree(this.getAllowDestroy()));
}
if (this.getCdkCommandOptions() != null) {
data.set("cdkCommandOptions", om.valueToTree(this.getCdkCommandOptions()));
}
if (this.getDiffAssets() != null) {
data.set("diffAssets", om.valueToTree(this.getDiffAssets()));
}
if (this.getHooks() != null) {
data.set("hooks", om.valueToTree(this.getHooks()));
}
if (this.getRegions() != null) {
data.set("regions", om.valueToTree(this.getRegions()));
}
if (this.getStackUpdateWorkflow() != null) {
data.set("stackUpdateWorkflow", om.valueToTree(this.getStackUpdateWorkflow()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/integ-tests-alpha.IntegTestProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IntegTestProps.Jsii$Proxy that = (IntegTestProps.Jsii$Proxy) o;
if (!testCases.equals(that.testCases)) return false;
if (this.assertionStack != null ? !this.assertionStack.equals(that.assertionStack) : that.assertionStack != null) return false;
if (this.enableLookups != null ? !this.enableLookups.equals(that.enableLookups) : that.enableLookups != null) return false;
if (this.allowDestroy != null ? !this.allowDestroy.equals(that.allowDestroy) : that.allowDestroy != null) return false;
if (this.cdkCommandOptions != null ? !this.cdkCommandOptions.equals(that.cdkCommandOptions) : that.cdkCommandOptions != null) return false;
if (this.diffAssets != null ? !this.diffAssets.equals(that.diffAssets) : that.diffAssets != null) return false;
if (this.hooks != null ? !this.hooks.equals(that.hooks) : that.hooks != null) return false;
if (this.regions != null ? !this.regions.equals(that.regions) : that.regions != null) return false;
return this.stackUpdateWorkflow != null ? this.stackUpdateWorkflow.equals(that.stackUpdateWorkflow) : that.stackUpdateWorkflow == null;
}
@Override
public final int hashCode() {
int result = this.testCases.hashCode();
result = 31 * result + (this.assertionStack != null ? this.assertionStack.hashCode() : 0);
result = 31 * result + (this.enableLookups != null ? this.enableLookups.hashCode() : 0);
result = 31 * result + (this.allowDestroy != null ? this.allowDestroy.hashCode() : 0);
result = 31 * result + (this.cdkCommandOptions != null ? this.cdkCommandOptions.hashCode() : 0);
result = 31 * result + (this.diffAssets != null ? this.diffAssets.hashCode() : 0);
result = 31 * result + (this.hooks != null ? this.hooks.hashCode() : 0);
result = 31 * result + (this.regions != null ? this.regions.hashCode() : 0);
result = 31 * result + (this.stackUpdateWorkflow != null ? this.stackUpdateWorkflow.hashCode() : 0);
return result;
}
}
}