diff --git a/docs/modules/ROOT/pages/firestore.adoc b/docs/modules/ROOT/pages/firestore.adoc index d29168c5..bdebc25b 100644 --- a/docs/modules/ROOT/pages/firestore.adoc +++ b/docs/modules/ROOT/pages/firestore.adoc @@ -6,7 +6,8 @@ Be sure to have read the https://quarkiverse.github.io/quarkiverse-docs/quarkus- == Bootstrapping the project -First, we need a new project. Create a new project with the following command (replace the version placeholder with the correct one): +First, we need a new project. +Create a new project with the following command (replace the version placeholder with the correct one): [source,shell script] ---- @@ -38,8 +39,7 @@ This will add the following to your pom.xml: == Some example -This is an example usage of the extension: we create a REST resource with a single endpoint that creates a 'persons' collection, -inserts three persons in it, then search for persons with last name Doe and returns them. +This is an example usage of the extension: we create a REST resource with a single endpoint that creates a 'persons' collection, inserts three persons in it, then search for persons with last name Doe and returns them. [source,java] ---- @@ -92,3 +92,21 @@ public class FirestoreResource { NOTE: Here we let Firestore serialize the `Person` object, Firestore will use reflection for this. So if you deploy your application as a GraalVM native image you will need to register the `Person` class for reflection. This can be done by annotating it with `@RegisterForReflection`. + +== Dev Service + +=== Configuring the Dev Service + +The extension provides a Dev Service that can be used to run a local Firestore emulator. +This is useful for testing purposes, so you don't have to rely on a real Firestore instance. +By default, the Dev Service is disabled, but you can enable it by setting the + +* `quarkus.google.cloud.firestore.devservice.enabled` property to `true` + +You can also set the + +* `quarkus.google.cloud.firestore.devservice.port` property to change the port on which the emulator will be started (by default there is no port set, so the emulator will use a random port) + +=== Using the Dev Service + +Once the Dev Service is enabled, the Firestore client which you can `@Inject` in your application will be configured to use the emulator. diff --git a/firestore/deployment/pom.xml b/firestore/deployment/pom.xml index e45f5785..4fa1ef0f 100644 --- a/firestore/deployment/pom.xml +++ b/firestore/deployment/pom.xml @@ -28,6 +28,10 @@ io.quarkiverse.googlecloudservices quarkus-google-cloud-firestore + + org.testcontainers + gcloud + @@ -47,4 +51,4 @@ - \ No newline at end of file + diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildSteps.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildSteps.java index 12306aa0..15f3871c 100644 --- a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildSteps.java +++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildSteps.java @@ -6,7 +6,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; public class FirestoreBuildSteps { - private static final String FEATURE = "google-cloud-firestore"; + protected static final String FEATURE = "google-cloud-firestore"; @BuildStep public FeatureBuildItem feature() { diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java new file mode 100644 index 00000000..02f05208 --- /dev/null +++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreBuildTimeConfig.java @@ -0,0 +1,22 @@ +package io.quarkiverse.googlecloudservices.firestore.deployment; + +import io.quarkus.runtime.annotations.ConfigItem; +import io.quarkus.runtime.annotations.ConfigPhase; +import io.quarkus.runtime.annotations.ConfigRoot; + +/** + * Root configuration class for Firestore that operates at build time. + * This class provides a nested structure for configuration, including + * a separate group for the development service configuration. + */ +@ConfigRoot(name = "google.cloud.firestore", phase = ConfigPhase.BUILD_TIME) +public class FirestoreBuildTimeConfig { + + /** + * Configuration for the Firestore dev service. + * These settings will be used when Firestore service is being configured + * for development purposes. + */ + @ConfigItem + public FirestoreDevServiceConfig devservice; +} diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java new file mode 100644 index 00000000..5e6739bd --- /dev/null +++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceConfig.java @@ -0,0 +1,44 @@ +package io.quarkiverse.googlecloudservices.firestore.deployment; + +import java.util.Optional; + +import io.quarkus.runtime.annotations.ConfigGroup; +import io.quarkus.runtime.annotations.ConfigItem; + +/** + * Configuration group for the Firestore dev service. This class holds all the configuration properties + * related to the Google Cloud Firestore service for development environments. + *

+ * Here is an example of how to configure these properties: + *

+ * + *

+ * quarkus.firestore-dev-service.enabled = true
+ * quarkus.firestore-dev-service.image-name = gcr.io/google.com/cloudsdktool/google-cloud-cli # optional
+ * quarkus.firestore-dev-service.emulatorPort = 8080 # optional
+ * 
+ */ +@ConfigGroup +public class FirestoreDevServiceConfig { + + /** + * Indicates whether the Firestore service should be enabled or not. + * The default value is 'false'. + */ + @ConfigItem(defaultValue = "false") + public boolean enabled; + + /** + * Sets the Docker image name for the Google Cloud SDK. + * This image is used to emulate the Firestore service in the development environment. + * The default value is 'gcr.io/google.com/cloudsdktool/google-cloud-cli'. + */ + @ConfigItem(defaultValue = "gcr.io/google.com/cloudsdktool/google-cloud-cli") + public String imageName; + + /** + * Specifies the emulatorPort on which the Firestore service should run in the development environment. + */ + @ConfigItem + public Optional emulatorPort = Optional.empty(); +} diff --git a/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java new file mode 100644 index 00000000..9d0eb23c --- /dev/null +++ b/firestore/deployment/src/main/java/io/quarkiverse/googlecloudservices/firestore/deployment/FirestoreDevServiceProcessor.java @@ -0,0 +1,172 @@ +package io.quarkiverse.googlecloudservices.firestore.deployment; + +import java.time.Duration; +import java.util.List; +import java.util.Optional; + +import org.jboss.logging.Logger; +import org.testcontainers.containers.FirestoreEmulatorContainer; +import org.testcontainers.utility.DockerImageName; + +import io.quarkus.deployment.IsNormal; +import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.BuildSteps; +import io.quarkus.deployment.builditem.*; +import io.quarkus.deployment.console.ConsoleInstalledBuildItem; +import io.quarkus.deployment.console.StartupLogCompressor; +import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig; +import io.quarkus.deployment.logging.LoggingSetupBuildItem; + +/** + * Processor responsible for managing Firestore Dev Services. + *

+ * The processor starts the Firestore service in case it's not running. + */ +@BuildSteps(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class) +public class FirestoreDevServiceProcessor { + + private static final Logger LOGGER = Logger.getLogger(FirestoreDevServiceProcessor.class.getName()); + + // Running dev service instance + private static volatile DevServicesResultBuildItem.RunningDevService devService; + // Configuration for the Firestore Dev service + private static volatile FirestoreDevServiceConfig config; + + @BuildStep + public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildItem, + FirestoreBuildTimeConfig buildTimeConfig, + List devServicesSharedNetworkBuildItem, + Optional consoleInstalledBuildItem, + CuratedApplicationShutdownBuildItem closeBuildItem, + LaunchModeBuildItem launchMode, + LoggingSetupBuildItem loggingSetupBuildItem, + GlobalDevServicesConfig globalDevServicesConfig) { + // If dev service is running and config has changed, stop the service + if (devService != null && !buildTimeConfig.devservice.equals(config)) { + stopContainer(); + } else if (devService != null) { + return devService.toBuildItem(); + } + + // Set up log compressor for startup logs + StartupLogCompressor compressor = new StartupLogCompressor( + (launchMode.isTest() ? "(test) " : "") + "Google Cloud Firestore Dev Services Starting:", + consoleInstalledBuildItem, + loggingSetupBuildItem); + + // Try starting the container if conditions are met + try { + devService = startContainerIfAvailable(dockerStatusBuildItem, buildTimeConfig.devservice, + globalDevServicesConfig.timeout); + } catch (Throwable t) { + LOGGER.warn("Unable to start Firestore dev service", t); + // Dump captured logs in case of an error + compressor.closeAndDumpCaptured(); + return null; + } finally { + compressor.close(); + } + + return devService == null ? null : devService.toBuildItem(); + } + + /** + * Start the container if conditions are met. + * + * @param dockerStatusBuildItem, Docker status + * @param config, Configuration for the Firestore service + * @param timeout, Optional timeout for starting the service + * @return Running service item, or null if the service couldn't be started + */ + private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(DockerStatusBuildItem dockerStatusBuildItem, + FirestoreDevServiceConfig config, + Optional timeout) { + if (!config.enabled) { + // Firestore service explicitly disabled + LOGGER.debug("Not starting Dev Services for Firestore as it has been disabled in the config"); + return null; + } + + if (!dockerStatusBuildItem.isDockerAvailable()) { + LOGGER.warn("Not starting devservice because docker is not available"); + return null; + } + + return startContainer(dockerStatusBuildItem, config, timeout); + } + + /** + * Starts the Firestore emulator container with provided configuration. + * + * @param dockerStatusBuildItem, Docker status + * @param config, Configuration for the Firestore service + * @param timeout, Optional timeout for starting the service + * @return Running service item, or null if the service couldn't be started + */ + private DevServicesResultBuildItem.RunningDevService startContainer(DockerStatusBuildItem dockerStatusBuildItem, + FirestoreDevServiceConfig config, + Optional timeout) { + // Create and configure Firestore emulator container + FirestoreEmulatorContainer emulatorContainer = new QuarkusFirestoreContainer( + DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"), + config.emulatorPort.orElse(null)); + + // Set container startup timeout if provided + timeout.ifPresent(emulatorContainer::withStartupTimeout); + emulatorContainer.start(); + + // Set the config for the started container + FirestoreDevServiceProcessor.config = config; + + // Return running service item with container details + return new DevServicesResultBuildItem.RunningDevService(FirestoreBuildSteps.FEATURE, + emulatorContainer.getContainerId(), + emulatorContainer::close, "quarkus.google.cloud.firestore.host-override", + emulatorContainer.getEmulatorEndpoint()); + } + + /** + * Stops the running Firestore emulator container. + */ + private void stopContainer() { + if (devService != null && devService.isOwner()) { + try { + // Try closing the running dev service + devService.close(); + } catch (Throwable e) { + LOGGER.error("Failed to stop firestore container", e); + } finally { + devService = null; + } + } + } + + /** + * Class for creating and configuring a Firestore emulator container. + */ + private static class QuarkusFirestoreContainer extends FirestoreEmulatorContainer { + + private final Integer fixedExposedPort; + private static final int INTERNAL_PORT = 8080; + + private QuarkusFirestoreContainer(DockerImageName dockerImageName, Integer fixedExposedPort) { + super(dockerImageName); + this.fixedExposedPort = fixedExposedPort; + } + + /** + * Configures the Firestore emulator container. + */ + @Override + public void configure() { + super.configure(); + + // Expose Firestore emulatorPort + if (fixedExposedPort != null) { + addFixedExposedPort(fixedExposedPort, INTERNAL_PORT); + } else { + addExposedPort(INTERNAL_PORT); + } + } + } +} diff --git a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java index 72e70ac2..d99c5ad9 100644 --- a/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java +++ b/firestore/runtime/src/main/java/io/quarkiverse/googlecloudservices/firestore/runtime/FirestoreProducer.java @@ -1,23 +1,20 @@ package io.quarkiverse.googlecloudservices.firestore.runtime; -import java.io.IOException; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Default; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; -import jakarta.inject.Singleton; - -import org.threeten.bp.Duration; - import com.google.api.gax.retrying.RetrySettings; import com.google.auth.oauth2.GoogleCredentials; import com.google.cloud.firestore.Firestore; import com.google.cloud.firestore.FirestoreOptions; - import io.quarkiverse.googlecloudservices.common.GcpBootstrapConfiguration; import io.quarkiverse.googlecloudservices.common.GcpConfigHolder; import io.quarkiverse.googlecloudservices.firestore.runtime.FirestoreConfiguration.RetryConfiguration; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Default; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; +import org.threeten.bp.Duration; + +import java.io.IOException; @ApplicationScoped public class FirestoreProducer { diff --git a/integration-tests/main/src/main/resources/application.properties b/integration-tests/main/src/main/resources/application.properties index 5cd5e432..c541c9aa 100644 --- a/integration-tests/main/src/main/resources/application.properties +++ b/integration-tests/main/src/main/resources/application.properties @@ -5,7 +5,6 @@ # We use a dummy test project id in test for the emulators to work %test.quarkus.google.cloud.project-id=test-project %test.quarkus.google.cloud.storage.host-override=http://localhost:8089 -%test.quarkus.google.cloud.firestore.host-override=localhost:8080 %test.quarkus.google.cloud.spanner.emulator-host=http://localhost:9010 # Disable authentication for Bigtable on tests @@ -14,6 +13,7 @@ # Use pubsub emulator %test.pubsub.use-emulator=true %test.quarkus.google.cloud.pubsub.devservice.enabled=true +%test.quarkus.google.cloud.firestore.devservice.enabled=true # Secret Manager Demo # You can load secrets from Google Cloud Secret Manager with the ${sm//} syntax. diff --git a/integration-tests/main/src/test/java/io/quarkiverse/googlecloudservices/it/FirestoreResourceTest.java b/integration-tests/main/src/test/java/io/quarkiverse/googlecloudservices/it/FirestoreResourceTest.java index 78285bed..8ab087d9 100644 --- a/integration-tests/main/src/test/java/io/quarkiverse/googlecloudservices/it/FirestoreResourceTest.java +++ b/integration-tests/main/src/test/java/io/quarkiverse/googlecloudservices/it/FirestoreResourceTest.java @@ -2,34 +2,12 @@ import static io.restassured.RestAssured.given; -import java.util.ArrayList; -import java.util.List; - -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.testcontainers.containers.FirestoreEmulatorContainer; -import org.testcontainers.utility.DockerImageName; import io.quarkus.test.junit.QuarkusTest; @QuarkusTest public class FirestoreResourceTest { - private static final FirestoreEmulatorContainer EMULATOR = new FirestoreEmulatorContainer( - DockerImageName.parse("gcr.io/google.com/cloudsdktool/cloud-sdk")); - - @BeforeAll - public static void startGcloudContainer() { - List portBindings = new ArrayList<>(); - portBindings.add("8080:8080"); - EMULATOR.setPortBindings(portBindings); - EMULATOR.start(); - } - - @AfterAll - public static void stopGcloudContainer() { - EMULATOR.stop(); - } @Test public void testFirestore() { diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildSteps.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildSteps.java index 7278597b..03c8bdc0 100644 --- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildSteps.java +++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildSteps.java @@ -4,7 +4,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; public class PubSubBuildSteps { - public static final String FEATURE = "google-cloud-pubsub"; + protected static final String FEATURE = "google-cloud-pubsub"; @BuildStep public FeatureBuildItem feature() { diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java index 4471f195..c04d5176 100644 --- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java +++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubBuildTimeConfig.java @@ -13,7 +13,7 @@ public class PubSubBuildTimeConfig { /** - * Configuration for the Pub/Sub development service. + * Configuration for the Pub/Sub dev service. * These settings will be used when Pub/Sub service is being configured * for development purposes. */ diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java index 30c481a7..f18b5cb3 100644 --- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java +++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceConfig.java @@ -6,7 +6,7 @@ import io.quarkus.runtime.annotations.ConfigItem; /** - * Configuration group for the PubSubDevService. This class holds all the configuration properties + * Configuration group for the Pub/Sub. This class holds all the configuration properties * related to the Google Cloud Pub/Sub service for development environments. *

* Here is an example of how to configure these properties: @@ -39,6 +39,6 @@ public class PubSubDevServiceConfig { /** * Specifies the emulatorPort on which the Pub/Sub service should run in the development environment. */ - @ConfigItem(name = "emulatorPort") - public Optional port = Optional.empty(); + @ConfigItem + public Optional emulatorPort = Optional.empty(); } diff --git a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java index 028e035a..62c99868 100644 --- a/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java +++ b/pubsub/deployment/src/main/java/io/quarkiverse/googlecloudservices/pubsub/deployment/PubSubDevServiceProcessor.java @@ -18,9 +18,9 @@ import io.quarkus.deployment.logging.LoggingSetupBuildItem; /** - * Processor responsible for managing PubSub Dev Services. + * Processor responsible for managing Pub/Sub Dev Services. *

- * The processor starts the PubSub service in case it's not running. + * The processor starts the Pub/Sub service in case it's not running. */ @BuildSteps(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class) public class PubSubDevServiceProcessor { @@ -29,11 +29,11 @@ public class PubSubDevServiceProcessor { // Running dev service instance private static volatile DevServicesResultBuildItem.RunningDevService devService; - // Configuration for the PubSub Dev service + // Configuration for the Pub/Sub Dev service private static volatile PubSubDevServiceConfig config; @BuildStep - public DevServicesResultBuildItem startPubSub(DockerStatusBuildItem dockerStatusBuildItem, + public DevServicesResultBuildItem start(DockerStatusBuildItem dockerStatusBuildItem, PubSubBuildTimeConfig pubSubBuildTimeConfig, List devServicesSharedNetworkBuildItem, Optional consoleInstalledBuildItem, @@ -74,7 +74,7 @@ public DevServicesResultBuildItem startPubSub(DockerStatusBuildItem dockerStatus * Start the container if conditions are met. * * @param dockerStatusBuildItem, Docker status - * @param config, Configuration for the PubSub service + * @param config, Configuration for the Pub/Sub service * @param timeout, Optional timeout for starting the service * @return Running service item, or null if the service couldn't be started */ @@ -96,7 +96,7 @@ private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(D } /** - * Starts the PubSub emulator container with provided configuration. + * Starts the Pub/Sub emulator container with provided configuration. * * @param dockerStatusBuildItem, Docker status * @param config, Configuration for the PubSub service @@ -106,27 +106,27 @@ private DevServicesResultBuildItem.RunningDevService startContainerIfAvailable(D private DevServicesResultBuildItem.RunningDevService startContainer(DockerStatusBuildItem dockerStatusBuildItem, PubSubDevServiceConfig config, Optional timeout) { - // Create and configure PubSub emulator container - PubSubEmulatorContainer pubSubEmulatorContainer = new QuarkusPubSubContainer( + // Create and configure Pub/Sub emulator container + PubSubEmulatorContainer emulatorContainer = new QuarkusPubSubContainer( DockerImageName.parse(config.imageName).asCompatibleSubstituteFor("gcr.io/google.com/cloudsdktool/cloud-sdk"), - config.port.orElse(null)); + config.emulatorPort.orElse(null)); // Set container startup timeout if provided - timeout.ifPresent(pubSubEmulatorContainer::withStartupTimeout); - pubSubEmulatorContainer.start(); + timeout.ifPresent(emulatorContainer::withStartupTimeout); + emulatorContainer.start(); // Set the config for the started container PubSubDevServiceProcessor.config = config; // Return running service item with container details return new DevServicesResultBuildItem.RunningDevService(PubSubBuildSteps.FEATURE, - pubSubEmulatorContainer.getContainerId(), - pubSubEmulatorContainer::close, "quarkus.google.cloud.pubsub.emulator-host", - pubSubEmulatorContainer.getEmulatorEndpoint()); + emulatorContainer.getContainerId(), + emulatorContainer::close, "quarkus.google.cloud.pubsub.emulator-host", + emulatorContainer.getEmulatorEndpoint()); } /** - * Stops the running PubSub emulator container. + * Stops the running Pub/Sub emulator container. */ private void stopContainer() { if (devService != null && devService.isOwner()) { @@ -147,7 +147,7 @@ private void stopContainer() { private static class QuarkusPubSubContainer extends PubSubEmulatorContainer { private final Integer fixedExposedPort; - private static final int PUBSUB_INTERNAL_PORT = 8085; + private static final int INTERNAL_PORT = 8085; private QuarkusPubSubContainer(DockerImageName dockerImageName, Integer fixedExposedPort) { super(dockerImageName); @@ -155,17 +155,17 @@ private QuarkusPubSubContainer(DockerImageName dockerImageName, Integer fixedExp } /** - * Configures the PubSub emulator container. + * Configures the Pub/Sub emulator container. */ @Override public void configure() { super.configure(); - // Expose PubSub emulatorPort + // Expose Pub/Sub emulatorPort if (fixedExposedPort != null) { - addFixedExposedPort(fixedExposedPort, PUBSUB_INTERNAL_PORT); + addFixedExposedPort(fixedExposedPort, INTERNAL_PORT); } else { - addExposedPort(PUBSUB_INTERNAL_PORT); + addExposedPort(INTERNAL_PORT); } } }