Skip to content

Add testcontainers-lifecycle-examples project. #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add testcontainers-lifecycle-examples project.
  • Loading branch information
Maksim Kostromin committed Jun 25, 2023
commit 2266ba02a23b4835bebb40594371dc8789703943
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
35 changes: 35 additions & 0 deletions testcontainers-lifecycle-examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# testcontainers lifecycles

Status: IN PROGRESS

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

Inspired by [this](https://www.youtube.com/watch?v=6BX5PBXPdV0) video.

<!--

# 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