File tree Expand file tree Collapse file tree 5 files changed +48
-5
lines changed
src/test/java/pl/piomin/services/order Expand file tree Collapse file tree 5 files changed +48
-5
lines changed Original file line number Diff line number Diff line change 88 - checkout
99 - run :
1010 name : Analyze on SonarCloud
11- command : mvn verify sonar:sonar
11+ command : mvn verify sonar:sonar -DskipTests
1212
1313executors :
14- jdk :
15- docker :
16- - image : ' cimg/openjdk:21.0.6'
14+ machine_executor_amd64 :
15+ machine :
16+ image : ubuntu-2204:current
17+ environment :
18+ architecture : " amd64"
19+ platform : " linux/amd64"
1720
1821orbs :
1922 maven : circleci/maven@2.0.0
@@ -22,6 +25,6 @@ workflows:
2225 maven_test :
2326 jobs :
2427 - maven/test :
25- executor : jdk
28+ executor : machine_executor_amd64
2629 - build :
2730 context : SonarCloud
Original file line number Diff line number Diff line change 1+ version : " 3.7"
2+ services :
3+ rabbitmq :
4+ container_name : rabbitmq
5+ image : rabbitmq:4
6+ ports :
7+ - " 5672:5672"
Original file line number Diff line number Diff line change 5757 <artifactId >messaging-common</artifactId >
5858 <version >${project.version} </version >
5959 </dependency >
60+ <dependency >
61+ <groupId >org.testcontainers</groupId >
62+ <artifactId >rabbitmq</artifactId >
63+ <scope >test</scope >
64+ </dependency >
65+ <dependency >
66+ <groupId >org.springframework.boot</groupId >
67+ <artifactId >spring-boot-testcontainers</artifactId >
68+ <scope >test</scope >
69+ </dependency >
70+ <dependency >
71+ <groupId >org.testcontainers</groupId >
72+ <artifactId >junit-jupiter</artifactId >
73+ <scope >test</scope >
74+ </dependency >
6075 </dependencies >
6176
6277 <build >
Original file line number Diff line number Diff line change 44import org .springframework .beans .factory .annotation .Autowired ;
55import org .springframework .boot .test .context .SpringBootTest ;
66import org .springframework .boot .test .web .client .TestRestTemplate ;
7+ import org .springframework .boot .testcontainers .service .connection .ServiceConnection ;
8+ import org .testcontainers .containers .RabbitMQContainer ;
9+ import org .testcontainers .junit .jupiter .Container ;
10+ import org .testcontainers .junit .jupiter .Testcontainers ;
711import pl .piomin .services .messaging .Order ;
812import pl .piomin .services .messaging .OrderStatus ;
913
1418
1519
1620@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
21+ @ Testcontainers
1722public class OrderControllerTest {
1823
1924 @ Autowired
2025 TestRestTemplate template ;
2126
27+ @ Container
28+ @ ServiceConnection
29+ static final RabbitMQContainer rabbit = new RabbitMQContainer ("rabbitmq:4" )
30+ .withExposedPorts (5672 );
31+
2232 @ Test
2333 public void testOrder () throws InterruptedException {
2434 Order order = new Order ();
Original file line number Diff line number Diff line change 88
99 <properties >
1010 <java .version>21</java .version>
11+ <testcontainers .version>1.21.0</testcontainers .version>
1112 <sonar .projectKey>piomin_sample-message-driven-microservices</sonar .projectKey>
1213 <sonar .organization>piomin</sonar .organization>
1314 <sonar .host.url>https://sonarcloud.io</sonar .host.url>
2930 <type >pom</type >
3031 <scope >import</scope >
3132 </dependency >
33+ <dependency >
34+ <groupId >org.testcontainers</groupId >
35+ <artifactId >testcontainers-bom</artifactId >
36+ <version >${testcontainers.version} </version >
37+ <type >pom</type >
38+ <scope >import</scope >
39+ </dependency >
3240 </dependencies >
3341 </dependencyManagement >
3442
You can’t perform that action at this time.
0 commit comments