+ * Protected to allow for changing implementation by extending the class + * + * @param pathNameInContainer path in docker + * @param resourceLocation relative classpath to resource + */ + protected void optionallyCopyResourceToContainer(String pathNameInContainer, String resourceLocation) { + Optional.ofNullable(resourceLocation) + .map(MountableFile::forClasspathResource) + .ifPresent(mountableFile -> withCopyFileToContainer(mountableFile, pathNameInContainer)); + } + + /** + * Set an environment value if the value is present. + *
+ * Protected to allow for changing implementation by extending the class
+ *
+ * @param key environment key value, usually a constant
+ * @param value environment value to be set
+ */
+ protected void withOptionalEnv(String key, String value) {
+ Optional.ofNullable(value)
+ .ifPresent(v -> withEnv(key, value));
+ }
+
+ /**
+ * Initialize AxonServer EE with a given license.
+ */
+ public SELF withLicense(String licensePath) {
+ this.licensePath = licensePath;
+ return self();
+ }
+
+ /**
+ * Initialize AxonServer EE with a given configuration file.
+ */
+ public SELF withConfiguration(String configurationPath) {
+ this.configurationPath = configurationPath;
+ return self();
+ }
+
+ /**
+ * Initialize AxonServer EE with a given cluster template configuration file.
+ */
+ public SELF withClusterTemplate(String clusterTemplatePath) {
+ this.clusterTemplatePath = clusterTemplatePath;
+ return self();
+ }
+
+ /**
+ * Initialize AxonServer EE with a given Axon Server Name.
+ */
+ public SELF withAxonServerName(String axonServerName) {
+ this.axonServerName = axonServerName;
+ return self();
+ }
+
+ /**
+ * Initialize AxonServer EE with a given Axon Server Internal Hostname.
+ */
+ public SELF withAxonServerInternalHostname(String axonServerInternalHostname) {
+ this.axonServerInternalHostname = axonServerInternalHostname;
+ return self();
+ }
+
+ /**
+ * Initialize AxonServer EE with a given Axon Server Hostname.
+ */
+ public SELF withAxonServerHostname(String axonServerHostname) {
+ this.axonServerHostname = axonServerHostname;
+ return self();
+ }
+
+ public Integer getGrpcPort() {
+ return this.getMappedPort(AXON_SERVER_GRPC_PORT);
+ }
+
+ public String getIPAddress() {
+ return this.getContainerIpAddress();
+ }
+
+ public String getAxonServerAddress() {
+ return String.format(AXON_SERVER_ADDRESS_TEMPLATE,
+ this.getContainerIpAddress(),
+ this.getMappedPort(AXON_SERVER_GRPC_PORT));
+ }
+}
diff --git a/modules/axonserver/src/main/java/org/testcontainers/containers/AxonServerSEContainer.java b/modules/axonserver/src/main/java/org/testcontainers/containers/AxonServerSEContainer.java
new file mode 100644
index 00000000000..6313bfa6866
--- /dev/null
+++ b/modules/axonserver/src/main/java/org/testcontainers/containers/AxonServerSEContainer.java
@@ -0,0 +1,65 @@
+package org.testcontainers.containers;
+
+import lombok.NonNull;
+import lombok.extern.slf4j.Slf4j;
+import org.testcontainers.containers.wait.strategy.Wait;
+import org.testcontainers.utility.DockerImageName;
+
+/**
+ * Constructs a single node AxonServer Standard Edition (SE) for testing.
+ */
+@Slf4j
+public class AxonServerSEContainer