From e4d02953c5dd91cf2f4bb766c421e71a6cb491ba Mon Sep 17 00:00:00 2001 From: Ihor Banadiga Date: Mon, 3 Jul 2017 13:14:46 +0300 Subject: [PATCH] RF Storage service --- api-gateway-service/pom.xml | 2 +- realtor-service/pom.xml | 4 ++-- .../com/lohika/jclub/realtor/RealtorController.java | 4 ++-- .../jclub/realtor/RealtorServiceApplication.java | 2 +- storage-service-client/pom.xml | 4 ++-- .../jclub/storage/{ => client}/Apartment.java | 2 +- .../{ => client}/EnableStorageServiceClient.java | 2 +- .../FeignMappingDefaultConfiguration.java | 2 +- .../storage/{ => client}/StorageServiceClient.java | 2 +- .../StorageServiceClientConfiguration.java | 2 +- .../{ => client}/StorageServiceClientFallback.java | 2 +- .../StorageServiceClientApplicationTests.java | 6 +++++- .../StorageServiceClientFallbackTest.java | 13 +------------ .../{ => client}/StorageServiceClientTest.java | 5 +---- .../StorageServiceClientTestApplication.java | 2 +- storage-service/pom.xml | 2 +- .../storage/{ => service}/ApartmentRecord.java | 2 +- .../storage/{ => service}/ApartmentRepository.java | 2 +- .../storage/{ => service}/RepositoryConfig.java | 2 +- .../{ => service}/StorageServiceApplication.java | 2 +- .../StorageServiceApplicationTests.java | 2 +- 21 files changed, 28 insertions(+), 38 deletions(-) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/Apartment.java (91%) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/EnableStorageServiceClient.java (95%) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/FeignMappingDefaultConfiguration.java (96%) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/StorageServiceClient.java (96%) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientConfiguration.java (88%) rename storage-service-client/src/main/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientFallback.java (95%) rename storage-service-client/src/test/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientApplicationTests.java (66%) rename storage-service-client/src/test/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientFallbackTest.java (76%) rename storage-service-client/src/test/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientTest.java (97%) rename storage-service-client/src/test/java/com/lohika/jclub/storage/{ => client}/StorageServiceClientTestApplication.java (89%) rename storage-service/src/main/java/com/lohika/jclub/storage/{ => service}/ApartmentRecord.java (92%) rename storage-service/src/main/java/com/lohika/jclub/storage/{ => service}/ApartmentRepository.java (89%) rename storage-service/src/main/java/com/lohika/jclub/storage/{ => service}/RepositoryConfig.java (91%) rename storage-service/src/main/java/com/lohika/jclub/storage/{ => service}/StorageServiceApplication.java (90%) rename storage-service/src/test/java/com/lohika/jclub/storage/{ => service}/StorageServiceApplicationTests.java (88%) diff --git a/api-gateway-service/pom.xml b/api-gateway-service/pom.xml index 0eea919..9a6df66 100644 --- a/api-gateway-service/pom.xml +++ b/api-gateway-service/pom.xml @@ -22,7 +22,7 @@ UTF-8 UTF-8 1.8 - Dalston.SR1 + Dalston.RELEASE diff --git a/realtor-service/pom.xml b/realtor-service/pom.xml index 74f48b1..1a2677c 100644 --- a/realtor-service/pom.xml +++ b/realtor-service/pom.xml @@ -8,7 +8,7 @@ 0.0.1-SNAPSHOT jar - realtor-service + Realtor service Demo project for Spring Boot @@ -50,7 +50,7 @@ spring-cloud-starter-feign - com.lohika.jclub.storage + com.lohika.jclub.storage.client storage-service-client 0.0.1-SNAPSHOT diff --git a/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorController.java b/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorController.java index d3dbeed..9e43a1c 100644 --- a/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorController.java +++ b/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorController.java @@ -2,8 +2,8 @@ import lombok.extern.slf4j.Slf4j; -import com.lohika.jclub.storage.Apartment; -import com.lohika.jclub.storage.StorageServiceClient; +import com.lohika.jclub.storage.client.Apartment; +import com.lohika.jclub.storage.client.StorageServiceClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cloud.client.ServiceInstance; diff --git a/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorServiceApplication.java b/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorServiceApplication.java index 71bb0fb..e3fb957 100644 --- a/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorServiceApplication.java +++ b/realtor-service/src/main/java/com/lohika/jclub/realtor/RealtorServiceApplication.java @@ -1,7 +1,7 @@ package com.lohika.jclub.realtor; -import com.lohika.jclub.storage.EnableStorageServiceClient; +import com.lohika.jclub.storage.client.EnableStorageServiceClient; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/storage-service-client/pom.xml b/storage-service-client/pom.xml index 94ab701..f849642 100644 --- a/storage-service-client/pom.xml +++ b/storage-service-client/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.lohika.jclub.storage + com.lohika.jclub.storage.client storage-service-client 0.0.1-SNAPSHOT jar @@ -61,7 +61,7 @@ test - com.lohika.jclub.storage + com.lohika.jclub.storage.service storage-service 0.0.1-SNAPSHOT test diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/Apartment.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/Apartment.java similarity index 91% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/Apartment.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/Apartment.java index c5c06d5..a588098 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/Apartment.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/Apartment.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/EnableStorageServiceClient.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/EnableStorageServiceClient.java similarity index 95% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/EnableStorageServiceClient.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/EnableStorageServiceClient.java index 5973cc5..7acaa50 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/EnableStorageServiceClient.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/EnableStorageServiceClient.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.netflix.feign.EnableFeignClients; diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/FeignMappingDefaultConfiguration.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/FeignMappingDefaultConfiguration.java similarity index 96% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/FeignMappingDefaultConfiguration.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/FeignMappingDefaultConfiguration.java index 31b8269..d4f9a02 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/FeignMappingDefaultConfiguration.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/FeignMappingDefaultConfiguration.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import feign.Feign; diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClient.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClient.java similarity index 96% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClient.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClient.java index e5ae4f2..464592f 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClient.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClient.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.hateoas.PagedResources; diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientConfiguration.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientConfiguration.java similarity index 88% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientConfiguration.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientConfiguration.java index 289350f..858fb37 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientConfiguration.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientConfiguration.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientFallback.java b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientFallback.java similarity index 95% rename from storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientFallback.java rename to storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientFallback.java index 0b776a4..4ec6e89 100644 --- a/storage-service-client/src/main/java/com/lohika/jclub/storage/StorageServiceClientFallback.java +++ b/storage-service-client/src/main/java/com/lohika/jclub/storage/client/StorageServiceClientFallback.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import lombok.extern.slf4j.Slf4j; diff --git a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientApplicationTests.java b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientApplicationTests.java similarity index 66% rename from storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientApplicationTests.java rename to storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientApplicationTests.java index f891d7c..6873674 100644 --- a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientApplicationTests.java +++ b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientApplicationTests.java @@ -1,7 +1,8 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -9,6 +10,9 @@ @SpringBootTest(classes = StorageServiceClientTestApplication.class) public class StorageServiceClientApplicationTests { + @Autowired + private StorageServiceClientFallback storageServiceClientFallback; + @Test public void contextLoads() { } diff --git a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientFallbackTest.java b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientFallbackTest.java similarity index 76% rename from storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientFallbackTest.java rename to storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientFallbackTest.java index 84586b0..5e388ba 100644 --- a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientFallbackTest.java +++ b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientFallbackTest.java @@ -1,14 +1,11 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; -import org.junit.ClassRule; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.hateoas.PagedResources; import org.springframework.test.context.junit4.SpringRunner; -import org.testcontainers.containers.GenericContainer; -import org.testcontainers.containers.wait.LogMessageWaitStrategy; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.notNullValue; @@ -19,17 +16,9 @@ @SpringBootTest(classes = StorageServiceClientTestApplication.class) public class StorageServiceClientFallbackTest { - @ClassRule - public static GenericContainer storageService = new GenericContainer("storage-service:latest") - .withExposedPorts(8091) - .waitingFor(new LogMessageWaitStrategy().withRegEx(".*Started StorageServiceApplication in.*\\s")); - @Autowired private StorageServiceClient storageServiceClient; - @Autowired - private StorageServiceClientFallback storageServiceClientFallback; - private Apartment apartment = Apartment.builder() .location("location") .mail("mail") diff --git a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTest.java b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTest.java similarity index 97% rename from storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTest.java rename to storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTest.java index 5291213..95eebe4 100644 --- a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTest.java +++ b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTest.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.junit.ClassRule; import org.junit.Test; @@ -33,9 +33,6 @@ public class StorageServiceClientTest { @Autowired private StorageServiceClient storageServiceClient; - @Autowired - private StorageServiceClientFallback storageServiceClientFallback; - private Apartment apartment = Apartment.builder() .location("location") .mail("mail") diff --git a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTestApplication.java b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTestApplication.java similarity index 89% rename from storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTestApplication.java rename to storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTestApplication.java index 80b7260..e763567 100644 --- a/storage-service-client/src/test/java/com/lohika/jclub/storage/StorageServiceClientTestApplication.java +++ b/storage-service-client/src/test/java/com/lohika/jclub/storage/client/StorageServiceClientTestApplication.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.client; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/storage-service/pom.xml b/storage-service/pom.xml index 40419b6..230df06 100644 --- a/storage-service/pom.xml +++ b/storage-service/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.lohika.jclub.storage + com.lohika.jclub.storage.service storage-service 0.0.1-SNAPSHOT jar diff --git a/storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRecord.java b/storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRecord.java similarity index 92% rename from storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRecord.java rename to storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRecord.java index 9a7fdcf..964d17f 100644 --- a/storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRecord.java +++ b/storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRecord.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.service; import lombok.*; diff --git a/storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRepository.java b/storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRepository.java similarity index 89% rename from storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRepository.java rename to storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRepository.java index ae81947..2f210d1 100644 --- a/storage-service/src/main/java/com/lohika/jclub/storage/ApartmentRepository.java +++ b/storage-service/src/main/java/com/lohika/jclub/storage/service/ApartmentRepository.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.service; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; diff --git a/storage-service/src/main/java/com/lohika/jclub/storage/RepositoryConfig.java b/storage-service/src/main/java/com/lohika/jclub/storage/service/RepositoryConfig.java similarity index 91% rename from storage-service/src/main/java/com/lohika/jclub/storage/RepositoryConfig.java rename to storage-service/src/main/java/com/lohika/jclub/storage/service/RepositoryConfig.java index 76cfd53..cb63d72 100644 --- a/storage-service/src/main/java/com/lohika/jclub/storage/RepositoryConfig.java +++ b/storage-service/src/main/java/com/lohika/jclub/storage/service/RepositoryConfig.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.service; import org.springframework.context.annotation.Configuration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; diff --git a/storage-service/src/main/java/com/lohika/jclub/storage/StorageServiceApplication.java b/storage-service/src/main/java/com/lohika/jclub/storage/service/StorageServiceApplication.java similarity index 90% rename from storage-service/src/main/java/com/lohika/jclub/storage/StorageServiceApplication.java rename to storage-service/src/main/java/com/lohika/jclub/storage/service/StorageServiceApplication.java index 3833b1a..2e6710c 100644 --- a/storage-service/src/main/java/com/lohika/jclub/storage/StorageServiceApplication.java +++ b/storage-service/src/main/java/com/lohika/jclub/storage/service/StorageServiceApplication.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.service; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/storage-service/src/test/java/com/lohika/jclub/storage/StorageServiceApplicationTests.java b/storage-service/src/test/java/com/lohika/jclub/storage/service/StorageServiceApplicationTests.java similarity index 88% rename from storage-service/src/test/java/com/lohika/jclub/storage/StorageServiceApplicationTests.java rename to storage-service/src/test/java/com/lohika/jclub/storage/service/StorageServiceApplicationTests.java index 9badba4..aabb160 100644 --- a/storage-service/src/test/java/com/lohika/jclub/storage/StorageServiceApplicationTests.java +++ b/storage-service/src/test/java/com/lohika/jclub/storage/service/StorageServiceApplicationTests.java @@ -1,4 +1,4 @@ -package com.lohika.jclub.storage; +package com.lohika.jclub.storage.service; import org.junit.Test; import org.junit.runner.RunWith;