software.amazon.awscdk.integtests.alpha.IntegTestCase Maven / Gradle / Ivy
Show all versions of cdk-integ-tests-alpha Show documentation
package software.amazon.awscdk.integtests.alpha;
/**
* (experimental) An integration test case. Allows the definition of test properties that apply to all stacks under this case.
*
* It is recommended that you use the IntegTest construct since that will create
* a default IntegTestCase
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.integtests.alpha.*;
* import software.amazon.awscdk.*;
* import software.amazon.awscdk.cloud_assembly_schema.*;
* Stack stack;
* IntegTestCase integTestCase = IntegTestCase.Builder.create(this, "MyIntegTestCase")
* .stacks(List.of(stack))
* // the properties below are optional
* .allowDestroy(List.of("allowDestroy"))
* .assertionStack(stack)
* .cdkCommandOptions(CdkCommands.builder()
* .deploy(DeployCommand.builder()
* .args(DeployOptions.builder()
* .all(false)
* .app("app")
* .assetMetadata(false)
* .caBundlePath("caBundlePath")
* .changeSetName("changeSetName")
* .ci(false)
* .color(false)
* .concurrency(123)
* .context(Map.of(
* "contextKey", "context"))
* .debug(false)
* .ec2Creds(false)
* .exclusively(false)
* .execute(false)
* .force(false)
* .ignoreErrors(false)
* .json(false)
* .lookups(false)
* .notices(false)
* .notificationArns(List.of("notificationArns"))
* .output("output")
* .outputsFile("outputsFile")
* .parameters(Map.of(
* "parametersKey", "parameters"))
* .pathMetadata(false)
* .profile("profile")
* .proxy("proxy")
* .requireApproval(RequireApproval.NEVER)
* .reuseAssets(List.of("reuseAssets"))
* .roleArn("roleArn")
* .rollback(false)
* .stacks(List.of("stacks"))
* .staging(false)
* .strict(false)
* .toolkitStackName("toolkitStackName")
* .trace(false)
* .usePreviousParameters(false)
* .verbose(false)
* .versionReporting(false)
* .build())
* .enabled(false)
* .expectedMessage("expectedMessage")
* .expectError(false)
* .build())
* .destroy(DestroyCommand.builder()
* .args(DestroyOptions.builder()
* .all(false)
* .app("app")
* .assetMetadata(false)
* .caBundlePath("caBundlePath")
* .color(false)
* .context(Map.of(
* "contextKey", "context"))
* .debug(false)
* .ec2Creds(false)
* .exclusively(false)
* .force(false)
* .ignoreErrors(false)
* .json(false)
* .lookups(false)
* .notices(false)
* .output("output")
* .pathMetadata(false)
* .profile("profile")
* .proxy("proxy")
* .roleArn("roleArn")
* .stacks(List.of("stacks"))
* .staging(false)
* .strict(false)
* .trace(false)
* .verbose(false)
* .versionReporting(false)
* .build())
* .enabled(false)
* .expectedMessage("expectedMessage")
* .expectError(false)
* .build())
* .build())
* .diffAssets(false)
* .hooks(Hooks.builder()
* .postDeploy(List.of("postDeploy"))
* .postDestroy(List.of("postDestroy"))
* .preDeploy(List.of("preDeploy"))
* .preDestroy(List.of("preDestroy"))
* .build())
* .regions(List.of("regions"))
* .stackUpdateWorkflow(false)
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-24T10:56:41.796Z")
@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.IntegTestCase")
public class IntegTestCase extends software.constructs.Construct {
protected IntegTestCase(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected IntegTestCase(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 IntegTestCase(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.IntegTestCaseProps 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) The integration test manifest for this test case.
*
* Manifests are used
* by the integration test runner.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.cloud_assembly_schema.IntegManifest getManifest() {
return software.amazon.jsii.Kernel.get(this, "manifest", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.cloud_assembly_schema.IntegManifest.class));
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.integtests.alpha.IntegTestCase}.
*/
@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.IntegTestCaseProps.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.IntegTestCaseProps.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) Stacks to be deployed during the test.
*
* @return {@code this}
* @param stacks Stacks to be deployed during the test. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder stacks(final java.util.List extends software.amazon.awscdk.Stack> stacks) {
this.props.stacks(stacks);
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;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.integtests.alpha.IntegTestCase}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.integtests.alpha.IntegTestCase build() {
return new software.amazon.awscdk.integtests.alpha.IntegTestCase(
this.scope,
this.id,
this.props.build()
);
}
}
}