Skip to content

feat(activemq): add execArtemisCommand helper to ArtemisContainer#11859

Open
glasses-and-hat wants to merge 1 commit into
testcontainers:mainfrom
glasses-and-hat:feat/artemis-exec-cli-command
Open

feat(activemq): add execArtemisCommand helper to ArtemisContainer#11859
glasses-and-hat wants to merge 1 commit into
testcontainers:mainfrom
glasses-and-hat:feat/artemis-exec-cli-command

Conversation

@glasses-and-hat

@glasses-and-hat glasses-and-hat commented Jun 27, 2026

Copy link
Copy Markdown

Summary

Closes #11589

The ArtemisContainer bundles the Artemis CLI at /var/lib/artemis-instance/bin/artemis, but using it from tests requires boilerplate: hardcoding the binary path and manually appending --user / --password on every call. This PR adds a convenience method that hides those details:

var result = artemis.execArtemisCommand(
    "queue", "create", "--name=my-queue", "--auto-create-address", "--anycast", "--silent"
);
assertThat(result.getExitCode()).isEqualTo(0);

Changes:

  • ArtemisContainer.execArtemisCommand(String... commands) — prepends the CLI binary path and appends --user / --password from the container's configured credentials, then delegates to execInContainer.
  • New test ArtemisContainerTest#execArtemisCommand that creates an AMQP queue via the CLI and asserts a zero exit code.
  • Docs updated with a usage snippet for execArtemisCommand.

Test plan

  • ./gradlew :testcontainers-activemq:spotlessApply passes with no changes
  • ./gradlew :testcontainers-activemq:test — requires Docker; verified locally that the container starts and the queue creation command exits 0

Adds a convenience method that wraps the Artemis CLI binary inside the
container, automatically prepending the binary path and appending broker
credentials. Users no longer need to hardcode the binary path or pass
--user/--password manually when invoking management commands (e.g.
creating AMQP queues).

Closes testcontainers#11589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Ease the invocation of the Artemis CLI

1 participant