Skip to content

Commit

Permalink
Add testcontainers-lifecycle-examples project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksim Kostromin committed Jun 25, 2023
1 parent bd1b09b commit b202885
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/testcontainers-lifecycle-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'testcontainers lifecycle examples'
on: [push]
env:
JAVA_VERSION: '17'
jobs:
testcontainers-lifecycle-examples:
name: testcontainers lifecycle examples
if: github.event.inputs.trigger == ''
|| !startsWith(github.event.inputs.trigger, 'm')
|| !startsWith(github.event.inputs.trigger, 'M')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
# 'temurin' 'zulu' 'adopt' 'adopt-hotspot' 'adopt-openj9' 'liberica' 'microsoft'
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
maven-
- run: cd $GITHUB_WORKSPACE && ./mvnw -f testcontainers-lifecycle-examples
30 changes: 30 additions & 0 deletions testcontainers-lifecycle-examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

```bash
# use jdk 17
./mvnw -f testcontainers-lifecycle-examples
```

<!--
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.13/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.13/maven-plugin/reference/html/#build-image)
* [Testcontainers MongoDB Module Reference Guide](https://www.testcontainers.org/modules/databases/mongodb/)
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.7.13/reference/htmlsingle/#data.nosql.mongodb)
* [Testcontainers](https://www.testcontainers.org/)
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.13/reference/htmlsingle/#web)
### Guides
The following guides illustrate how to use some features concretely:
* [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
-->
81 changes: 81 additions & 0 deletions testcontainers-lifecycle-examples/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?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">
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.13</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.daggerok</groupId>
<artifactId>testcontainers-lifecycle-examples</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>${project.artifactId}</description>
<properties>
<java.version>17</java.version>
<testcontainers.version>1.18.3</testcontainers.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</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.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<scope>test</scope>
</dependency>-->
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<defaultGoal>clean verify</defaultGoal>
<plugins>
<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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.daggerok.testcontainerslifecycleexamples;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class TestcontainersLifecycleExamplesApplication {

public static void main(String[] args) {
SpringApplication.run(TestcontainersLifecycleExamplesApplication.class, args);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.daggerok.testcontainerslifecycleexamples;

import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Test;

@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class JavaTestcontainersAnnotationTests {

@Test
void should_test() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.daggerok.testcontainerslifecycleexamples;

import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Test;

@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class PlainJavaTestcontainersTests {

@Test
void should_test() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.daggerok.testcontainerslifecycleexamples;

import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class SpringBootTestcontainersAnnotationIntegrationTests {

@Test
void should_test_context() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.github.daggerok.testcontainerslifecycleexamples;

import org.junit.jupiter.api.DisplayNameGeneration;
import org.junit.jupiter.api.DisplayNameGenerator;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
class SpringBootTestcontainersIntegrationTests {

@Test
void should_test_context() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
spring:
output:
ansi:
enabled: always

0 comments on commit b202885

Please sign in to comment.