File tree Expand file tree Collapse file tree 9 files changed +73
-10
lines changed
src/test/java/pl/piomin/services/account
src/test/java/pl/piomin/services/order
src/test/java/pl/piomin/services/product Expand file tree Collapse file tree 9 files changed +73
-10
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 3434 <artifactId >logstash-logback-encoder</artifactId >
3535 <version >8.1</version >
3636 </dependency >
37+ <dependency >
38+ <groupId >io.projectreactor</groupId >
39+ <artifactId >reactor-core-micrometer</artifactId >
40+ </dependency >
3741 <dependency >
3842 <groupId >io.micrometer</groupId >
39- <artifactId >micrometer-tracing-bridge-otel </artifactId >
43+ <artifactId >micrometer-tracing-bridge-brave </artifactId >
4044 </dependency >
4145 <dependency >
4246 <groupId >org.springframework.boot</groupId >
Original file line number Diff line number Diff line change 77import org .slf4j .LoggerFactory ;
88import org .springframework .beans .factory .annotation .Autowired ;
99import org .springframework .boot .test .context .SpringBootTest ;
10+ import org .springframework .cloud .stream .binder .test .EnableTestBinder ;
1011import org .springframework .cloud .stream .binder .test .InputDestination ;
1112import org .springframework .cloud .stream .binder .test .OutputDestination ;
1213import org .springframework .integration .support .MessageBuilder ;
2021import static org .junit .jupiter .api .Assertions .assertNotNull ;
2122
2223@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
24+ @ EnableTestBinder
2325public class OrderReceiverTest {
2426
2527 private static final Logger LOGGER = LoggerFactory .getLogger (OrderReceiverTest .class );
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 1717 <groupId >org.springframework.cloud</groupId >
1818 <artifactId >spring-cloud-stream</artifactId >
1919 </dependency >
20+ <dependency >
21+ <groupId >org.springframework.cloud</groupId >
22+ <artifactId >spring-cloud-starter-stream-rabbit</artifactId >
23+ </dependency >
2024 <dependency >
2125 <groupId >org.springframework.boot</groupId >
2226 <artifactId >spring-boot-starter-web</artifactId >
2529 <groupId >org.springframework.boot</groupId >
2630 <artifactId >spring-boot-starter-actuator</artifactId >
2731 </dependency >
32+ <dependency >
33+ <groupId >io.projectreactor</groupId >
34+ <artifactId >reactor-core-micrometer</artifactId >
35+ </dependency >
2836 <dependency >
2937 <groupId >net.logstash.logback</groupId >
3038 <artifactId >logstash-logback-encoder</artifactId >
3139 <version >8.1</version >
3240 </dependency >
3341 <dependency >
3442 <groupId >io.micrometer</groupId >
35- <artifactId >micrometer-tracing-bridge-otel </artifactId >
43+ <artifactId >micrometer-tracing-bridge-brave </artifactId >
3644 </dependency >
3745 <dependency >
3846 <groupId >org.springframework.boot</groupId >
4957 <artifactId >messaging-common</artifactId >
5058 <version >${project.version} </version >
5159 </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 >
5275 </dependencies >
5376
5477 <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>
1617 <parent >
1718 <groupId >org.springframework.boot</groupId >
1819 <artifactId >spring-boot-starter-parent</artifactId >
19- <version >3.3.5 </version >
20+ <version >3.4.3 </version >
2021 <relativePath />
2122 </parent >
2223
2526 <dependency >
2627 <groupId >org.springframework.cloud</groupId >
2728 <artifactId >spring-cloud-dependencies</artifactId >
28- <version >2023.0.1</version >
29+ <version >2024.0.1</version >
30+ <type >pom</type >
31+ <scope >import</scope >
32+ </dependency >
33+ <dependency >
34+ <groupId >org.testcontainers</groupId >
35+ <artifactId >testcontainers-bom</artifactId >
36+ <version >${testcontainers.version} </version >
2937 <type >pom</type >
3038 <scope >import</scope >
3139 </dependency >
Original file line number Diff line number Diff line change 2828 </dependency >
2929 <dependency >
3030 <groupId >io.micrometer</groupId >
31- <artifactId >micrometer-tracing-bridge-otel</artifactId >
31+ <artifactId >micrometer-tracing-bridge-brave</artifactId >
32+ </dependency >
33+ <dependency >
34+ <groupId >io.projectreactor</groupId >
35+ <artifactId >reactor-core-micrometer</artifactId >
3236 </dependency >
3337 <dependency >
3438 <groupId >org.springframework.boot</groupId >
Original file line number Diff line number Diff line change 77import org .slf4j .LoggerFactory ;
88import org .springframework .beans .factory .annotation .Autowired ;
99import org .springframework .boot .test .context .SpringBootTest ;
10+ import org .springframework .cloud .stream .binder .test .EnableTestBinder ;
1011import org .springframework .cloud .stream .binder .test .InputDestination ;
1112import org .springframework .cloud .stream .binder .test .OutputDestination ;
1213import org .springframework .integration .support .MessageBuilder ;
2021import static org .junit .jupiter .api .Assertions .assertNotNull ;
2122
2223@ SpringBootTest (webEnvironment = SpringBootTest .WebEnvironment .RANDOM_PORT )
24+ @ EnableTestBinder
2325public class OrderReceiverTest {
2426
2527 private static final Logger LOGGER = LoggerFactory .getLogger (OrderReceiverTest .class );
You can’t perform that action at this time.
0 commit comments