From 655fb4fea98e70c4dee53902a1c8fe4870e239ea Mon Sep 17 00:00:00 2001 From: shelajev Date: Thu, 18 Jan 2024 00:50:33 -0500 Subject: [PATCH] containers set up --- src/main/resources/P101.jpg | Bin 0 -> 36665 bytes .../catalog/ApplicationTest.java | 10 ++++ .../catalog/BaseIntegrationTest.java | 31 +++++++++++ .../catalog/ContainersConfig.java | 48 ++++++++++++++++++ .../catalog/ProductControllerTest.java | 36 +++++++++++++ .../catalog/TestApplication.java | 10 ++++ 6 files changed, 135 insertions(+) create mode 100644 src/main/resources/P101.jpg create mode 100644 src/test/java/com/testcontainers/catalog/ApplicationTest.java create mode 100644 src/test/java/com/testcontainers/catalog/BaseIntegrationTest.java create mode 100644 src/test/java/com/testcontainers/catalog/ContainersConfig.java create mode 100644 src/test/java/com/testcontainers/catalog/ProductControllerTest.java create mode 100644 src/test/java/com/testcontainers/catalog/TestApplication.java diff --git a/src/main/resources/P101.jpg b/src/main/resources/P101.jpg new file mode 100644 index 0000000000000000000000000000000000000000..51416f4bc9d77d9f0a5dc6bc07d66a655e56f367 GIT binary patch literal 36665 zcmeI3XH-*P+vbCaAW{TDszjxOfJl)Z6%he36zM{gUPMHsmxxFeh=5d)j);^oi8)Zpu^Z5&>H@;U@uPWZ8r%Zy>LDXl?{PP4JXMraT9SzOdvo!RywCCs;=ouI;&|kQ~ z$i#Y)k%@)r!i9^MFS1->V`pb)VCLYw%*M&e#?JQ7mrzjypE*l&o`&W;8{-8=w*TV? zyEjj{jcSZ+3$LjDU>w>v!krFLQ8m zaSI9wi-?NJ%E{kWP*hUCukk?hp_aDc6C-02Q!{fLTRVFPM<-{GH=bVJKE8e-??c1F zBO;^X6Fwy-C8wmO<>cn&e=Yb{_`STMvZ}hKwywUprM0cSqqFPJ;Lz~MD0*ysVt!$9 zX?bOJZG8i~w|{VmJHj6m{)vkUMExIO0k8iN*nf(P1&Hg+*|XGVY5$3f>WnwAQL~(- zxh8#%^{zhcbN5TvZw1q_-HXdE`+c5Y#s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{FT*afbsAaoza*I-@Hf5 zr4qqcvmvdChnXQ{en%_iG7crRT=qUq>5MDPxlC0UtyQD~CsEABqHC)(x2`5b$3LRa zz%jk35XT>9s16*wdv~e9B=S$rw_cB-{b@gNuJV)Ew@cP3*pM{{JszQh$1Vo)v1_1( zYwvGJ=Eefq!>@k1zilV__+IN4jr`<8X+S(Vtl~QiA?o40%kc==;p9K7=q6L~cG`KZ zk5L!+zWheUB2i8VURboIY88^?_X~BRwy}8V7G))g9{VuMI@6U=_FE*9c`k(=W)-e} zL-We=!J@PDrzT_N%!#BW%K)uv$K`XfL;5_NklUYyxk|m~IEab8)Z}_C3Mj{__KXfI zRNzn;1yFtqy5ORzKI%r4F0$B=zx7#ptYTT4pW(p+CZpOlcdPqFqQ-Neu-h~JU>FO$<*v^OISiO<^Xs2P2@tD>|3R$4R=Ly3wzm>ygR zk(}UjPV(^^SJz8gx!V123@sD47 zBqSW>^|BeQaeF+a`?IZrEN~Xd`3S5%6v=v<{TAME+jCQcjfr4B5$4FxPn)%^!7l$i z%l_>vg~fETtiDNBC2$o!(wtrP%6Q;`@Ds^$8k4!Zs<_HeyRN}@3Hb_GA;p;;(J!3Q zbdU=C3arx^-T0oK_706gykDBOsN>Zv2FZbDf>%zI#{N0Se;pA+Eo&bog8JwvYW+|k zUPF-WNi6v;K+@HJ)74i0uB*gO&->qZh2Lr0ownU61E&m}GH}YkDFderoHB6Az$pW# z44g7>%D^cDrwp7jaLT|b1E&m}GH}YkDFderoHB6Az$pW#44g7>%D^cDrwp7jaLT|b P1E&o9|H1$@W&FPYG#|>= literal 0 HcmV?d00001 diff --git a/src/test/java/com/testcontainers/catalog/ApplicationTest.java b/src/test/java/com/testcontainers/catalog/ApplicationTest.java new file mode 100644 index 0000000..0fff780 --- /dev/null +++ b/src/test/java/com/testcontainers/catalog/ApplicationTest.java @@ -0,0 +1,10 @@ +package com.testcontainers.catalog; + +import org.junit.jupiter.api.Test; + +class ApplicationTest extends BaseIntegrationTest { + @Test + void contextLoads() { + + } +} \ No newline at end of file diff --git a/src/test/java/com/testcontainers/catalog/BaseIntegrationTest.java b/src/test/java/com/testcontainers/catalog/BaseIntegrationTest.java new file mode 100644 index 0000000..8944d4b --- /dev/null +++ b/src/test/java/com/testcontainers/catalog/BaseIntegrationTest.java @@ -0,0 +1,31 @@ +package com.testcontainers.catalog; + +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; + +import io.restassured.RestAssured; +import org.junit.jupiter.api.BeforeEach; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.utility.DockerImageName; + +@SpringBootTest( + webEnvironment = RANDOM_PORT, + properties = { + "spring.kafka.consumer.auto-offset-reset=earliest" + }) +@Import(ContainersConfig.class) +public abstract class BaseIntegrationTest { + + @LocalServerPort + private int port; + + @BeforeEach + void setUpBase() { + RestAssured.port = port; + } +} \ No newline at end of file diff --git a/src/test/java/com/testcontainers/catalog/ContainersConfig.java b/src/test/java/com/testcontainers/catalog/ContainersConfig.java new file mode 100644 index 0000000..c0e2570 --- /dev/null +++ b/src/test/java/com/testcontainers/catalog/ContainersConfig.java @@ -0,0 +1,48 @@ +package com.testcontainers.catalog; + +import static org.testcontainers.utility.DockerImageName.parse; + +import com.testcontainers.catalog.domain.FileStorageService; +import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.DependsOn; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.KafkaContainer; +import org.testcontainers.containers.PostgreSQLContainer; +import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.elasticsearch.ElasticsearchContainer; + +@TestConfiguration(proxyBeanMethods = false) +public class ContainersConfig { + + @Bean + @ServiceConnection + PostgreSQLContainer postgresContainer() { + return new PostgreSQLContainer<>(parse("postgres:16-alpine")); + } + + @Bean + @ServiceConnection + KafkaContainer kafkaContainer() { + return new KafkaContainer(parse("confluentinc/cp-kafka:7.5.0")).withReuse(true); + } + + @Bean("localstackContainer") + LocalStackContainer localstackContainer(DynamicPropertyRegistry registry) { + LocalStackContainer localStack = new LocalStackContainer(parse("localstack/localstack:2.3")).withReuse(true); + registry.add("spring.cloud.aws.credentials.access-key", localStack::getAccessKey); + registry.add("spring.cloud.aws.credentials.secret-key", localStack::getSecretKey); + registry.add("spring.cloud.aws.region.static", localStack::getRegion); + registry.add("spring.cloud.aws.endpoint", localStack::getEndpoint); + return localStack; + } + + @Bean + @DependsOn("localstackContainer") + ApplicationRunner awsInitializer(ApplicationProperties properties, FileStorageService fileStorageService) { + return args -> fileStorageService.createBucket(properties.productImagesBucketName()); + } +} diff --git a/src/test/java/com/testcontainers/catalog/ProductControllerTest.java b/src/test/java/com/testcontainers/catalog/ProductControllerTest.java new file mode 100644 index 0000000..dfafacd --- /dev/null +++ b/src/test/java/com/testcontainers/catalog/ProductControllerTest.java @@ -0,0 +1,36 @@ +package com.testcontainers.catalog; + +import com.testcontainers.catalog.BaseIntegrationTest; +import com.testcontainers.catalog.domain.ProductService; +import com.testcontainers.catalog.domain.models.Product; +import io.restassured.http.ContentType; +import org.junit.jupiter.api.Test; +import java.util.UUID; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.endsWith; + +class ProductControllerTest extends BaseIntegrationTest { + + @Test + void createProductSuccessfully() { + String code = UUID.randomUUID().toString(); + given().contentType(ContentType.JSON) + .body( + """ + { + "code": "%s", + "name": "Product %s", + "description": "Product %s description", + "price": 10.0 + } + """ + .formatted(code, code, code)) + .when() + .post("/api/products") + .then() + .statusCode(201) + .header("Location", endsWith("/api/products/%s".formatted(code))); + } + +} \ No newline at end of file diff --git a/src/test/java/com/testcontainers/catalog/TestApplication.java b/src/test/java/com/testcontainers/catalog/TestApplication.java new file mode 100644 index 0000000..38f1320 --- /dev/null +++ b/src/test/java/com/testcontainers/catalog/TestApplication.java @@ -0,0 +1,10 @@ +package com.testcontainers.catalog; + +import org.springframework.boot.SpringApplication; + +public class TestApplication { + + public static void main(String[] args) { + SpringApplication.from(Application::main).with(ContainersConfig.class).run(args); + } +}