Skip to content

Commit f0e0c1d

Browse files
author
Maksim Kostromin
committed
Add testcontainers-lifecycle-examples project.
1 parent bd1b09b commit f0e0c1d

File tree

10 files changed

+210
-0
lines changed

10 files changed

+210
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'testcontainers lifecycle examples'
2+
on: [push]
3+
env:
4+
JAVA_VERSION: '17'
5+
jobs:
6+
testcontainers-lifecycle-examples:
7+
name: testcontainers lifecycle examples
8+
if: github.event.inputs.trigger == ''
9+
|| !startsWith(github.event.inputs.trigger, 'm')
10+
|| !startsWith(github.event.inputs.trigger, 'M')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-java@v3
15+
with:
16+
# 'temurin' 'zulu' 'adopt' 'adopt-hotspot' 'adopt-openj9' 'liberica' 'microsoft'
17+
distribution: 'temurin'
18+
java-version: ${{ env.JAVA_VERSION }}
19+
- uses: actions/cache@v3
20+
with:
21+
path: ~/.m2/repository
22+
key: maven-${{ hashFiles('**/pom.xml') }}
23+
restore-keys: |
24+
maven-
25+
- run: cd $GITHUB_WORKSPACE && ./mvnw -f testcontainers-lifecycle-examples
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
```bash
3+
# use jdk 17
4+
./mvnw -f testcontainers-lifecycle-examples
5+
```
6+
7+
<!--
8+
9+
# Getting Started
10+
11+
### Reference Documentation
12+
For further reference, please consider the following sections:
13+
14+
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
15+
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.7.13/maven-plugin/reference/html/)
16+
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.7.13/maven-plugin/reference/html/#build-image)
17+
* [Testcontainers MongoDB Module Reference Guide](https://www.testcontainers.org/modules/databases/mongodb/)
18+
* [Spring Data MongoDB](https://docs.spring.io/spring-boot/docs/2.7.13/reference/htmlsingle/#data.nosql.mongodb)
19+
* [Testcontainers](https://www.testcontainers.org/)
20+
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.7.13/reference/htmlsingle/#web)
21+
22+
### Guides
23+
The following guides illustrate how to use some features concretely:
24+
25+
* [Accessing Data with MongoDB](https://spring.io/guides/gs/accessing-data-mongodb/)
26+
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
27+
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
28+
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
29+
30+
-->
+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.7.13</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
11+
<modelVersion>4.0.0</modelVersion>
12+
<groupId>io.github.daggerok</groupId>
13+
<artifactId>testcontainers-lifecycle-examples</artifactId>
14+
<version>0.0.1-SNAPSHOT</version>
15+
<name>${project.artifactId}</name>
16+
<description>${project.artifactId}</description>
17+
<properties>
18+
<java.version>17</java.version>
19+
<testcontainers.version>1.18.3</testcontainers.version>
20+
</properties>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-data-mongodb</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-web</artifactId>
29+
</dependency>
30+
<!---->
31+
<dependency>
32+
<groupId>org.projectlombok</groupId>
33+
<artifactId>lombok</artifactId>
34+
<optional>true</optional>
35+
</dependency>
36+
<!---->
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter-test</artifactId>
40+
<scope>test</scope>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.testcontainers</groupId>
44+
<artifactId>junit-jupiter</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
<!--<dependency>
48+
<groupId>org.testcontainers</groupId>
49+
<artifactId>mongodb</artifactId>
50+
<scope>test</scope>
51+
</dependency>-->
52+
</dependencies>
53+
<dependencyManagement>
54+
<dependencies>
55+
<dependency>
56+
<groupId>org.testcontainers</groupId>
57+
<artifactId>testcontainers-bom</artifactId>
58+
<version>${testcontainers.version}</version>
59+
<type>pom</type>
60+
<scope>import</scope>
61+
</dependency>
62+
</dependencies>
63+
</dependencyManagement>
64+
<build>
65+
<defaultGoal>clean verify</defaultGoal>
66+
<plugins>
67+
<plugin>
68+
<groupId>org.springframework.boot</groupId>
69+
<artifactId>spring-boot-maven-plugin</artifactId>
70+
<configuration>
71+
<excludes>
72+
<exclude>
73+
<groupId>org.projectlombok</groupId>
74+
<artifactId>lombok</artifactId>
75+
</exclude>
76+
</excludes>
77+
</configuration>
78+
</plugin>
79+
</plugins>
80+
</build>
81+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.github.daggerok.testcontainerslifecycleexamples;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class TestcontainersLifecycleExamplesApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(TestcontainersLifecycleExamplesApplication.class, args);
11+
}
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.github.daggerok.testcontainerslifecycleexamples;
2+
3+
import org.junit.jupiter.api.DisplayNameGeneration;
4+
import org.junit.jupiter.api.DisplayNameGenerator;
5+
import org.junit.jupiter.api.Test;
6+
7+
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
8+
class JavaTestcontainersAnnotationTests {
9+
10+
@Test
11+
void should_test() {
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.github.daggerok.testcontainerslifecycleexamples;
2+
3+
import org.junit.jupiter.api.DisplayNameGeneration;
4+
import org.junit.jupiter.api.DisplayNameGenerator;
5+
import org.junit.jupiter.api.Test;
6+
7+
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
8+
class PlainJavaTestcontainersTests {
9+
10+
@Test
11+
void should_test() {
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.github.daggerok.testcontainerslifecycleexamples;
2+
3+
import org.junit.jupiter.api.DisplayNameGeneration;
4+
import org.junit.jupiter.api.DisplayNameGenerator;
5+
import org.junit.jupiter.api.Test;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
8+
@SpringBootTest
9+
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
10+
class SpringBootTestcontainersAnnotationIntegrationTests {
11+
12+
@Test
13+
void should_test_context() {
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.github.daggerok.testcontainerslifecycleexamples;
2+
3+
import org.junit.jupiter.api.DisplayNameGeneration;
4+
import org.junit.jupiter.api.DisplayNameGenerator;
5+
import org.junit.jupiter.api.Test;
6+
import org.springframework.boot.test.context.SpringBootTest;
7+
8+
@SpringBootTest
9+
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
10+
class SpringBootTestcontainersIntegrationTests {
11+
12+
@Test
13+
void should_test_context() {
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
spring:
2+
output:
3+
ansi:
4+
enabled: always

0 commit comments

Comments
 (0)