diff --git a/examples/springboot-postgresql/README.md b/examples/springboot-postgresql/README.md deleted file mode 100644 index 1061b29..0000000 --- a/examples/springboot-postgresql/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# TestContainers PostgreSQL Example - -This module demonstrates how to use the TestContainers-Ext library with PostgreSQL. - -## Overview - -This example shows two ways to use TestContainers-Ext with PostgreSQL: - -1. **Annotation-based approach**: Using the `@EnableJdbcContainer` annotation in tests -2. **Programmatic approach**: Directly creating and managing container instances - -## Structure - -- `src/main/java`: Contains a demo application showing programmatic usage -- `src/test/java`: Contains test examples showing annotation-based usage - -## Annotation-based Usage - -The annotation-based approach is the simplest way to use TestContainers-Ext. Just add the `@EnableJdbcContainer` annotation to your test class: - -```java -@EnableJdbcContainer(rdbms = Rdbms.POSTGRES, version = "13.2") -public class PostgresqlExampleTest { - - @Test - public void testWithPostgresql() { - // The PostgreSQL container is automatically started before this test - // and stopped after the test completes. - - System.out.println("PostgreSQL container is running!"); - - // You can access connection details using: - // - System.getProperty("db.url") - // - System.getProperty("db.username") - // - System.getProperty("db.password") - } -} -``` - -## Programmatic Usage - -For more control, you can create and manage containers programmatically: - -```java -// Create a PostgreSQL container factory -PostgresSqlContainerFactory factory = new PostgresSqlContainerFactory(); - -// Create a PostgreSQL container with version 13.2 -JdbcDatabaseContainer container = factory.createContainer("13.2"); - -// Start the container -container.start(); - -// Use the container -System.out.println("JDBC URL: " + container.getJdbcUrl()); -System.out.println("Username: " + container.getUsername()); -System.out.println("Password: " + container.getPassword()); - -// Stop the container when done -container.stop(); -``` - -## Running the Examples - -### Running the Tests - -```bash -./gradlew :examples:testcontainers-postgresql:test -``` - -### Running the Demo Application - -```bash -./gradlew :examples:testcontainers-postgresql:run -``` - -## Requirements - -- Java 8 or higher -- Docker (for running the containers) \ No newline at end of file diff --git a/examples/springboot-postgresql/src/test/java/io/flowinquiry/testcontainers/examples/postgresql/PostgresqlDemoAppTest.java b/examples/springboot-postgresql/src/test/java/io/flowinquiry/testcontainers/examples/postgresql/PostgresqlDemoAppTest.java index 86242d7..2ace2b1 100644 --- a/examples/springboot-postgresql/src/test/java/io/flowinquiry/testcontainers/examples/postgresql/PostgresqlDemoAppTest.java +++ b/examples/springboot-postgresql/src/test/java/io/flowinquiry/testcontainers/examples/postgresql/PostgresqlDemoAppTest.java @@ -42,13 +42,13 @@ public void testStoreEntityAndRepository() { List storesByName = storeRepository.findByName("Test Store"); log.info("Found {} stores by name", storesByName.size()); assertEquals(1, storesByName.size()); - assertEquals("Test Store", storesByName.getFirst().getName()); + assertEquals("Test Store", storesByName.get(0).getName()); log.info("Testing findByDescriptionContaining"); List storesByDescription = storeRepository.findByDescriptionContaining("demonstration"); log.info("Found {} stores by description", storesByDescription.size()); assertEquals(1, storesByDescription.size()); - assertEquals("A test store for demonstration", storesByDescription.getFirst().getDescription()); + assertEquals("A test store for demonstration", storesByDescription.get(0).getDescription()); log.info("Creating another store"); Store anotherStore = diff --git a/gradle/license-header.txt b/gradle/license-header.txt deleted file mode 100644 index e1f44ae..0000000 --- a/gradle/license-header.txt +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2023-2024 TestContainers-Ext Contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ \ No newline at end of file