diff options
58 files changed, 264 insertions, 298 deletions
diff --git a/app/build.gradle b/app/build.gradle index 7ad65cd..4305de0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,15 +19,11 @@ configurations { } } -// repositories { -// mavenCentral() -// } - dependencies { implementation project(':openapi:server') - implementation project(':openapi:client-portal-history') - implementation project(':openapi:client-portal-prefs') - implementation project(':openapi:client-portal-keycloak') + implementation project(':openapi:client-history') + implementation project(':openapi:client-preferences') + implementation project(':openapi:client-keycloak') implementation project(':lib') implementation 'org.springframework.boot:spring-boot-starter-webflux' diff --git a/app/src/main/resources/application-access-control.yml b/app/src/main/resources/application-access-control.yml index 450ab8a..ac83409 100644 --- a/app/src/main/resources/application-access-control.yml +++ b/app/src/main/resources/application-access-control.yml @@ -9,8 +9,6 @@ bff.access-control: PREFERENCES_GET: [onap_admin, onap_designer, onap_operator] PREFERENCES_UPDATE: [onap_admin, onap_designer, onap_operator] ROLE_LIST: ["*"] - TILE_GET: [onap_admin, onap_designer, onap_operator] - TILE_LIST: [onap_admin, onap_designer, onap_operator] USER_CREATE: [onap_admin, onap_designer, onap_operator] USER_DELETE: [onap_admin, onap_designer, onap_operator] USER_GET: [onap_admin, onap_designer, onap_operator] diff --git a/app/src/main/resources/application-development.yml b/app/src/main/resources/application-development.yml index c7e869f..e5de9be 100644 --- a/app/src/main/resources/application-development.yml +++ b/app/src/main/resources/application-development.yml @@ -24,7 +24,6 @@ management: bff: realm: ONAP - portal-prefs-url: ${PORTAL_PREFS_URL} - portal-history-url: ${PORTAL_HISTORY_URL} + preferences-url: ${PREFERENCES_URL} + history-url: ${PORTAL_HISTORY_URL} keycloak-url: ${KEYCLOAK_URL} - instance-id: PORTAL diff --git a/app/src/main/resources/application-local.yml b/app/src/main/resources/application-local.yml index 0cb6e6b..2eb3278 100644 --- a/app/src/main/resources/application-local.yml +++ b/app/src/main/resources/application-local.yml @@ -24,10 +24,9 @@ management: bff: realm: ONAP - portal-prefs-url: http://localhost:9001 - portal-history-url: http://localhost:9002 + preferences-url: http://localhost:9001 + history-url: http://localhost:9002 keycloak-url: http://localhost:8080/ - instance-id: PORTAL logging: level: diff --git a/app/src/main/resources/application.yml b/app/src/main/resources/application.yml index 6e74453..2d09bbb 100644 --- a/app/src/main/resources/application.yml +++ b/app/src/main/resources/application.yml @@ -42,8 +42,7 @@ spring: bff: realm: ${KEYCLOAK_REALM} - portal-prefs-url: ${PORTAL_PREFS_URL} - portal-history-url: ${PORTAL_HISTORY_URL} + preferences-url: ${PREFERENCES_URL} + history-url: ${PORTAL_HISTORY_URL} keycloak-url: ${KEYCLOAK_URL} - instance-id: PORTAL diff --git a/app/src/test/java/org/onap/portalng/bff/actions/ActionFixtures.java b/app/src/test/java/org/onap/portalng/bff/actions/ActionFixtures.java index 0acd0eb..0ca28bf 100644 --- a/app/src/test/java/org/onap/portalng/bff/actions/ActionFixtures.java +++ b/app/src/test/java/org/onap/portalng/bff/actions/ActionFixtures.java @@ -23,27 +23,27 @@ package org.onap.portalng.bff.actions; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.CreateActionRequestPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.CreateActionRequestHistoryDto; import org.onap.portalng.bff.openapi.server.model.CreateActionRequestApiDto; public class ActionFixtures { - public static ActionsListResponsePortalHistoryDto generateActionsListResponse( + public static ActionsListResponseHistoryDto generateActionsListResponse( Integer numberOfActions, Integer totalCount, OffsetDateTime createdAt) { - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto = - new ActionsListResponsePortalHistoryDto(); + ActionsListResponseHistoryDto actionsListResponseHistoryDto = + new ActionsListResponseHistoryDto(); for (Integer i = 0; i < numberOfActions; i++) { - actionsListResponsePortalHistoryDto.addActionsListItem( + actionsListResponseHistoryDto.addActionsListItem( generateActionResponse( "Instantiation", "create", null, i.toString(), "SO", i, createdAt)); } - actionsListResponsePortalHistoryDto.setTotalCount(totalCount); - return actionsListResponsePortalHistoryDto; + actionsListResponseHistoryDto.setTotalCount(totalCount); + return actionsListResponseHistoryDto; } - public static ActionResponsePortalHistoryDto generateActionResponse( + public static ActionResponseHistoryDto generateActionResponse( String type, String action, String message, @@ -58,12 +58,12 @@ public class ActionFixtures { actionDto.setDownStreamSystem(downStreamSystem); actionDto.setDownStreamId(id); - return new ActionResponsePortalHistoryDto() + return new ActionResponseHistoryDto() .action(actionDto) .actionCreatedAt(createdAt.minus(deltaHours, ChronoUnit.HOURS)); } - public static CreateActionRequestPortalHistoryDto generateActionRequestPortalHistoryDto( + public static CreateActionRequestHistoryDto generateActionRequestHistoryDto( String type, String action, String message, @@ -77,7 +77,7 @@ public class ActionFixtures { actionDto.setMessage(message); actionDto.setDownStreamSystem(downStreamSystem); actionDto.setDownStreamId(id); - return new CreateActionRequestPortalHistoryDto() + return new CreateActionRequestHistoryDto() .action(actionDto) .actionCreatedAt(createdAt) .userId(userId); diff --git a/app/src/test/java/org/onap/portalng/bff/actions/ActionsMocks.java b/app/src/test/java/org/onap/portalng/bff/actions/ActionsMocks.java index aa9e2f3..39fc3dc 100644 --- a/app/src/test/java/org/onap/portalng/bff/actions/ActionsMocks.java +++ b/app/src/test/java/org/onap/portalng/bff/actions/ActionsMocks.java @@ -27,9 +27,9 @@ import com.github.tomakehurst.wiremock.matching.EqualToPattern; import io.restassured.http.Header; import org.apache.http.HttpHeaders; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.ProblemPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ProblemHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ActionsResponseApiDto; import org.onap.portalng.bff.openapi.server.model.CreateActionRequestApiDto; @@ -56,16 +56,15 @@ public class ActionsMocks extends BaseIntegrationTest { } // used for test thatActionsListCanBeRetrieved - protected void mockListActions( - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto) throws Exception { + protected void mockListActions(ActionsListResponseHistoryDto actionsListResponseHistoryDto) + throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/actions?page=1&pageSize=10")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody( - objectMapper.writeValueAsString(actionsListResponsePortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(actionsListResponseHistoryDto)))); } // used for test thatActionsListCanNotBeRetrieved @@ -84,8 +83,7 @@ public class ActionsMocks extends BaseIntegrationTest { } // used for test thatActionsListCanNotBeRetrieved - protected void mockListActionsProblem(ProblemPortalHistoryDto problemPortalHistoryDto) - throws Exception { + protected void mockListActionsProblem(ProblemHistoryDto problemHistoryDto) throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/actions?page=1&pageSize=10")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) @@ -93,12 +91,12 @@ public class ActionsMocks extends BaseIntegrationTest { WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PROBLEM_JSON_VALUE) .withStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()) - .withBody(objectMapper.writeValueAsString(problemPortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(problemHistoryDto)))); } // used for test thatActionCanBeRetrieved protected void mockGetActions( - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto, + ActionsListResponseHistoryDto actionsListResponseHistoryDto, String userId, Integer showLastHours) throws Exception { @@ -114,8 +112,7 @@ public class ActionsMocks extends BaseIntegrationTest { .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody( - objectMapper.writeValueAsString(actionsListResponsePortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(actionsListResponseHistoryDto)))); } // used for test thatActionCanBeRetrieved protected ActionsListResponseApiDto getActions(String userId) { @@ -134,16 +131,14 @@ public class ActionsMocks extends BaseIntegrationTest { // used for test thatActionCanBeRetrievedWithoutParameterShowLastHours protected void mockGetActionsWithoutParameterShowLastHours( - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto, String userId) - throws Exception { + ActionsListResponseHistoryDto actionsListResponseHistoryDto, String userId) throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/actions/" + userId + "?page=1&pageSize=10")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody( - objectMapper.writeValueAsString(actionsListResponsePortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(actionsListResponseHistoryDto)))); } // used for test thatActionCanBeRetrievedWithoutParameterShowLastHours protected ActionsListResponseApiDto getActionsWithoutParameterShowLastHours(String userId) { @@ -161,8 +156,7 @@ public class ActionsMocks extends BaseIntegrationTest { } // Used for thatActionCanBeCreated - protected void mockCreateActions( - String userId, ActionResponsePortalHistoryDto actionResponsePortalHistoryDto) + protected void mockCreateActions(String userId, ActionResponseHistoryDto actionResponseHistoryDto) throws Exception { WireMock.stubFor( WireMock.post(WireMock.urlEqualTo("/v1/actions/" + userId)) @@ -172,7 +166,7 @@ public class ActionsMocks extends BaseIntegrationTest { WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .withStatus(200) - .withBody(objectMapper.writeValueAsString(actionResponsePortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(actionResponseHistoryDto)))); } // Used for thatActionCanBeCreated @@ -194,8 +188,7 @@ public class ActionsMocks extends BaseIntegrationTest { } // Used for thatActionCanNotBeCreated - protected void mockCreateActionsProblem( - String userId, ProblemPortalHistoryDto problemPortalHistoryDto) + protected void mockCreateActionsProblem(String userId, ProblemHistoryDto problemHistoryDto) throws JsonProcessingException { WireMock.stubFor( WireMock.post(WireMock.urlEqualTo("/v1/actions/" + userId)) @@ -205,7 +198,7 @@ public class ActionsMocks extends BaseIntegrationTest { WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PROBLEM_JSON_VALUE) .withStatus(500) - .withBody(objectMapper.writeValueAsString(problemPortalHistoryDto)))); + .withBody(objectMapper.writeValueAsString(problemHistoryDto)))); } // Used for thatActionCanNotBeCreated protected ProblemApiDto createActionProblem( diff --git a/app/src/test/java/org/onap/portalng/bff/actions/CreateActionsIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/actions/CreateActionsIntegrationTest.java index 3508f19..748d568 100644 --- a/app/src/test/java/org/onap/portalng/bff/actions/CreateActionsIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/actions/CreateActionsIntegrationTest.java @@ -26,8 +26,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.OffsetDateTime; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.ProblemPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ProblemHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsResponseApiDto; import org.onap.portalng.bff.openapi.server.model.CreateActionRequestApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; @@ -39,21 +39,21 @@ class CreateActionsIntegrationTest extends ActionsMocks { void thatActionCanBeCreated() throws Exception { String userId = "22-33-44-55"; OffsetDateTime createdAt = OffsetDateTime.now(); - ActionResponsePortalHistoryDto actionResponsePortalHistoryDto = + ActionResponseHistoryDto actionResponseHistoryDto = ActionFixtures.generateActionResponse( "Instantiation", "create", "no detail message", "223344", "SO", 0, createdAt); CreateActionRequestApiDto createActionDto = ActionFixtures.generateCreateActionRequestApiDto( "Instantiation", "create", "no detail message", "223344", "SO", userId, createdAt); - mockCreateActions(userId, actionResponsePortalHistoryDto); + mockCreateActions(userId, actionResponseHistoryDto); final ActionsResponseApiDto response = createAction(createActionDto, userId); assertThat(response.getActionCreatedAt()) - .isEqualTo(actionResponsePortalHistoryDto.getActionCreatedAt()); + .isEqualTo(actionResponseHistoryDto.getActionCreatedAt()); Assertions.assertThat(objectMapper.writeValueAsString(response.getAction())) - .isEqualTo(objectMapper.writeValueAsString(actionResponsePortalHistoryDto.getAction())); + .isEqualTo(objectMapper.writeValueAsString(actionResponseHistoryDto.getAction())); } @Test @@ -61,18 +61,18 @@ class CreateActionsIntegrationTest extends ActionsMocks { String userId = "22-33-44-55"; OffsetDateTime createdAt = OffsetDateTime.now(); - ProblemPortalHistoryDto problemPortalHistoryDto = - new ProblemPortalHistoryDto() + ProblemHistoryDto problemHistoryDto = + new ProblemHistoryDto() .status(HttpStatus.INTERNAL_SERVER_ERROR.value()) .detail("Internal database error") .title("Internal Server Error") - .instance("portal-history"); + .instance("history"); CreateActionRequestApiDto createActionDto = ActionFixtures.generateCreateActionRequestApiDto( "Instantiation", "create", "no detail message", "223344", "SO", userId, createdAt); - mockCreateActionsProblem(userId, problemPortalHistoryDto); + mockCreateActionsProblem(userId, problemHistoryDto); final ProblemApiDto response = createActionProblem(createActionDto, userId); @@ -80,6 +80,6 @@ class CreateActionsIntegrationTest extends ActionsMocks { .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY); assertThat(response.getDownstreamStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.value()); - assertThat(response.getDetail()).isEqualTo(problemPortalHistoryDto.getDetail()); + assertThat(response.getDetail()).isEqualTo(problemHistoryDto.getDetail()); } } diff --git a/app/src/test/java/org/onap/portalng/bff/actions/GetActionsIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/actions/GetActionsIntegrationTest.java index 489a8d3..90c065e 100644 --- a/app/src/test/java/org/onap/portalng/bff/actions/GetActionsIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/actions/GetActionsIntegrationTest.java @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.OffsetDateTime; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; class GetActionsIntegrationTest extends ActionsMocks { @@ -36,22 +36,21 @@ class GetActionsIntegrationTest extends ActionsMocks { Integer showLastHours = 2; String userId = "22-33-44-55"; OffsetDateTime createdAt = OffsetDateTime.now(); - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto = + ActionsListResponseHistoryDto actionsListResponseHistoryDto = ActionFixtures.generateActionsListResponse(numberOfActions, 30, createdAt); - mockGetActions(actionsListResponsePortalHistoryDto, userId, showLastHours); + mockGetActions(actionsListResponseHistoryDto, userId, showLastHours); final ActionsListResponseApiDto response = getActions(userId); assertThat(response.getTotalCount()).isEqualTo(30); assertThat(response.getItems()).hasSize(numberOfActions); assertThat(response.getItems().get(0).getActionCreatedAt()) - .isEqualTo( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getActionCreatedAt()); + .isEqualTo(actionsListResponseHistoryDto.getActionsList().get(0).getActionCreatedAt()); assertThat(objectMapper.writeValueAsString(response.getItems().get(0).getAction())) .isEqualTo( objectMapper.writeValueAsString( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getAction())); + actionsListResponseHistoryDto.getActionsList().get(0).getAction())); } @Test @@ -59,21 +58,20 @@ class GetActionsIntegrationTest extends ActionsMocks { int numberOfActions = 10; String userId = "22-33-44-55"; OffsetDateTime createdAt = OffsetDateTime.now(); - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto = + ActionsListResponseHistoryDto actionsListResponseHistoryDto = ActionFixtures.generateActionsListResponse(numberOfActions, 30, createdAt); - mockGetActionsWithoutParameterShowLastHours(actionsListResponsePortalHistoryDto, userId); + mockGetActionsWithoutParameterShowLastHours(actionsListResponseHistoryDto, userId); final ActionsListResponseApiDto response = getActionsWithoutParameterShowLastHours(userId); assertThat(response.getTotalCount()).isEqualTo(30); assertThat(response.getItems()).hasSize(numberOfActions); assertThat(response.getItems().get(0).getActionCreatedAt()) - .isEqualTo( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getActionCreatedAt()); + .isEqualTo(actionsListResponseHistoryDto.getActionsList().get(0).getActionCreatedAt()); assertThat(objectMapper.writeValueAsString(response.getItems().get(0).getAction())) .isEqualTo( objectMapper.writeValueAsString( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getAction())); + actionsListResponseHistoryDto.getActionsList().get(0).getAction())); } } diff --git a/app/src/test/java/org/onap/portalng/bff/actions/ListActionsIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/actions/ListActionsIntegrationTest.java index 8451641..5acc4f4 100644 --- a/app/src/test/java/org/onap/portalng/bff/actions/ListActionsIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/actions/ListActionsIntegrationTest.java @@ -26,8 +26,8 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.OffsetDateTime; import org.assertj.core.api.Assertions; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; -import org.onap.portalng.bff.openapi.client_portal_history.model.ProblemPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ProblemHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.http.HttpStatus; @@ -38,41 +38,40 @@ class ListActionsIntegrationTest extends ActionsMocks { void thatActionsListCanBeRetrieved() throws Exception { int numberOfActions = 10; OffsetDateTime createdAt = OffsetDateTime.now(); - ActionsListResponsePortalHistoryDto actionsListResponsePortalHistoryDto = + ActionsListResponseHistoryDto actionsListResponseHistoryDto = ActionFixtures.generateActionsListResponse(numberOfActions, 1000, createdAt); - mockListActions(actionsListResponsePortalHistoryDto); + mockListActions(actionsListResponseHistoryDto); final ActionsListResponseApiDto response = listActions(); assertThat(response.getTotalCount()).isEqualTo(1000); assertThat(response.getItems()).hasSize(numberOfActions); assertThat(response.getItems().get(0).getActionCreatedAt()) - .isEqualTo( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getActionCreatedAt()); + .isEqualTo(actionsListResponseHistoryDto.getActionsList().get(0).getActionCreatedAt()); Assertions.assertThat(objectMapper.writeValueAsString(response.getItems().get(0).getAction())) .isEqualTo( objectMapper.writeValueAsString( - actionsListResponsePortalHistoryDto.getActionsList().get(0).getAction())); + actionsListResponseHistoryDto.getActionsList().get(0).getAction())); } @Test void thatActionsListCanNotBeRetrieved() throws Exception { - ProblemPortalHistoryDto problemPortalHistoryDto = - new ProblemPortalHistoryDto() + ProblemHistoryDto problemHistoryDto = + new ProblemHistoryDto() .status(HttpStatus.INTERNAL_SERVER_ERROR.value()) .detail("Internal database error") .title("Internal Server Error") - .instance("portal-history"); + .instance("history"); - mockListActionsProblem(problemPortalHistoryDto); + mockListActionsProblem(problemHistoryDto); final ProblemApiDto response = listActionsProblem(); assertThat(response.getDownstreamSystem()) .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PORTAL_HISTORY); assertThat(response.getDownstreamStatus()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR.value()); - assertThat(response.getDetail()).isEqualTo(problemPortalHistoryDto.getDetail()); + assertThat(response.getDetail()).isEqualTo(problemHistoryDto.getDetail()); } } diff --git a/app/src/test/java/org/onap/portalng/bff/headers/XRequestIdHeaderTest.java b/app/src/test/java/org/onap/portalng/bff/headers/XRequestIdHeaderTest.java index 6f82308..b79537c 100644 --- a/app/src/test/java/org/onap/portalng/bff/headers/XRequestIdHeaderTest.java +++ b/app/src/test/java/org/onap/portalng/bff/headers/XRequestIdHeaderTest.java @@ -28,7 +28,7 @@ import com.github.tomakehurst.wiremock.matching.EqualToPattern; import io.restassured.http.Header; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -39,17 +39,17 @@ class XRequestIdHeaderTest extends BaseIntegrationTest { @Test void xRequestIdHeaderIsCorrectlySetInResponse() throws Exception { // use preferences endpoint for testing the header - final PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); + final PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); // mockGetTile(tileDetailResponsePortalServiceDto, X_REQUEST_ID); - mockGetPreferences(preferencesPortalPrefsDto, X_REQUEST_ID); + mockGetPreferences(preferencesPreferencesDto, X_REQUEST_ID); final String response = getPreferencesExtractHeader(X_REQUEST_ID); assertThat(response).isEqualTo(X_REQUEST_ID); } protected void mockGetPreferences( - PreferencesPortalPrefsDto preferencesPortalPrefsDto, String xRequestId) throws Exception { + PreferencesPreferencesDto preferencesPreferencesDto, String xRequestId) throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/preferences")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) @@ -57,7 +57,7 @@ class XRequestIdHeaderTest extends BaseIntegrationTest { WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .withHeader("X-Request-Id", xRequestId) - .withBody(objectMapper.writeValueAsString(preferencesPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(preferencesPreferencesDto)))); } protected String getPreferencesExtractHeader(String xRequestId) { diff --git a/app/src/test/java/org/onap/portalng/bff/preferences/CreatePreferencesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/preferences/CreatePreferencesIntegrationTest.java index 65a6f19..3b16664 100644 --- a/app/src/test/java/org/onap/portalng/bff/preferences/CreatePreferencesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/preferences/CreatePreferencesIntegrationTest.java @@ -25,8 +25,8 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import io.restassured.http.Header; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; @@ -36,8 +36,8 @@ import org.springframework.http.MediaType; class CreatePreferencesIntegrationTest extends PreferencesMocks { @Test void thatPreferencesCanBeCreated() throws Exception { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties( + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties( "{\n" + "\"properties\": {\n" + "\"appStarter\": \"value1\",\n" @@ -45,7 +45,7 @@ class CreatePreferencesIntegrationTest extends PreferencesMocks { + "}\n" + "\n" + "}"); - mockCreatePreferences(preferencesPortalPrefsDto); + mockCreatePreferences(preferencesPreferencesDto); final CreatePreferencesRequestApiDto request = new CreatePreferencesRequestApiDto() @@ -59,18 +59,18 @@ class CreatePreferencesIntegrationTest extends PreferencesMocks { + "}"); final PreferencesResponseApiDto response = createPreferences(request); assertThat(response).isNotNull(); - assertThat(response.getProperties()).isEqualTo(preferencesPortalPrefsDto.getProperties()); + assertThat(response.getProperties()).isEqualTo(preferencesPreferencesDto.getProperties()); } @Test void thatPreferencesCanNotBeCreated() throws Exception { - final var problemPortalPrefsDto = new ProblemPortalPrefsDto(); - problemPortalPrefsDto.setStatus(HttpStatus.BAD_REQUEST.value()); - problemPortalPrefsDto.setTitle(HttpStatus.BAD_REQUEST.toString()); - problemPortalPrefsDto.setDetail("Some details"); + final var problemPreferencesDto = new ProblemPreferencesDto(); + problemPreferencesDto.setStatus(HttpStatus.BAD_REQUEST.value()); + problemPreferencesDto.setTitle(HttpStatus.BAD_REQUEST.toString()); + problemPreferencesDto.setDetail("Some details"); - final PreferencesPortalPrefsDto preferencesPortalPrefsDto = - new PreferencesPortalPrefsDto() + final PreferencesPreferencesDto preferencesPreferencesDto = + new PreferencesPreferencesDto() .properties( "{\n" + "\"properties\": {\n" @@ -79,7 +79,7 @@ class CreatePreferencesIntegrationTest extends PreferencesMocks { + "}\n" + "\n" + "}"); - mockCreatePreferencesError(preferencesPortalPrefsDto, problemPortalPrefsDto); + mockCreatePreferencesError(preferencesPreferencesDto, problemPreferencesDto); CreatePreferencesRequestApiDto responseBody = new CreatePreferencesRequestApiDto() @@ -107,9 +107,9 @@ class CreatePreferencesIntegrationTest extends PreferencesMocks { .as(ProblemApiDto.class); assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_GATEWAY.value()); - assertThat(response.getDetail()).isEqualTo(problemPortalPrefsDto.getDetail()); + assertThat(response.getDetail()).isEqualTo(problemPreferencesDto.getDetail()); assertThat(response.getDownstreamSystem()) - .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS); + .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PREFERENCES); assertThat(response.getDownstreamStatus()).isEqualTo(HttpStatus.BAD_REQUEST.value()); } } diff --git a/app/src/test/java/org/onap/portalng/bff/preferences/GetPreferencesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/preferences/GetPreferencesIntegrationTest.java index 06329d4..a88a0cd 100644 --- a/app/src/test/java/org/onap/portalng/bff/preferences/GetPreferencesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/preferences/GetPreferencesIntegrationTest.java @@ -25,8 +25,8 @@ import static org.assertj.core.api.Assertions.assertThat; import io.restassured.http.Header; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.http.HttpStatus; @@ -36,9 +36,9 @@ class GetPreferencesIntegrationTest extends PreferencesMocks { @Test void thatPreferencesCanBeRetrieved() throws Exception { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties(getFixture(PREF_PROPERTIES_FILE, Object.class)); - mockGetPreferences(preferencesPortalPrefsDto); + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties(getFixture(PREF_PROPERTIES_FILE, Object.class)); + mockGetPreferences(preferencesPreferencesDto); final PreferencesResponseApiDto response = getPreferences(); assertThat(response).isNotNull(); @@ -46,8 +46,8 @@ class GetPreferencesIntegrationTest extends PreferencesMocks { @Test void thatPreferencesCanNotBeRetrieved() throws Exception { - final ProblemPortalPrefsDto problemResponse = - new ProblemPortalPrefsDto() + final ProblemPreferencesDto problemResponse = + new ProblemPreferencesDto() .title("Unauthorized") .status(HttpStatus.UNAUTHORIZED.value()) .detail("Unauthorized error detail") diff --git a/app/src/test/java/org/onap/portalng/bff/preferences/PreferencesMocks.java b/app/src/test/java/org/onap/portalng/bff/preferences/PreferencesMocks.java index 0d5b69a..9c5be75 100644 --- a/app/src/test/java/org/onap/portalng/bff/preferences/PreferencesMocks.java +++ b/app/src/test/java/org/onap/portalng/bff/preferences/PreferencesMocks.java @@ -30,8 +30,8 @@ import java.io.File; import java.io.IOException; import org.apache.http.HttpHeaders; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.springframework.http.HttpStatus; @@ -65,7 +65,7 @@ public class PreferencesMocks extends BaseIntegrationTest { .as(PreferencesResponseApiDto.class); } - protected void mockGetPreferences(PreferencesPortalPrefsDto preferencesPortalPrefsDto) + protected void mockGetPreferences(PreferencesPreferencesDto preferencesPreferencesDto) throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/preferences")) @@ -73,10 +73,10 @@ public class PreferencesMocks extends BaseIntegrationTest { .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody(objectMapper.writeValueAsString(preferencesPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(preferencesPreferencesDto)))); } - protected void mockGetPreferencesError(ProblemPortalPrefsDto problem) throws Exception { + protected void mockGetPreferencesError(ProblemPreferencesDto problem) throws Exception { WireMock.stubFor( WireMock.get(WireMock.urlEqualTo("/v1/preferences")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) @@ -104,35 +104,35 @@ public class PreferencesMocks extends BaseIntegrationTest { .as(PreferencesResponseApiDto.class); } - protected void mockCreatePreferences(PreferencesPortalPrefsDto preferencesPortalPrefsDto) + protected void mockCreatePreferences(PreferencesPreferencesDto preferencesPreferencesDto) throws Exception { WireMock.stubFor( WireMock.post(WireMock.urlEqualTo("/v1/preferences")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) .withRequestBody( WireMock.equalToJson( - objectMapper.writeValueAsString(preferencesPortalPrefsDto), true, false)) + objectMapper.writeValueAsString(preferencesPreferencesDto), true, false)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody(objectMapper.writeValueAsString(preferencesPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(preferencesPreferencesDto)))); } protected void mockCreatePreferencesError( - PreferencesPortalPrefsDto preferencesPortalPrefsDto, - ProblemPortalPrefsDto problemPortalPrefsDto) + PreferencesPreferencesDto preferencesPreferencesDto, + ProblemPreferencesDto problemPreferencesDto) throws Exception { WireMock.stubFor( WireMock.post(WireMock.urlEqualTo("/v1/preferences")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) .withRequestBody( WireMock.equalToJson( - objectMapper.writeValueAsString(preferencesPortalPrefsDto), true, false)) + objectMapper.writeValueAsString(preferencesPreferencesDto), true, false)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .withStatus(HttpStatus.BAD_REQUEST.value()) - .withBody(objectMapper.writeValueAsString(problemPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(problemPreferencesDto)))); } protected PreferencesResponseApiDto updatePreferences(CreatePreferencesRequestApiDto request) { @@ -150,33 +150,33 @@ public class PreferencesMocks extends BaseIntegrationTest { .as(PreferencesResponseApiDto.class); } - protected void mockUpdatePreferences(PreferencesPortalPrefsDto preferencesPortalPrefsDto) + protected void mockUpdatePreferences(PreferencesPreferencesDto preferencesPreferencesDto) throws Exception { WireMock.stubFor( WireMock.put(WireMock.urlEqualTo("/v1/preferences")) .withHeader("X-Request-Id", new EqualToPattern(X_REQUEST_ID)) .withRequestBody( WireMock.equalToJson( - objectMapper.writeValueAsString(preferencesPortalPrefsDto), true, false)) + objectMapper.writeValueAsString(preferencesPreferencesDto), true, false)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) - .withBody(objectMapper.writeValueAsString(preferencesPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(preferencesPreferencesDto)))); } protected void mockUpdatePreferencesError( - PreferencesPortalPrefsDto preferencesPortalPrefsDto, - ProblemPortalPrefsDto problemPortalPrefsDto) + PreferencesPreferencesDto preferencesPreferencesDto, + ProblemPreferencesDto problemPreferencesDto) throws Exception { WireMock.stubFor( WireMock.put(WireMock.urlEqualTo("/v1/preferences")) .withRequestBody( WireMock.equalToJson( - objectMapper.writeValueAsString(preferencesPortalPrefsDto), true, false)) + objectMapper.writeValueAsString(preferencesPreferencesDto), true, false)) .willReturn( WireMock.aResponse() .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE) .withStatus(HttpStatus.BAD_REQUEST.value()) - .withBody(objectMapper.writeValueAsString(problemPortalPrefsDto)))); + .withBody(objectMapper.writeValueAsString(problemPreferencesDto)))); } } diff --git a/app/src/test/java/org/onap/portalng/bff/preferences/UpdatePreferencesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/preferences/UpdatePreferencesIntegrationTest.java index 031726e..1cd9a70 100644 --- a/app/src/test/java/org/onap/portalng/bff/preferences/UpdatePreferencesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/preferences/UpdatePreferencesIntegrationTest.java @@ -25,8 +25,8 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThat; import io.restassured.http.Header; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; @@ -36,8 +36,8 @@ import org.springframework.http.MediaType; class UpdatePreferencesIntegrationTest extends PreferencesMocks { @Test void thatPreferencesCanBeUpdated() throws Exception { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties( + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties( "{\n" + "\"properties\": {\n" + "\"appStarter\": \"value1\",\n" @@ -45,7 +45,7 @@ class UpdatePreferencesIntegrationTest extends PreferencesMocks { + "}\n" + "\n" + "}"); - mockUpdatePreferences(preferencesPortalPrefsDto); + mockUpdatePreferences(preferencesPreferencesDto); final CreatePreferencesRequestApiDto requestApiDto = new CreatePreferencesRequestApiDto() @@ -59,18 +59,18 @@ class UpdatePreferencesIntegrationTest extends PreferencesMocks { + "}"); final PreferencesResponseApiDto response = updatePreferences(requestApiDto); assertThat(response).isNotNull(); - assertThat(response.getProperties()).isEqualTo(preferencesPortalPrefsDto.getProperties()); + assertThat(response.getProperties()).isEqualTo(preferencesPreferencesDto.getProperties()); } @Test void thatPreferencesCanNotBeUpdated() throws Exception { - final var problemPortalPrefsDto = new ProblemPortalPrefsDto(); - problemPortalPrefsDto.setStatus(HttpStatus.BAD_REQUEST.value()); - problemPortalPrefsDto.setTitle(HttpStatus.BAD_REQUEST.toString()); - problemPortalPrefsDto.setDetail("Some details"); + final var problemPreferencesDto = new ProblemPreferencesDto(); + problemPreferencesDto.setStatus(HttpStatus.BAD_REQUEST.value()); + problemPreferencesDto.setTitle(HttpStatus.BAD_REQUEST.toString()); + problemPreferencesDto.setDetail("Some details"); - final PreferencesPortalPrefsDto preferencesPortalPrefsDto = - new PreferencesPortalPrefsDto() + final PreferencesPreferencesDto preferencesPreferencesDto = + new PreferencesPreferencesDto() .properties( "{\n" + "\"properties\": {\n" @@ -79,7 +79,7 @@ class UpdatePreferencesIntegrationTest extends PreferencesMocks { + "}\n" + "\n" + "}"); - mockUpdatePreferencesError(preferencesPortalPrefsDto, problemPortalPrefsDto); + mockUpdatePreferencesError(preferencesPreferencesDto, problemPreferencesDto); CreatePreferencesRequestApiDto requestApiDto = new CreatePreferencesRequestApiDto() @@ -108,7 +108,7 @@ class UpdatePreferencesIntegrationTest extends PreferencesMocks { assertThat(response.getStatus()).isEqualTo(HttpStatus.BAD_GATEWAY.value()); assertThat(response.getDownstreamSystem()) - .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS); + .isEqualTo(ProblemApiDto.DownstreamSystemEnum.PREFERENCES); assertThat(response.getDownstreamStatus()).isEqualTo(HttpStatus.BAD_REQUEST.value()); } } diff --git a/app/src/test/java/org/onap/portalng/bff/roles/ListRealmRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/roles/ListRealmRolesIntegrationTest.java index df95e2c..d9a69f1 100644 --- a/app/src/test/java/org/onap/portalng/bff/roles/ListRealmRolesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/roles/ListRealmRolesIntegrationTest.java @@ -27,8 +27,8 @@ import com.github.tomakehurst.wiremock.client.WireMock; import io.restassured.http.Header; import java.util.List; import org.junit.jupiter.api.Test; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.onap.portalng.bff.openapi.server.model.RoleListResponseApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/roles/RolesMocks.java b/app/src/test/java/org/onap/portalng/bff/roles/RolesMocks.java index fe065a7..b29ad7c 100644 --- a/app/src/test/java/org/onap/portalng/bff/roles/RolesMocks.java +++ b/app/src/test/java/org/onap/portalng/bff/roles/RolesMocks.java @@ -25,7 +25,7 @@ import com.github.tomakehurst.wiremock.client.WireMock; import io.restassured.http.Header; import java.util.List; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.RoleListResponseApiDto; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java index aa67631..5aab69d 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/CreateUserIntegrationTest.java @@ -30,10 +30,10 @@ import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RequiredActionsKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RequiredActionsKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.CreateUserRequestApiDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/users/DeleteUserIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/DeleteUserIntegrationTest.java index 639e5d3..11076d4 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/DeleteUserIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/DeleteUserIntegrationTest.java @@ -27,7 +27,7 @@ import com.github.tomakehurst.wiremock.client.WireMock; import io.restassured.http.Header; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; diff --git a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java index 6704cbc..e334953 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/GetUserDetailIntegrationTest.java @@ -29,9 +29,9 @@ import io.restassured.http.Header; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.UserResponseApiDto; import org.springframework.http.HttpHeaders; diff --git a/app/src/test/java/org/onap/portalng/bff/users/ListAssignedRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/ListAssignedRolesIntegrationTest.java index 7d05c67..7ab1130 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/ListAssignedRolesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/ListAssignedRolesIntegrationTest.java @@ -28,8 +28,8 @@ import io.restassured.http.Header; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.onap.portalng.bff.openapi.server.model.RoleListResponseApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java index 86f9ed8..45290da 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/ListAvailableRolesIntegrationTest.java @@ -28,8 +28,8 @@ import io.restassured.http.Header; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.onap.portalng.bff.openapi.server.model.RoleListResponseApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java index 27a8ecd..8e675ca 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/ListUsersIntegrationTest.java @@ -30,9 +30,9 @@ import java.util.List; import java.util.Optional; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.UserListResponseApiDto; import org.onap.portalng.bff.openapi.server.model.UserResponseApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java index a1a5ee3..8f7b350 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/UpdateAssignedRolesIntegrationTest.java @@ -30,8 +30,8 @@ import java.util.Collections; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.onap.portalng.bff.openapi.server.model.RoleListResponseApiDto; diff --git a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java index f181c5e..0cce10a 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserIntegrationTest.java @@ -29,9 +29,9 @@ import io.restassured.http.Header; import java.util.List; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserRequestApiDto; import org.springframework.http.HttpStatus; diff --git a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserPasswordIntegrationTest.java b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserPasswordIntegrationTest.java index 0bdaaa9..cd38aeb 100644 --- a/app/src/test/java/org/onap/portalng/bff/users/UpdateUserPasswordIntegrationTest.java +++ b/app/src/test/java/org/onap/portalng/bff/users/UpdateUserPasswordIntegrationTest.java @@ -27,8 +27,8 @@ import com.github.tomakehurst.wiremock.client.WireMock; import io.restassured.http.Header; import org.junit.jupiter.api.Test; import org.onap.portalng.bff.BaseIntegrationTest; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.CredentialKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.CredentialKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserPasswordRequestApiDto; import org.springframework.http.HttpStatus; diff --git a/app/src/test/resources/application-access-control.yml b/app/src/test/resources/application-access-control.yml index 1eb37b8..0506066 100644 --- a/app/src/test/resources/application-access-control.yml +++ b/app/src/test/resources/application-access-control.yml @@ -9,8 +9,6 @@ bff.access-control: PREFERENCES_GET: [onap_admin, onap_designer, onap_operator] PREFERENCES_UPDATE: [onap_admin, onap_designer, onap_operator] ROLE_LIST: ["*"] - TILE_GET: [onap_admin, onap_designer, onap_operator] - TILE_LIST: [onap_admin, onap_designer, onap_operator] USER_CREATE: [onap_admin, onap_designer, onap_operator] USER_DELETE: [onap_admin, onap_designer, onap_operator] USER_GET: [onap_admin, onap_designer, onap_operator] diff --git a/app/src/test/resources/application-development.yml b/app/src/test/resources/application-development.yml index 2f408fe..2d53583 100644 --- a/app/src/test/resources/application-development.yml +++ b/app/src/test/resources/application-development.yml @@ -27,7 +27,6 @@ spring: bff: realm: ONAP - portal-prefs-url: http://localhost:${wiremock.server.port} - portal-history-url: http://localhost:${wiremock.server.port} + preferences-url: http://localhost:${wiremock.server.port} + history-url: http://localhost:${wiremock.server.port} keycloak-url: http://localhost:${wiremock.server.port} - instance-id: PORTAL diff --git a/app/src/test/resources/application.yml b/app/src/test/resources/application.yml index b26e5d4..789e870 100644 --- a/app/src/test/resources/application.yml +++ b/app/src/test/resources/application.yml @@ -28,7 +28,6 @@ spring: bff: realm: ONAP - portal-prefs-url: http://localhost:${wiremock.server.port} - portal-history-url: http://localhost:${wiremock.server.port} + preferences-url: http://localhost:${wiremock.server.port} + history-url: http://localhost:${wiremock.server.port} keycloak-url: http://localhost:${wiremock.server.port} - instance-id: PORTAL diff --git a/development/.env b/development/.env index 9bb9dd3..f8e9c18 100644 --- a/development/.env +++ b/development/.env @@ -20,21 +20,21 @@ POSTGRES_VERSION=15rc1 MONGO_IMAGE=mongo MONGO_VERSION=latest -# portal-prefs -PORTAL_PREFS_IMAGE_NAME=portal-prefs -PORTAL_PREFS_IMAGE_TAG=0.1.0-master-faef0c0e +# preferences +PREFERENCES_IMAGE_NAME=preferences +PREFERENCES_IMAGE_TAG=0.1.0-master-faef0c0e PORTALPREFS_USERNAME:root PORTALPREFS_PASSWORD:password -PORTALPREFS_DATABASE:Portalprefs -PORTALPREFS_HOST:mongo-prefs +PORTALPREFS_DATABASE:Preferences +PORTALPREFS_HOST:mongo-preferences PORTALPREFS_PORT:27017 -# portal-history -PORTAL_HISTORY_IMAGE_NAME=portal-history +# history +PORTAL_HISTORY_IMAGE_NAME=history PORTAL_HISTORY_IMAGE_TAG=0.1.1-de369ace PORTALHISTORY_USERNAME:root PORTALHISTORY_PASSWORD:password -PORTALHISTORY_DATABASE:Portalhist +PORTALHISTORY_DATABASE:History PORTALHISTORY_HOST:mongo-history PORTALHISTORY_PORT:27017 diff --git a/development/docker-compose.yml b/development/docker-compose.yml index 4794ff3..9cca867 100644 --- a/development/docker-compose.yml +++ b/development/docker-compose.yml @@ -39,8 +39,8 @@ services: environment: MONGO_INITDB_ROOT_USERNAME: ${PORTALHISTORY_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${PORTALHISTORY_PASSWORD} - portal-history: - container_name: portal-history + history: + container_name: history image: "${IMAGE_REPOSITORY}/${PORTAL_HISTORY_IMAGE_NAME}:${PORTAL_HISTORY_IMAGE_TAG}" ports: - 9002:9002 @@ -54,15 +54,15 @@ services: PORTALHISTORY_PORT: ${PORTALHISTORY_PORT} depends_on: - mongo-history - mongo-prefs: - container_name: mongo-prefs + mongo-preferences: + container_name: mongo-preferences image: "${MONGO_IMAGE}:${MONGO_VERSION}" environment: MONGO_INITDB_ROOT_USERNAME: ${PORTALPREFS_USERNAME} MONGO_INITDB_ROOT_PASSWORD: ${PORTALPREFS_PASSWORD} - portal-prefs: - container_name: portal-prefs - image: "${IMAGE_REPOSITORY}/${PORTAL_PREFS_IMAGE_NAME}:${PORTAL_PREFS_IMAGE_TAG}" + preferences: + container_name: preferences + image: "${IMAGE_REPOSITORY}/${PREFERENCES_IMAGE_NAME}:${PREFERENCES_IMAGE_TAG}" ports: - 9001:9001 environment: @@ -74,4 +74,4 @@ services: PORTALPREFS_HOST: ${PORTALPREFS_HOST} PORTALPREFS_PORT: ${PORTALPREFS_PORT} depends_on: - - mongo-prefs
\ No newline at end of file + - mongo-preferences
\ No newline at end of file diff --git a/lib/build.gradle b/lib/build.gradle index 76b1d42..e72062d 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -2,7 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' id 'io.spring.dependency-management' - id 'com.github.johnrengelman.shadow' // + id 'com.github.johnrengelman.shadow' id 'maven-publish' // publish lib jar to artifact repository id 'com.diffplug.spotless' // code formatting id 'com.github.spotbugs' // bug linting that can be picked up by IDE @@ -13,9 +13,9 @@ version rootProject.file('version').text.trim() dependencies { implementation project(':openapi:server') - implementation project(':openapi:client-portal-prefs') - implementation project(':openapi:client-portal-history') - implementation project(':openapi:client-portal-keycloak') + implementation project(':openapi:client-preferences') + implementation project(':openapi:client-history') + implementation project(':openapi:client-keycloak') implementation 'org.springframework.boot:spring-boot-starter-webflux' implementation 'org.springframework.boot:spring-boot-starter-actuator' @@ -50,9 +50,9 @@ shadowJar { archiveBaseName.set('bff') dependencies { include(project(':openapi:server')) - include(project(':openapi:client-portal-history')) - include(project(':openapi:client-portal-prefs')) - include(project(':openapi:client-portal-keycloak')) + include(project(':openapi:client-history')) + include(project(':openapi:client-preferences')) + include(project(':openapi:client-keycloak')) } } @@ -69,17 +69,9 @@ publishing { } } } - // https://gitlab.devops.telekom.de/tnap/development/tesla-team/portal-community/bff/-/blob/pipeline/lib/build.gradle#L60 + repositories{ mavenCentral() - // maven { - // url "${maven_central_url}" - // credentials { - // username = "${artifactory_user}" - // password = "${artifactory_password}" - // } - // } - } } diff --git a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java index 7e773ed..5bc618c 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/BffConfig.java @@ -42,9 +42,8 @@ import reactor.core.publisher.Mono; public class BffConfig { @NotBlank private final String realm; - @NotBlank private final String portalServiceUrl; - @NotBlank private final String portalPrefsUrl; - @NotBlank private final String portalHistoryUrl; + @NotBlank private final String preferencesUrl; + @NotBlank private final String historyUrl; @NotBlank private final String keycloakUrl; @NotNull private final Map<String, List<String>> accessControl; diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java index e6904b1..c7f8709 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalHistoryConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/HistoryConfig.java @@ -30,11 +30,10 @@ import lombok.extern.slf4j.Slf4j; import org.onap.portalng.bff.config.BeansConfig; import org.onap.portalng.bff.config.BffConfig; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_history.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_history.api.ActionsApi; -import org.onap.portalng.bff.openapi.client_portal_history.model.ProblemPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.ApiClient; +import org.onap.portalng.bff.openapi.client_history.api.ActionsApi; +import org.onap.portalng.bff.openapi.client_history.model.ProblemHistoryDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -44,18 +43,17 @@ import org.springframework.web.reactive.function.client.WebClient; @Slf4j @Configuration -public class PortalHistoryConfig extends AbstractClientConfig<ProblemPortalHistoryDto> { +public class HistoryConfig extends AbstractClientConfig<ProblemHistoryDto> { private final ObjectMapper objectMapper; private final BffConfig bffConfig; private final ExchangeFilterFunction oauth2ExchangeFilterFunction; - @Autowired - public PortalHistoryConfig( + public HistoryConfig( @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) ExchangeFilterFunction oauth2ExchangeFilterFunction, ObjectMapper objectMapper, BffConfig bffConfig) { - super(ProblemPortalHistoryDto.class); + super(ProblemHistoryDto.class); this.objectMapper = objectMapper; this.bffConfig = bffConfig; this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; @@ -76,7 +74,7 @@ public class PortalHistoryConfig extends AbstractClientConfig<ProblemPortalHisto final String generatedBasePath = apiClient.getBasePath(); String basePath = ""; try { - basePath = bffConfig.getPortalHistoryUrl() + new URL(generatedBasePath).getPath(); + basePath = bffConfig.getHistoryUrl() + new URL(generatedBasePath).getPath(); } catch (MalformedURLException e) { log.error(e.getLocalizedMessage()); } @@ -85,7 +83,7 @@ public class PortalHistoryConfig extends AbstractClientConfig<ProblemPortalHisto @Override protected DownstreamApiProblemException mapException( - ProblemPortalHistoryDto errorResponse, HttpStatusCode httpStatusCode) { + ProblemHistoryDto errorResponse, HttpStatusCode httpStatusCode) { return DownstreamApiProblemException.builder() .title(httpStatusCode.toString()) .detail(errorResponse.getDetail()) diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java index 9880ef7..2ff3974 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/KeycloakConfig.java @@ -27,9 +27,9 @@ import java.util.function.Function; import org.onap.portalng.bff.config.BeansConfig; import org.onap.portalng.bff.config.BffConfig; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_keycloak.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_keycloak.api.KeycloakApi; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.ErrorResponseKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.ApiClient; +import org.onap.portalng.bff.openapi.client_keycloak.api.KeycloakApi; +import org.onap.portalng.bff.openapi.client_keycloak.model.ErrorResponseKeycloakDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; diff --git a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java b/lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java index 8c2eba4..d94eae2 100644 --- a/lib/src/main/java/org/onap/portalng/bff/config/clients/PortalPrefsConfig.java +++ b/lib/src/main/java/org/onap/portalng/bff/config/clients/PreferencesConfig.java @@ -30,9 +30,9 @@ import lombok.extern.slf4j.Slf4j; import org.onap.portalng.bff.config.BeansConfig; import org.onap.portalng.bff.config.BffConfig; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_prefs.ApiClient; -import org.onap.portalng.bff.openapi.client_portal_prefs.api.PreferencesApi; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.ProblemPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.ApiClient; +import org.onap.portalng.bff.openapi.client_preferences.api.PreferencesApi; +import org.onap.portalng.bff.openapi.client_preferences.model.ProblemPreferencesDto; import org.onap.portalng.bff.openapi.server.model.ProblemApiDto; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; @@ -43,17 +43,17 @@ import org.springframework.web.reactive.function.client.WebClient; @Slf4j @Configuration -public class PortalPrefsConfig extends AbstractClientConfig<ProblemPortalPrefsDto> { +public class PreferencesConfig extends AbstractClientConfig<ProblemPreferencesDto> { private final ObjectMapper objectMapper; private final BffConfig bffConfig; private final ExchangeFilterFunction oauth2ExchangeFilterFunction; - public PortalPrefsConfig( + public PreferencesConfig( @Qualifier(BeansConfig.OAUTH2_EXCHANGE_FILTER_FUNCTION) ExchangeFilterFunction oauth2ExchangeFilterFunction, ObjectMapper objectMapper, BffConfig bffConfig) { - super(ProblemPortalPrefsDto.class); + super(ProblemPreferencesDto.class); this.objectMapper = objectMapper; this.bffConfig = bffConfig; this.oauth2ExchangeFilterFunction = oauth2ExchangeFilterFunction; @@ -75,7 +75,7 @@ public class PortalPrefsConfig extends AbstractClientConfig<ProblemPortalPrefsDt final String generatedBasePath = apiClient.getBasePath(); String basePath = ""; try { - basePath = bffConfig.getPortalPrefsUrl() + new URL(generatedBasePath).getPath(); + basePath = bffConfig.getPreferencesUrl() + new URL(generatedBasePath).getPath(); } catch (MalformedURLException e) { log.error(e.getLocalizedMessage()); } @@ -84,12 +84,12 @@ public class PortalPrefsConfig extends AbstractClientConfig<ProblemPortalPrefsDt @Override protected DownstreamApiProblemException mapException( - ProblemPortalPrefsDto errorResponse, HttpStatusCode httpStatusCode) { + ProblemPreferencesDto errorResponse, HttpStatusCode httpStatusCode) { return DownstreamApiProblemException.builder() .title(httpStatusCode.toString()) .detail(errorResponse.getDetail()) .downstreamMessageId(errorResponse.getType()) - .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PORTAL_PREFS.toString()) + .downstreamSystem(ProblemApiDto.DownstreamSystemEnum.PREFERENCES.toString()) .downstreamStatus(httpStatusCode.value()) .build(); } diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java index 3f0ebdf..bc4f550 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/ActionsMapper.java @@ -24,14 +24,14 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_history.model.ActionsListResponsePortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.model.ActionsListResponseHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.springframework.core.convert.converter.Converter; @Mapper(config = MapperSpringConfig.class) public interface ActionsMapper - extends Converter<ActionsListResponsePortalHistoryDto, ActionsListResponseApiDto> { + extends Converter<ActionsListResponseHistoryDto, ActionsListResponseApiDto> { @Mapping(source = "actionsList", target = "items") - ActionsListResponseApiDto convert(ActionsListResponsePortalHistoryDto source); + ActionsListResponseApiDto convert(ActionsListResponseHistoryDto source); } diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java index b3c7f05..6b05ae3 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/CredentialMapper.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.CredentialKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.CredentialKeycloakDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserPasswordRequestApiDto; @Mapper(config = MapperSpringConfig.class, unmappedTargetPolicy = ReportingPolicy.IGNORE) diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java index 6e615c3..13f9e3f 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/PreferencesMapper.java @@ -24,14 +24,14 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.springframework.core.convert.converter.Converter; @Mapper(config = MapperSpringConfig.class) public interface PreferencesMapper - extends Converter<PreferencesPortalPrefsDto, PreferencesResponseApiDto> { + extends Converter<PreferencesPreferencesDto, PreferencesResponseApiDto> { @Mapping(source = "properties", target = "properties") - PreferencesResponseApiDto convert(PreferencesPortalPrefsDto source); + PreferencesResponseApiDto convert(PreferencesPreferencesDto source); } diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java index 6e14d7e..ca3ee4c 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/RolesMapper.java @@ -24,7 +24,7 @@ package org.onap.portalng.bff.mappers; import org.mapstruct.Mapper; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RoleKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RoleKeycloakDto; import org.onap.portalng.bff.openapi.server.model.RoleApiDto; import org.springframework.core.convert.converter.Converter; diff --git a/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java b/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java index f494c5d..78ba804 100644 --- a/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java +++ b/lib/src/main/java/org/onap/portalng/bff/mappers/UsersMapper.java @@ -26,8 +26,8 @@ import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.ReportingPolicy; import org.onap.portalng.bff.config.MapperSpringConfig; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RequiredActionsKeycloakDto; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.UserKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.RequiredActionsKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.model.UserKeycloakDto; import org.onap.portalng.bff.openapi.server.model.CreateUserRequestApiDto; import org.onap.portalng.bff.openapi.server.model.UpdateUserRequestApiDto; import org.onap.portalng.bff.openapi.server.model.UserResponseApiDto; diff --git a/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java b/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java index 17afa39..cb7b6b4 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/ActionService.java @@ -23,8 +23,8 @@ package org.onap.portalng.bff.services; import lombok.RequiredArgsConstructor; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_history.api.ActionsApi; -import org.onap.portalng.bff.openapi.client_portal_history.model.CreateActionRequestPortalHistoryDto; +import org.onap.portalng.bff.openapi.client_history.api.ActionsApi; +import org.onap.portalng.bff.openapi.client_history.model.CreateActionRequestHistoryDto; import org.onap.portalng.bff.openapi.server.model.ActionsListResponseApiDto; import org.onap.portalng.bff.openapi.server.model.ActionsResponseApiDto; import org.onap.portalng.bff.openapi.server.model.CreateActionRequestApiDto; @@ -43,15 +43,15 @@ public class ActionService { public Mono<ActionsResponseApiDto> createAction( String userId, String xRequestId, CreateActionRequestApiDto createActionRequestApiDto) { // First map from server API model to client API model - CreateActionRequestPortalHistoryDto createActionRequestPortalHistoryDto = - new CreateActionRequestPortalHistoryDto(); - createActionRequestPortalHistoryDto.setUserId(createActionRequestApiDto.getUserId()); - createActionRequestPortalHistoryDto.setAction(createActionRequestApiDto.getAction()); - createActionRequestPortalHistoryDto.setActionCreatedAt( + CreateActionRequestHistoryDto createActionRequestHistoryDto = + new CreateActionRequestHistoryDto(); + createActionRequestHistoryDto.setUserId(createActionRequestApiDto.getUserId()); + createActionRequestHistoryDto.setAction(createActionRequestApiDto.getAction()); + createActionRequestHistoryDto.setActionCreatedAt( createActionRequestApiDto.getActionCreatedAt()); return actionsApi - .createAction(userId, xRequestId, createActionRequestPortalHistoryDto) + .createAction(userId, xRequestId, createActionRequestHistoryDto) .map( action -> new ActionsResponseApiDto() diff --git a/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java b/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java index b902128..5780ad0 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/KeycloakService.java @@ -33,8 +33,8 @@ import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; import org.onap.portalng.bff.mappers.CredentialMapper; import org.onap.portalng.bff.mappers.RolesMapper; import org.onap.portalng.bff.mappers.UsersMapper; -import org.onap.portalng.bff.openapi.client_portal_keycloak.api.KeycloakApi; -import org.onap.portalng.bff.openapi.client_portal_keycloak.model.RequiredActionsKeycloakDto; +import org.onap.portalng.bff.openapi.client_keycloak.api.KeycloakApi; +import org.onap.portalng.bff.openapi.client_keycloak.model.RequiredActionsKeycloakDto; import org.onap.portalng.bff.openapi.server.model.*; import org.onap.portalng.bff.utils.Logger; import org.springframework.core.convert.support.ConfigurableConversionService; diff --git a/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java b/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java index af62d28..53bceee 100644 --- a/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java +++ b/lib/src/main/java/org/onap/portalng/bff/services/PreferencesService.java @@ -23,8 +23,8 @@ package org.onap.portalng.bff.services; import lombok.RequiredArgsConstructor; import org.onap.portalng.bff.exceptions.DownstreamApiProblemException; -import org.onap.portalng.bff.openapi.client_portal_prefs.api.PreferencesApi; -import org.onap.portalng.bff.openapi.client_portal_prefs.model.PreferencesPortalPrefsDto; +import org.onap.portalng.bff.openapi.client_preferences.api.PreferencesApi; +import org.onap.portalng.bff.openapi.client_preferences.model.PreferencesPreferencesDto; import org.onap.portalng.bff.openapi.server.model.CreatePreferencesRequestApiDto; import org.onap.portalng.bff.openapi.server.model.PreferencesResponseApiDto; import org.onap.portalng.bff.utils.Logger; @@ -36,17 +36,17 @@ import reactor.core.publisher.Mono; @Service public class PreferencesService { - private static final String PREFERENCES_APPLICATION_NAME = "PORTAL_PREFS"; + private static final String PREFERENCES_APPLICATION_NAME = "PREFERENCES"; private final PreferencesApi preferencesApi; private final ConfigurableConversionService conversionService; public Mono<PreferencesResponseApiDto> createPreferences( String xRequestId, CreatePreferencesRequestApiDto request) { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties(request.getProperties()); + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties(request.getProperties()); return preferencesApi - .savePreferences(xRequestId, preferencesPortalPrefsDto) + .savePreferences(xRequestId, preferencesPreferencesDto) .map(resp -> conversionService.convert(resp, PreferencesResponseApiDto.class)) .onErrorResume( DownstreamApiProblemException.class, @@ -59,10 +59,10 @@ public class PreferencesService { public Mono<PreferencesResponseApiDto> updatePreferences( String xRequestId, CreatePreferencesRequestApiDto request) { - PreferencesPortalPrefsDto preferencesPortalPrefsDto = new PreferencesPortalPrefsDto(); - preferencesPortalPrefsDto.setProperties(request.getProperties()); + PreferencesPreferencesDto preferencesPreferencesDto = new PreferencesPreferencesDto(); + preferencesPreferencesDto.setProperties(request.getProperties()); return preferencesApi - .updatePreferences(xRequestId, preferencesPortalPrefsDto) + .updatePreferences(xRequestId, preferencesPreferencesDto) .map(resp -> conversionService.convert(resp, PreferencesResponseApiDto.class)) .onErrorResume( DownstreamApiProblemException.class, diff --git a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java index c20cd49..10d4833 100644 --- a/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java +++ b/lib/src/main/java/org/onap/portalng/bff/utils/Logger.java @@ -35,8 +35,8 @@ public class Logger { */ private Logger() {} - public static void requestLog(String xRequestId, HttpMethod methode, URI path) { - log.info("bff - request - X-Request-Id {} {} {}", xRequestId, methode, path); + public static void requestLog(String xRequestId, HttpMethod method, URI path) { + log.info("bff - request - X-Request-Id {} {} {}", xRequestId, method, path); } public static void responseLog(String xRequestId, HttpStatusCode httpStatusCode) { diff --git a/openapi/build.gradle b/openapi/build.gradle index 0b3e556..34d949b 100644 --- a/openapi/build.gradle +++ b/openapi/build.gradle @@ -5,15 +5,11 @@ plugins { dependencies { implementation project('server') - implementation project('client-portal-history') - implementation project('client-portal-keycloak') - implementation project('client-portal-prefs') + implementation project('client-history') + implementation project('client-keycloak') + implementation project('client-preferences') } + ext { openapiVersion = '7.0.0-beta' -} -subprojects { - repositories { - mavenCentral() - } }
\ No newline at end of file diff --git a/openapi/client-portal-history/LICENSE b/openapi/client-history/LICENSE index abe3069..abe3069 100644 --- a/openapi/client-portal-history/LICENSE +++ b/openapi/client-history/LICENSE diff --git a/openapi/client-portal-prefs/build.gradle b/openapi/client-history/build.gradle index 9eaa4b0..20b5258 100644 --- a/openapi/client-portal-prefs/build.gradle +++ b/openapi/client-history/build.gradle @@ -14,7 +14,7 @@ dependencies { openApiGenerate { generatorName = "java" library = "webclient" - inputSpec = "${project.projectDir}/src/portal_prefs_openapi.yaml" + inputSpec = "${project.projectDir}/src/api.yaml" outputDir = "${project.buildDir}/openapi" configOptions = [ openApiNullable : "false", @@ -29,10 +29,10 @@ openApiGenerate { generateApiDocumentation = false generateModelTests = false generateModelDocumentation = false - invokerPackage = "org.onap.portalng.bff.openapi.client_portal_prefs" - apiPackage = "org.onap.portalng.bff.openapi.client_portal_prefs.api" - modelPackage = "org.onap.portalng.bff.openapi.client_portal_prefs.model" - modelNameSuffix = "PortalPrefsDto" + invokerPackage = "org.onap.portalng.bff.openapi.client_history" + apiPackage = "org.onap.portalng.bff.openapi.client_history.api" + modelPackage = "org.onap.portalng.bff.openapi.client_history.model" + modelNameSuffix = "HistoryDto" } compileJava { diff --git a/openapi/client-portal-history/src/portal_history_openapi.yaml b/openapi/client-history/src/api.yaml index 5057592..22c6ae5 100644 --- a/openapi/client-portal-history/src/portal_history_openapi.yaml +++ b/openapi/client-history/src/api.yaml @@ -2,7 +2,7 @@ openapi: 3.0.2 info: title: Config API version: '1.0' - description: API to provide actions for portal-history + description: API to provide actions for history contact: name: TNAP Team Tesla url: 'https://www.telekom.de' diff --git a/openapi/client-portal-keycloak/LICENSE b/openapi/client-keycloak/LICENSE index abe3069..abe3069 100644 --- a/openapi/client-portal-keycloak/LICENSE +++ b/openapi/client-keycloak/LICENSE diff --git a/openapi/client-portal-keycloak/build.gradle b/openapi/client-keycloak/build.gradle index 22da1f2..46c842d 100644 --- a/openapi/client-portal-keycloak/build.gradle +++ b/openapi/client-keycloak/build.gradle @@ -14,7 +14,7 @@ dependencies { openApiGenerate { generatorName = "java" library = "webclient" - inputSpec = "${project.projectDir}/src/portal_keycloak_openapi.yaml" + inputSpec = "${project.projectDir}/src/api.yaml" outputDir = "${project.buildDir}/openapi" configOptions = [ openApiNullable : "false", @@ -29,9 +29,9 @@ openApiGenerate { generateApiDocumentation = false generateModelTests = false generateModelDocumentation = false - invokerPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak" - apiPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak.api" - modelPackage = "org.onap.portalng.bff.openapi.client_portal_keycloak.model" + invokerPackage = "org.onap.portalng.bff.openapi.client_keycloak" + apiPackage = "org.onap.portalng.bff.openapi.client_keycloak.api" + modelPackage = "org.onap.portalng.bff.openapi.client_keycloak.model" modelNameSuffix = "KeycloakDto" } diff --git a/openapi/client-portal-keycloak/src/portal_keycloak_openapi.yaml b/openapi/client-keycloak/src/api.yaml index a09f0f4..a09f0f4 100644 --- a/openapi/client-portal-keycloak/src/portal_keycloak_openapi.yaml +++ b/openapi/client-keycloak/src/api.yaml diff --git a/openapi/client-portal-prefs/LICENSE b/openapi/client-preferences/LICENSE index abe3069..abe3069 100644 --- a/openapi/client-portal-prefs/LICENSE +++ b/openapi/client-preferences/LICENSE diff --git a/openapi/client-portal-history/build.gradle b/openapi/client-preferences/build.gradle index a087be9..208b20d 100644 --- a/openapi/client-portal-history/build.gradle +++ b/openapi/client-preferences/build.gradle @@ -14,7 +14,7 @@ dependencies { openApiGenerate { generatorName = "java" library = "webclient" - inputSpec = "${project.projectDir}/src/portal_history_openapi.yaml" + inputSpec = "${project.projectDir}/src/api.yaml" outputDir = "${project.buildDir}/openapi" configOptions = [ openApiNullable : "false", @@ -23,16 +23,20 @@ openApiGenerate { useJakartaEe : "true", ] typeMappings = [ - "File": "org.springframework.core.io.buffer.DataBuffer" + "File": "org.springframework.core.io.buffer.DataBuffer", + "mapOfObjects": "Map<String,Object>" + ] + importMappings = [ + "Map<String,Object>": "java.util.Map" ] generateApiTests = false generateApiDocumentation = false generateModelTests = false generateModelDocumentation = false - invokerPackage = "org.onap.portalng.bff.openapi.client_portal_history" - apiPackage = "org.onap.portalng.bff.openapi.client_portal_history.api" - modelPackage = "org.onap.portalng.bff.openapi.client_portal_history.model" - modelNameSuffix = "PortalHistoryDto" + invokerPackage = "org.onap.portalng.bff.openapi.client_preferences" + apiPackage = "org.onap.portalng.bff.openapi.client_preferences.api" + modelPackage = "org.onap.portalng.bff.openapi.client_preferences.model" + modelNameSuffix = "PreferencesDto" } compileJava { diff --git a/openapi/client-portal-prefs/src/portal_prefs_openapi.yaml b/openapi/client-preferences/src/api.yaml index 86d9e2b..86d9e2b 100644 --- a/openapi/client-portal-prefs/src/portal_prefs_openapi.yaml +++ b/openapi/client-preferences/src/api.yaml diff --git a/openapi/server/build.gradle b/openapi/server/build.gradle index 99e401b..78c5103 100644 --- a/openapi/server/build.gradle +++ b/openapi/server/build.gradle @@ -24,7 +24,7 @@ openApiGenerate { inputSpec = "$projectDir/src/main/resources/static/api.yaml" outputDir = "$buildDir/openapi" configOptions = [ - hideGenerationTimestamps: "true", + hideGenerationTimestamp: "true", openApiNullable: "false", skipDefaultInterface: "true", dateLibrary: "java8", diff --git a/openapi/server/src/main/resources/static/api.yaml b/openapi/server/src/main/resources/static/api.yaml index be5ae0a..f601785 100644 --- a/openapi/server/src/main/resources/static/api.yaml +++ b/openapi/server/src/main/resources/static/api.yaml @@ -734,7 +734,7 @@ components: enum: - KEYCLOAK - PORTAL_SERVICE - - PORTAL_PREFS + - PREFERENCES - PORTAL_HISTORY downstreamStatus: type: integer diff --git a/settings.gradle b/settings.gradle index 6044422..200c1cc 100644 --- a/settings.gradle +++ b/settings.gradle @@ -20,9 +20,9 @@ pluginManagement { rootProject.name = 'bff' include 'openapi:server' -include 'openapi:client-portal-prefs' -include 'openapi:client-portal-history' -include 'openapi:client-portal-keycloak' +include 'openapi:client-preferences' +include 'openapi:client-history' +include 'openapi:client-keycloak' include 'lib' include 'app' |