Skip to content

Commit

Permalink
hacked testcontainer-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Gorzala committed Mar 25, 2024
1 parent a5c598d commit c5d9082
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package net.dancier.kikeriki;

import jakarta.transaction.Transactional;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -25,27 +22,13 @@ public class NeededInfrastructureBaseTestClass {

private static final Logger log = LoggerFactory.getLogger(NeededInfrastructureBaseTestClass.class);


@Container
final static KafkaContainer kafkaContainer = new KafkaContainer(
DockerImageName.parse("confluentinc/cp-kafka:7.3.3")
);

@Container
final static PostgreSQLContainer<?> postgreSQLContainer = new PostgreSQLContainer<>("postgres:16-alpine");
/** @BeforeAll
static void beforeAll() {
postgreSQLContainer.start();
kafkaContainer.start();
log.info("Started needed Container...");
}
@AfterAll
static void afterAll() {
postgreSQLContainer.stop();
kafkaContainer.stop();
log.info("Stopped needed Container...");
}
**/

public static class DataSourceInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,11 @@


class SchedulingAndSendingMailWorks extends NeededInfrastructureBaseTestClass {

@Autowired
MailOutboxJpaRepository mailOutboxJpaRepository;


@Autowired
ApplicationEventPublisher applicationEventPublisher;

@MockBean
JavaMailSender javaMailSender;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class StateIntegrationTest extends NeededInfrastructureBaseTestClass {

@Test
public void newUnreadMessage() {

assertThat(statePort.get(ApplicationEventStubbing.RECIPIENT_ID).unreadMessagesCount()).isEqualTo(0);

applicationEventPublisher.publishEvent(ApplicationEventStubbing.messagePostedEvent());
Expand Down

0 comments on commit c5d9082

Please sign in to comment.