{"id":18494910,"url":"https://github.com/qaware/testcontainers-demo","last_synced_at":"2026-05-06T01:37:15.042Z","repository":{"id":43726720,"uuid":"180002988","full_name":"qaware/testcontainers-demo","owner":"qaware","description":"Demo for integration tests with Docker containers using the Testcontainers library","archived":false,"fork":false,"pushed_at":"2024-03-12T15:04:35.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-25T16:42:17.129Z","etag":null,"topics":["docker","integration-tests","java","java-ee","postgresql","solr","testcontainers","testing"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qaware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-07T17:59:36.000Z","updated_at":"2022-02-21T15:18:26.000Z","dependencies_parsed_at":"2024-11-06T13:27:10.396Z","dependency_job_id":"ac516c8a-2a61-4b62-9f9e-8065e313f802","html_url":"https://github.com/qaware/testcontainers-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Ftestcontainers-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Ftestcontainers-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Ftestcontainers-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qaware%2Ftestcontainers-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qaware","download_url":"https://codeload.github.com/qaware/testcontainers-demo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239210439,"owners_count":19600537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","integration-tests","java","java-ee","postgresql","solr","testcontainers","testing"],"created_at":"2024-11-06T13:22:41.671Z","updated_at":"2025-10-13T06:32:20.219Z","avatar_url":"https://github.com/qaware.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testcontainers demo\n\nThis demo project shows how to write an integration test with Docker containers for a Java EE microservice using the [Testcontainers](https://www.testcontainers.org/) library.\n\nThe demo accompanies the blog post [Integration tests for Java EE with Testcontainers](https://medium.com/@sbillet/integration-tests-for-java-ee-with-testcontainers-10b02ac08603).\n\n## Overview\n\n**book-loader** is a sample Java EE micro service importing book data from a PostgresSQL database into a Solr search index. It runs in a Payara Micro App server and offers a simple JAX-RS Web service to trigger a load.\n\n**book-loader-it** is an integration test for book-loader using the Testcontainers library. It starts the book-loader (system under test) as well as the two databases as Docker containers.\n\n## Prerequisites\n\n* Docker, preferably on Linux\n    * see [Testcontainers Docker requirements](https://www.testcontainers.org/supported_docker_environment/)\n    * the demo was also tested successfully on [Windows 10](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/quick-start-windows-10-linux)\n* Java JDK 8\n* Maven 3\n\nMake sure to clone the repository and navigate to the directory.\n\n## Run the integration test\n\nA normal Maven build will compile the app, build a Docker image and run the integration test. The test will automatically start Docker containers for Postgres, Solr and the book-loader, execute the book-loader and clean up the containers afterwards.\n\n`mvn clean install`\n\n## Run the application manually\n\nIf you want to manually run the application to get a feeling for what we are automating, you can use the following commands.\n\nCreate a named Docker network.\n\n`docker network create testcontainers-demo`\n\nStart a Postgres database container in our network.\n\n`docker run -d -p 5432:5432 --env POSTGRES_PASSWORD=123 --name testcontainers-demo-postgres --network testcontainers-demo postgres:11.2`\n\nFill the Postgres database with some test data. For example, execute the prepared script with the Postgres command line client.\n\n`psql postgresql://postgres:123@localhost:5432/postgres -f book-loader-it/src/test/resources/insert-test-data.sql`\n\nStart a Solr search index container in our network and create an empty \"books\" core.\n\n`docker run -d -p 8983:8983 --name testcontainers-demo-solr --network testcontainers-demo solr:7.7.1 solr-create -c books`\n\nYou can now open the Solr admin UI by opening `http://localhost:8983` in a browser and check that there is an empty \"books\" core. The same can be checked with curl. It should return an successful, but empty search result.\n\n`curl http://localhost:8983/solr/books/select?q=*:*`\n\nBuild the book-loader with Maven. This also creates the Docker image.\n\n`mvn clean install -DskipTests`\n\nStart a book-loader container in our network.\n\n`docker run -d -p 8080:8080 --name testcontainers-demo-book-loader --network testcontainers-demo testcontainers/book-loader:latest`\n\nTrigger a book-loader load by calling the Web service.\n\n`curl http://localhost:8080/book-loader/start`\n\nCheck that the book data was loaded into Solr.\n\n`curl http://localhost:8983/solr/books/select?q=*:*`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaware%2Ftestcontainers-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqaware%2Ftestcontainers-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqaware%2Ftestcontainers-demo/lists"}