From a7042b301f79c6728f03e64fcb511d5ad0082c83 Mon Sep 17 00:00:00 2001 From: Sandra Parsick Date: Tue, 27 Aug 2024 18:18:01 +0200 Subject: [PATCH] Docs for 0.9.0 (#147) * docs: http proxy feature * docs: improvements * docs: bom documentation --- README.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d1f7004..725429e 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This project contains a [Testcontainers](https://www.testcontainers.org/) implem It sets up the git server with a ready to use repository with the default name `testRepo`. The repository name can be overwritten. -It exists two flavours for the git server (exposed by SSH or bz HTTP) +It exists two flavours for the git server (exposed by SSH or by HTTP) The port is set by testcontainers' mechanism. ## Add me as Dependency @@ -15,18 +15,37 @@ The port is set by testcontainers' mechanism. **Maven:** ```xml - - io.github.sparsick.testcontainers.gitserver - testcontainers-gitserver - 0.8.0 - test - + + + + io.github.sparsick.testcontainers.gitserver + testcontainers-git-bom + 0.9.0 + test + + + + + + + io.github.sparsick.testcontainers.gitserver + testcontainers-gitserver + test + + ``` **Gradle:** ```groovy +dependencyManagement { + imports { + mavenBom("io.github.sparsick.testcontainers.gitserver:testcontainers-git-bom:0.9.0") + } +} + + dependencies { - testImplementation 'io.github.sparsick.testcontainers.gitserver:testcontainers-gitserver:0.5.0' + testImplementation 'io.github.sparsick.testcontainers.gitserver:testcontainers-gitserver' } ``` @@ -98,7 +117,7 @@ public class GitHttpServerContainerUsedInJUnit5Test { } } ```` - +#### HTTP with Basic Authentication The next sample shows how to use the git server container via HTTP with Basic Authentication in a JUnit 5 test: ````java @@ -125,6 +144,29 @@ public class GitHttpServerContainerUsedInJUnit5Test { } } ```` +#### Enabling HTTP Proxy +Since 0.9.0 it is possible to configure HTTP proxy, programmatically. + +````java +import com.github.sparsick.testcontainers.gitserver.GitServerVersions; +import com.github.sparsick.testcontainers.gitserver.http.GitHttpServerContainer; + +@Testcontainers +public class GitHttpServerContainerUsedInJUnit5Test { + + @Container + private GitHttpServerContainer containerUnderTest = + new GitHttpServerContainer(GitServerVersions.V2_43.getDockerImageName()) + .withHttpProxySetting(new HttpProxySetting("http://proxy.example.com", "https://proxy.example.com", "")); + + @Test + void hasHttpProxySetting() { + assertThat(containerUnderTest.hasHttpProxy()).isTrue(); + // check interaction + } +} +```` + ## Migration Guide ### Migration from 0.4.x to 0.5.x