diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..5a16f9adc78966da995517ee6996415fed74a8c5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>3.4.3</version> + <relativePath/> <!-- lookup parent from repository --> + </parent> + <groupId>takima.example</groupId> + <artifactId>agregio-kata</artifactId> + <version>0.0.1-SNAPSHOT</version> + <name>agregio-kata</name> + <description>agregio-kata</description> + <url/> + <licenses> + <license/> + </licenses> + <developers> + <developer/> + </developers> + <scm> + <connection/> + <developerConnection/> + <tag/> + <url/> + </scm> + <properties> + <java.version>21</java.version> + </properties> + <dependencies> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.flywaydb</groupId> + <artifactId>flyway-core</artifactId> + </dependency> + <dependency> + <groupId>org.flywaydb</groupId> + <artifactId>flyway-database-postgresql</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-devtools</artifactId> + <scope>runtime</scope> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-testcontainers</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testcontainers</groupId> + <artifactId>postgresql</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <annotationProcessorPaths> + <path> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <configuration> + <excludes> + <exclude> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/src/main/java/takima/example/agregiokata/AgregioKataApplication.java b/src/main/java/takima/example/agregiokata/AgregioKataApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..b82df821cea03ee350c171a883ce0d88a6a06205 --- /dev/null +++ b/src/main/java/takima/example/agregiokata/AgregioKataApplication.java @@ -0,0 +1,13 @@ +package takima.example.agregiokata; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class AgregioKataApplication { + + public static void main(String[] args) { + SpringApplication.run(AgregioKataApplication.class, args); + } + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000000000000000000000000000000000000..63237dda4eae24a6cb87ac9b52db644e923199f6 --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + application: + name: agregio-kata diff --git a/src/test/java/takima/example/agregiokata/AgregioKataApplicationTests.java b/src/test/java/takima/example/agregiokata/AgregioKataApplicationTests.java new file mode 100644 index 0000000000000000000000000000000000000000..ea94bf462a8c04b3eb9768339695a1c8880073e4 --- /dev/null +++ b/src/test/java/takima/example/agregiokata/AgregioKataApplicationTests.java @@ -0,0 +1,15 @@ +package takima.example.agregiokata; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; + +@Import(TestcontainersConfiguration.class) +@SpringBootTest +class AgregioKataApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/src/test/java/takima/example/agregiokata/TestAgregioKataApplication.java b/src/test/java/takima/example/agregiokata/TestAgregioKataApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..4f846ab599d7845e47f0f8792d6152cd7906e491 --- /dev/null +++ b/src/test/java/takima/example/agregiokata/TestAgregioKataApplication.java @@ -0,0 +1,11 @@ +package takima.example.agregiokata; + +import org.springframework.boot.SpringApplication; + +public class TestAgregioKataApplication { + + public static void main(String[] args) { + SpringApplication.from(AgregioKataApplication::main).with(TestcontainersConfiguration.class).run(args); + } + +} diff --git a/src/test/java/takima/example/agregiokata/TestcontainersConfiguration.java b/src/test/java/takima/example/agregiokata/TestcontainersConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..3bb8435f23c0ce68825ef41e50dcdec1079a5a63 --- /dev/null +++ b/src/test/java/takima/example/agregiokata/TestcontainersConfiguration.java @@ -0,0 +1,18 @@ +package takima.example.agregiokata; + +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; + +@TestConfiguration(proxyBeanMethods = false) +class TestcontainersConfiguration { + + @Bean + @ServiceConnection + PostgreSQLContainer<?> postgresContainer() { + return new PostgreSQLContainer<>(DockerImageName.parse("postgres:latest")); + } + +}