software.amazon.awscdk.integtests.alpha.IntegTest Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) A collection of test cases.
*
* Each test case file should contain exactly one
* instance of this class.
*
* 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-09-11T18:01:25.341Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.integtests.alpha.$Module.class, fqn = "@aws-cdk/integ-tests-alpha.IntegTest")
public class IntegTest extends software.constructs.Construct {
protected IntegTest(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected IntegTest(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public IntegTest(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.integtests.alpha.IntegTestProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) Make assertions on resources in this test case.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.integtests.alpha.IDeployAssert getAssertions() {
return software.amazon.jsii.Kernel.get(this, "assertions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.integtests.alpha.IDeployAssert.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.integtests.alpha.IntegTest}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private final software.amazon.awscdk.integtests.alpha.IntegTestProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new software.amazon.awscdk.integtests.alpha.IntegTestProps.Builder();
}
/**
* 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']
*
* Default: - do not allow destruction of any resources on update
*
* @return {@code this}
* @param allowDestroy List of CloudFormation resource types in this stack that can be destroyed as part of an update without failing the test. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder allowDestroy(final java.util.List allowDestroy) {
this.props.allowDestroy(allowDestroy);
return this;
}
/**
* Additional options to use for each CDK command.
*
* Default: - runner default options
*
* @return {@code this}
* @param cdkCommandOptions Additional options to use for each CDK command. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder cdkCommandOptions(final software.amazon.awscdk.cloud_assembly_schema.CdkCommands cdkCommandOptions) {
this.props.cdkCommandOptions(cdkCommandOptions);
return this;
}
/**
* 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
*
* Default: false
*
* @return {@code this}
* @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. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder diffAssets(final java.lang.Boolean diffAssets) {
this.props.diffAssets(diffAssets);
return this;
}
/**
* Additional commands to run at predefined points in the test workflow.
*
* e.g. { postDeploy: ['yarn', 'test'] }
*
* Default: - no hooks
*
* @return {@code this}
* @param hooks Additional commands to run at predefined points in the test workflow. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder hooks(final software.amazon.awscdk.cloud_assembly_schema.Hooks hooks) {
this.props.hooks(hooks);
return this;
}
/**
* Limit deployment to these regions.
*
* Default: - can run in any region
*
* @return {@code this}
* @param regions Limit deployment to these regions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder regions(final java.util.List regions) {
this.props.regions(regions);
return this;
}
/**
* 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.
*
* Default: true
*
* @return {@code this}
* @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. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder stackUpdateWorkflow(final java.lang.Boolean stackUpdateWorkflow) {
this.props.stackUpdateWorkflow(stackUpdateWorkflow);
return this;
}
/**
* (experimental) List of test cases that make up this test.
*
* @return {@code this}
* @param testCases List of test cases that make up this test. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder testCases(final java.util.List extends software.amazon.awscdk.Stack> testCases) {
this.props.testCases(testCases);
return this;
}
/**
* (experimental) Specify a stack to use for assertions.
*
* Default: - a stack is created for you
*
* @return {@code this}
* @param assertionStack Specify a stack to use for assertions. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assertionStack(final software.amazon.awscdk.Stack assertionStack) {
this.props.assertionStack(assertionStack);
return this;
}
/**
* (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
*
* @return {@code this}
* @param enableLookups Enable lookups for this test. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder enableLookups(final java.lang.Boolean enableLookups) {
this.props.enableLookups(enableLookups);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.integtests.alpha.IntegTest}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.integtests.alpha.IntegTest build() {
return new software.amazon.awscdk.integtests.alpha.IntegTest(
this.scope,
this.id,
this.props.build()
);
}
}
}