<dependency>
<groupId>com.playtika.testcontainers</groupId>
<artifactId>embedded-google-storage</artifactId>
<scope>test</scope>
</dependency>-
embedded.google.storage.enabled(true|false, default is true) -
embedded.google.storage.reuseContainer(true|false, default is false) -
embedded.google.storage.dockerImage(default is 'fsouza/fake-gcs-server:1.47.8')-
Image versions on dockerhub
-
-
embedded.google.storage.projectId(project id for storage, default is my-project-id) -
embedded.google.storage.bucketLocation(location for buckets, default is US-CENTRAL1) -
embedded.google.storage.bucketscreates buckets of with 'name' on startup:embedded.google.storage.buckets[0].name=my-bucket0 embedded.google.storage.buckets[1].name=my-bucket1 -
embedded.toxiproxy.proxies.google.storage.enabledEnables both creation of the container with ToxiProxy TCP proxy and a proxy to theembedded-google-storagecontainer.
-
embedded.google.storage.host -
embedded.google.storage.port -
embedded.google.storage.endpoint(computed propertyhttp://${host}:${port}for convenient configuration) -
embedded.google.storage.projectId -
embedded.google.storage.bucketLocation -
embedded.google.storage.toxiproxy.host -
embedded.google.storage.toxiproxy.port -
embedded.google.storage.networkAlias -
embedded.google.storage.internalPort -
Bean
ToxiproxyContainer.ContainerProxy googleStorageContainerProxy
To define your Storage service bean you can use this code snippet:
@Configuration
class StorageConfig {
@Bean
Storage storage(
@Value("${embedded.google.storage.endpoint}") String storageHost,
@Value("${embedded.google.storage.project-id}") String projectId) {
return StorageOptions.newBuilder()
.setHost(storageHost)
.setProjectId(projectId)
.setCredentials(NoCredentials.getInstance())
.build()
.getService();
}
}