From 93af4cb2c42d739cbdfcc4598fbe33df39867176 Mon Sep 17 00:00:00 2001 From: alexandr cumarav Date: Mon, 4 Sep 2023 12:05:58 +0200 Subject: [PATCH] GH2883 Move ServiceInfo Model to common-service-core Signed-off-by: alexandr cumarav --- .../java/org/zowe/apiml}/services/ServiceInfo.java | 12 +++++++++++- .../apiml/gateway/services/ServerInfoConfig.java | 1 - .../gateway/services/ServicesInfoController.java | 7 +++---- .../apiml/gateway}/services/ServicesInfoService.java | 3 ++- .../gateway/services/ServicesInfoControllerTest.java | 7 +++---- .../gateway}/services/ServicesInfoServiceTest.java | 3 ++- 6 files changed, 21 insertions(+), 12 deletions(-) rename {apiml-common/src/main/java/org/zowe/apiml/product => common-service-core/src/main/java/org/zowe/apiml}/services/ServiceInfo.java (87%) rename {apiml-common/src/main/java/org/zowe/apiml/product => gateway-service/src/main/java/org/zowe/apiml/gateway}/services/ServicesInfoService.java (99%) rename {apiml-common/src/test/java/org/zowe/apiml/product => gateway-service/src/test/java/org/zowe/apiml/gateway}/services/ServicesInfoServiceTest.java (99%) diff --git a/apiml-common/src/main/java/org/zowe/apiml/product/services/ServiceInfo.java b/common-service-core/src/main/java/org/zowe/apiml/services/ServiceInfo.java similarity index 87% rename from apiml-common/src/main/java/org/zowe/apiml/product/services/ServiceInfo.java rename to common-service-core/src/main/java/org/zowe/apiml/services/ServiceInfo.java index c91d606d27..2246967c6c 100644 --- a/apiml-common/src/main/java/org/zowe/apiml/product/services/ServiceInfo.java +++ b/common-service-core/src/main/java/org/zowe/apiml/services/ServiceInfo.java @@ -8,13 +8,15 @@ * Copyright Contributors to the Zowe Project. */ -package org.zowe.apiml.product.services; +package org.zowe.apiml.services; import com.fasterxml.jackson.annotation.JsonInclude; import com.netflix.appinfo.InstanceInfo; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; import org.zowe.apiml.auth.Authentication; import org.zowe.apiml.config.ApiInfo; @@ -31,6 +33,8 @@ public class ServiceInfo { private Apiml apiml; private Map instances; + @NoArgsConstructor + @AllArgsConstructor @Data @Builder @JsonInclude(JsonInclude.Include.NON_NULL) @@ -40,6 +44,8 @@ public static class Apiml { private List authentication; } + @NoArgsConstructor + @AllArgsConstructor @Data @Builder @JsonInclude(JsonInclude.Include.NON_NULL) @@ -55,6 +61,8 @@ public static class Instances { private Map customMetadata; } + @NoArgsConstructor + @AllArgsConstructor @Data @Builder @JsonInclude(JsonInclude.Include.NON_NULL) @@ -64,6 +72,8 @@ public static class Service { private String homePageUrl; } + @NoArgsConstructor + @AllArgsConstructor @Data @SuperBuilder @EqualsAndHashCode(callSuper = true) diff --git a/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServerInfoConfig.java b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServerInfoConfig.java index de0ee3f94f..816adeaf96 100644 --- a/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServerInfoConfig.java +++ b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServerInfoConfig.java @@ -16,7 +16,6 @@ import org.zowe.apiml.eurekaservice.client.util.EurekaMetadataParser; import org.zowe.apiml.product.gateway.GatewayConfigProperties; import org.zowe.apiml.product.routing.transform.TransformService; -import org.zowe.apiml.product.services.ServicesInfoService; @Configuration public class ServerInfoConfig { diff --git a/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoController.java b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoController.java index e81da26350..513a5df9f8 100644 --- a/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoController.java +++ b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoController.java @@ -22,13 +22,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import org.zowe.apiml.product.services.ServiceInfo; -import org.zowe.apiml.product.services.ServicesInfoService; +import org.zowe.apiml.services.ServiceInfo; import java.util.List; -import static org.zowe.apiml.product.services.ServicesInfoService.CURRENT_VERSION; -import static org.zowe.apiml.product.services.ServicesInfoService.VERSION_HEADER; +import static org.zowe.apiml.gateway.services.ServicesInfoService.CURRENT_VERSION; +import static org.zowe.apiml.gateway.services.ServicesInfoService.VERSION_HEADER; @RestController diff --git a/apiml-common/src/main/java/org/zowe/apiml/product/services/ServicesInfoService.java b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoService.java similarity index 99% rename from apiml-common/src/main/java/org/zowe/apiml/product/services/ServicesInfoService.java rename to gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoService.java index 45280f5491..b1a1e456b8 100644 --- a/apiml-common/src/main/java/org/zowe/apiml/product/services/ServicesInfoService.java +++ b/gateway-service/src/main/java/org/zowe/apiml/gateway/services/ServicesInfoService.java @@ -8,7 +8,7 @@ * Copyright Contributors to the Zowe Project. */ -package org.zowe.apiml.product.services; +package org.zowe.apiml.gateway.services; import com.fasterxml.jackson.core.Version; import com.netflix.appinfo.InstanceInfo; @@ -26,6 +26,7 @@ import org.zowe.apiml.product.routing.ServiceType; import org.zowe.apiml.product.routing.transform.TransformService; import org.zowe.apiml.product.routing.transform.URLTransformationException; +import org.zowe.apiml.services.ServiceInfo; import java.util.AbstractMap; import java.util.ArrayList; diff --git a/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoControllerTest.java b/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoControllerTest.java index 9b74508175..e2da7ce804 100644 --- a/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoControllerTest.java +++ b/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoControllerTest.java @@ -16,8 +16,7 @@ import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.http.HttpStatus; -import org.zowe.apiml.product.services.ServiceInfo; -import org.zowe.apiml.product.services.ServicesInfoService; +import org.zowe.apiml.services.ServiceInfo; import java.util.Arrays; import java.util.Collections; @@ -26,8 +25,8 @@ import static org.hamcrest.core.Is.is; import static org.mockito.Mockito.when; import static org.zowe.apiml.gateway.services.ServicesInfoController.SERVICES_URL; -import static org.zowe.apiml.product.services.ServicesInfoService.CURRENT_VERSION; -import static org.zowe.apiml.product.services.ServicesInfoService.VERSION_HEADER; +import static org.zowe.apiml.gateway.services.ServicesInfoService.CURRENT_VERSION; +import static org.zowe.apiml.gateway.services.ServicesInfoService.VERSION_HEADER; @ExtendWith(MockitoExtension.class) class ServicesInfoControllerTest { diff --git a/apiml-common/src/test/java/org/zowe/apiml/product/services/ServicesInfoServiceTest.java b/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoServiceTest.java similarity index 99% rename from apiml-common/src/test/java/org/zowe/apiml/product/services/ServicesInfoServiceTest.java rename to gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoServiceTest.java index 524cf037b8..cef263b858 100644 --- a/apiml-common/src/test/java/org/zowe/apiml/product/services/ServicesInfoServiceTest.java +++ b/gateway-service/src/test/java/org/zowe/apiml/gateway/services/ServicesInfoServiceTest.java @@ -8,7 +8,7 @@ * Copyright Contributors to the Zowe Project. */ -package org.zowe.apiml.product.services; +package org.zowe.apiml.gateway.services; import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.EurekaClient; @@ -27,6 +27,7 @@ import org.zowe.apiml.product.gateway.GatewayClient; import org.zowe.apiml.product.gateway.GatewayConfigProperties; import org.zowe.apiml.product.routing.transform.TransformService; +import org.zowe.apiml.services.ServiceInfo; import java.util.Arrays; import java.util.Collections;