Provision application parameters before tests, load JSON fixtures, and inspect or delete development parameters. Task types live in io.github.gregwhitaker.awsemulator.aws.ssm.
Provision Before Tests
Kotlin DSL
import io.github.gregwhitaker.awsemulator.aws.ssm.PutSsmParametersTask
plugins {
java
id("io.github.gregwhitaker.aws-emulator") version "0.3.0"
}
val parameters = tasks.register<PutSsmParametersTask>("seedParameters") {
fixtures.set(layout.projectDirectory.file("fixtures/parameters.json"))
}
val tests = tasks.named<Test>("test") { dependsOn(parameters) }
awsEmulator { useWith(tests) }
Groovy DSL
import io.github.gregwhitaker.awsemulator.aws.ssm.PutSsmParametersTask
plugins {
id 'java'
id 'io.github.gregwhitaker.aws-emulator' version '0.3.0'
}
def parameters = tasks.register('seedParameters', PutSsmParametersTask) {
fixtures.set(layout.projectDirectory.file('fixtures/parameters.json'))
}
def tests = tasks.named('test') { dependsOn(parameters) }
awsEmulator { useWith(tests) }
Task Properties
| Task type | Configuration |
|---|---|
|
|
|
|
|
Lists parameter names, without values |
|
Explicit |
Fixture Format
[
{"name":"/app/url","value":"http://localhost:8080"},
{"name":"/app/features","value":"catalog,checkout","type":"StringList"},
{"name":"/app/token","value":"local-token","type":"SecureString"}
]
Every entry requires string name and value. type accepts String, StringList, or SecureString and defaults to String. An optional keyId requires SecureString; declare a dependency on CreateKmsKeyTask when referring to a custom key alias. Parameters use the Standard tier, with a 4096-byte value limit. Parameter policies are outside these task types.
Fixtures must be nonempty JSON arrays no larger than 16 MiB. Unknown fields, duplicate JSON keys, duplicate resource names, malformed JSON, and invalid entries fail before starting Docker. All entries are validated before provisioning; service calls then run sequentially. A service failure reports the failing name and number of completed entries. Earlier changes remain in a development instance. No automatic rollback is attempted.
Reuse And Overwrite Behavior
Identical values are reused without creating new versions. Different values require overwrite=true. Changing a parameter’s type requires explicit deletion and recreation. Explicit key identifiers are compared with the identifier reported by the service; consistently use the same key ID or alias. Metadata commands and provisioning errors omit values; applications read values through their SDKs.
Development Commands
./gradlew listSsmParameters
./gradlew deleteSsmParameters --names=/app/url --names=/app/features
Select names for deletion with repeated --names options. Stopping a managed emulator discards its entire in-memory state.
Runtime Selection
Custom resource tasks inherit awsEmulator.defaultMode, initially MANAGED. Make the consuming test or application task depend on provisioning and opt that consumer in with awsEmulator.useWith(…). Provisioning and consumers must select the same runtime name and mode; see resource task defaults to configure a shared development default.
Every task accepts runtimeName (default default), mode, and apiCallTimeoutSeconds (default 30, positive). Predefined inspection and deletion commands default to DEVELOPMENT; select another mode with --mode=MANAGED or another declared runtime with --runtime <name>. For persistent setup, see development resource tasks.
Resource tasks always execute against live emulator state and do not use the build cache. Configuration-cache reuse is supported. Applying the plugin and listing tasks do not start Docker. Task input values may be stored in Gradle’s configuration cache; fixtures should contain local test values.
Runnable Example
./gradlew -p examples/services verifyServices --configuration-cache
The example seeds string, string-list, and encrypted parameters from JSON and reads them using AWS SDK for Java v2. Run the command twice to check configuration-cache reuse against a fresh managed emulator. -PfailExample=true deliberately fails the application test to demonstrate cleanup. See the runnable example for its complete setup and persistent development commands.
Verified Scope
The examples exercise these workflows against the pinned AWS Emulator 1.0.385, using AWS SDK for Java v2 2.39.6. They establish the behavior used by these tasks, not complete AWS service equivalence. AWS Emulator fidelity varies by operation and release.