diff options
-rwxr-xr-x | csit/plans/default/setup.sh | 2 | ||||
-rwxr-xr-x | docker-compose.yml | 2 | ||||
-rw-r--r-- | docs/_static/openapi/swagger/openapi.yml | 16 | ||||
-rw-r--r-- | docs/content/release-notes.rst | 45 | ||||
-rw-r--r-- | docs/requirements-docs.txt | 4 | ||||
-rwxr-xr-x | pom.xml | 20 | ||||
-rw-r--r-- | releases/1.1.0-container.yaml | 9 | ||||
-rw-r--r-- | src/main/java/org/onap/cps/temporal/controller/rest/QueryController.java | 74 | ||||
-rw-r--r-- | src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy | 2 | ||||
-rw-r--r-- | version.properties | 2 |
10 files changed, 70 insertions, 106 deletions
diff --git a/csit/plans/default/setup.sh b/csit/plans/default/setup.sh index 3385bc0..58be1c9 100755 --- a/csit/plans/default/setup.sh +++ b/csit/plans/default/setup.sh @@ -32,7 +32,7 @@ chmod +x docker-compose # Set environment variables for docker compose export CPS_TEMPORAL_DOCKER_REPO= -export STABLE_CPS_CORE_VERSION=3.0.0-SNAPSHOT-20220303T233031Z +export STABLE_CPS_CORE_VERSION=3.0.0 # start CPS Temporal, cps-core, timescaledb, PostgresSQL and kafka containers with docker compose ./docker-compose up -d python3 --version diff --git a/docker-compose.yml b/docker-compose.yml index b9d4e0c..267e47e 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -71,7 +71,7 @@ services: cps-and-ncmp: container_name: cps-and-ncmp - image: ${CPS_CORE_DOCKER_REPO-nexus3.onap.org:10003/}onap/cps-and-ncmp:${STABLE_CPS_CORE_VERSION:-latest} + image: ${CPS_CORE_DOCKER_REPO-nexus3.onap.org:10001/}onap/cps-and-ncmp:${STABLE_CPS_CORE_VERSION:-latest} ports: - "8083:8080" - "8087:8081" diff --git a/docs/_static/openapi/swagger/openapi.yml b/docs/_static/openapi/swagger/openapi.yml index 7c7a10d..a96947b 100644 --- a/docs/_static/openapi/swagger/openapi.yml +++ b/docs/_static/openapi/swagger/openapi.yml @@ -75,14 +75,14 @@ paths: anchor: my-anchor data: status: UP + + '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' '/v1/dataspaces/{dataspace-name}/anchors/history': get: description: 'Read anchors data based on filter criteria provided in query parameters' @@ -128,8 +128,6 @@ paths: $ref: '#/components/responses/Unauthorized' '403': $ref: '#/components/responses/Forbidden' - '500': - $ref: '#/components/responses/InternalServerError' components: parameters: dataspaceName: @@ -219,16 +217,6 @@ components: status: 403 message: Forbidden error message details: Forbidden error details - InternalServerError: - description: Internal Server Error - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorMessage" - example: - status: 500 - message: Internal Server Error - details: Internal Server Error occurred schemas: AnchorDetails: type: object diff --git a/docs/content/release-notes.rst b/docs/content/release-notes.rst index 923cd00..f432082 100644 --- a/docs/content/release-notes.rst +++ b/docs/content/release-notes.rst @@ -3,6 +3,9 @@ .. http://creativecommons.org/licenses/by/4.0 .. .. Copyright (C) 2021 Bell Canada +.. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING + +.. _release_notes: ========================== CPS Temporal Release Notes @@ -16,19 +19,29 @@ CPS Temporal Release Notes .. * * * JAKARTA * * * .. ======================== -Version: 1.1.0-SNAPSHOT -======================= +Version: 1.1.0 +============== + +.. table:: -This section lists the main changes & fixes merged into master (snapshot) version of CPS-Temporal. This information is here to assist developers that want experiment/test using our latest code bases directly. Stability of this is not guaranteed. + =============================== =============================== + **Docker Image** onap/cps-temporal:1.1.0 + **Designation** 1.1.0 Jakarta + **Date** 2022 March 15 + =============================== =============================== Features -------- -* None + +* `CPS-747 <https://jira.onap.org/browse/CPS-747>`_ - Add support for Data Deletion Events +* `CPS-482 <https://jira.onap.org/browse/CPS-482>`_ - Add CSIT tests Bug Fixes --------- - - `CPS-841 <https://jira.onap.org/browse/CPS-841>`_ Upgrade log4j to 2.17.1 as recommended by ONAP SECCOM +* `CPS-820 <https://jira.onap.org/browse/CPS-820>`_ - Upgrade log4j to 2.16.0 +* `CPS-841 <https://jira.onap.org/browse/CPS-841>`_ - Upgrade log4j to 2.17.1 as recommended by ONAP SECCOM +* `CPS-905 <https://jira.onap.org/browse/CPS-905>`_ - Fix Docker images for CSIT tests .. ======================== .. * * * ISTANBUL * * * @@ -37,16 +50,12 @@ Bug Fixes Version: 1.0.1 ============== -* Release Date: 2021-01-06 (Istanbul) - -Artifacts released ------------------- - .. table:: =============================== =============================== - **Repository** **Docker Image** - onap/cps-temporal onap/cps-temporal:1.0.1 + **Docker Image** onap/cps-temporal:1.0.1 + **Designation** 1.0.1 Istanbul + **Date** 2021 January 6 =============================== =============================== Features @@ -56,21 +65,17 @@ Features Bug Fixes --------- - - `CPS-841 <https://jira.onap.org/browse/CPS-841>`_ Update log4j version to 2.17.1 due to security vulnerability +* `CPS-841 <https://jira.onap.org/browse/CPS-841>`_ - Update log4j version to 2.17.1 due to security vulnerability Version: 1.0.0 ============== -* Release Date: 2021-09-14 (Istanbul) - -Artifacts released ------------------- - .. table:: =============================== =============================== - **Repository** **Docker Image** - onap/cps-temporal onap/cps-temporal:1.0.0 + **Docker Image** onap/cps-temporal:1.0.0 + **Designation** 1.0.0 Istanbul + **Date** 2021 September 14 =============================== =============================== New features diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 5a3d2f1..3b3441a 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1 +1,3 @@ -lfdocs-conf
\ No newline at end of file +lfdocs-conf +sphinx>=4.2.0 # BSD +sphinx-rtd-theme>=1.0.0 # MIT @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- ============LICENSE_START======================================================= - Copyright (c) 2021 Bell Canada. + Copyright (c) 2021-2022 Bell Canada Modifications Copyright (C) 2021 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,7 @@ <groupId>org.onap.cps</groupId> <artifactId>cps-temporal</artifactId> - <version>1.1.0-SNAPSHOT</version> + <version>1.2.0-SNAPSHOT</version> <name>cps-temporal</name> <description>CPS Temporal Service</description> @@ -46,7 +46,7 @@ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> <minimum-coverage>0.8</minimum-coverage> <!-- Application dependencies versions --> - <cps.version>2.1.0-SNAPSHOT</cps.version> + <cps.version>3.0.0</cps.version> <mapstruct.version>1.4.2.Final</mapstruct.version> </properties> @@ -55,7 +55,7 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> - <version>2.5.7</version> + <version>2.6.4</version> <type>pom</type> <scope>import</scope> </dependency> @@ -73,16 +73,6 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>2.17.1</version> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-to-slf4j</artifactId> - <version>2.17.1</version> - </dependency> </dependencies> </dependencyManagement> @@ -253,7 +243,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>2.3.3.RELEASE</version> + <version>2.6.4</version> <executions> <execution> <goals> diff --git a/releases/1.1.0-container.yaml b/releases/1.1.0-container.yaml new file mode 100644 index 0000000..50697c5 --- /dev/null +++ b/releases/1.1.0-container.yaml @@ -0,0 +1,9 @@ +distribution_type: container +container_release_tag: 1.1.0 +project: cps/cps-temporal +log_dir: cps-cps-temporal-maven-docker-stage-master/394/ +ref: 251d6a8783256ae9b7d1299ac31ab10e3e32401e +tag_release: true +containers: + - name: 'cps-temporal' + version: '1.1.0-20220317T152922Z' diff --git a/src/main/java/org/onap/cps/temporal/controller/rest/QueryController.java b/src/main/java/org/onap/cps/temporal/controller/rest/QueryController.java index da1a9ea..9de3f72 100644 --- a/src/main/java/org/onap/cps/temporal/controller/rest/QueryController.java +++ b/src/main/java/org/onap/cps/temporal/controller/rest/QueryController.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (c) 2021 Bell Canada. + * Copyright (c) 2021-2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,10 +42,10 @@ import org.onap.cps.temporal.service.NetworkDataService; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Slice; +import org.springframework.hateoas.Link; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.util.UriComponentsBuilder; @RestController @RequestMapping("${rest.api.base-path}") @@ -172,13 +172,11 @@ public class QueryController implements CpsTemporalQueryApi { final var anchorHistory = new AnchorHistory(); if (searchResult.hasNext()) { anchorHistory.setNextRecordsLink( - toRelativeLink( - getAbsoluteLinkForGetAnchorsDataByFilter(searchCriteria, searchResult.nextPageable()))); + getRelativeLinkForGetAnchorsDataByFilter(searchCriteria, searchResult.nextPageable())); } if (searchResult.hasPrevious()) { anchorHistory.setPreviousRecordsLink( - toRelativeLink( - getAbsoluteLinkForGetAnchorsDataByFilter(searchCriteria, searchResult.previousPageable()))); + getRelativeLinkForGetAnchorsDataByFilter(searchCriteria, searchResult.previousPageable())); } anchorHistory.setRecords(convertToAnchorDetails(searchResult.getContent())); return anchorHistory; @@ -196,12 +194,12 @@ public class QueryController implements CpsTemporalQueryApi { final var anchorHistory = new AnchorHistory(); if (searchResult.hasNext()) { - anchorHistory.setNextRecordsLink(toRelativeLink( - getAbsoluteLinkForGetAnchorDataByName(searchCriteria, searchResult.nextPageable()))); + anchorHistory.setNextRecordsLink( + getRelativeLinkForGetAnchorDataByName(searchCriteria, searchResult.nextPageable())); } if (searchResult.hasPrevious()) { - anchorHistory.setPreviousRecordsLink(toRelativeLink( - getAbsoluteLinkForGetAnchorDataByName(searchCriteria, searchResult.previousPageable()))); + anchorHistory.setPreviousRecordsLink( + getRelativeLinkForGetAnchorDataByName(searchCriteria, searchResult.previousPageable())); } anchorHistory.setRecords(convertToAnchorDetails(searchResult.getContent())); return anchorHistory; @@ -224,62 +222,34 @@ public class QueryController implements CpsTemporalQueryApi { https://github.com/spring-projects/spring-hateoas/issues/361 https://github.com/spring-projects/spring-hateoas/pull/1375 */ - final int contextPathBeginIndex = absoluteLink.indexOf("rest.api.base-path%257D"); - return basePath + absoluteLink.substring(contextPathBeginIndex + 23); + final int contextPathBeginIndex = absoluteLink.indexOf("${rest.api.base-path}"); + return basePath + absoluteLink.substring(contextPathBeginIndex + 21); } - private String getAbsoluteLinkForGetAnchorDataByName(final SearchCriteria searchCriteria, - final Pageable pageable) { - final var uriComponentsBuilder = linkTo(methodOn(QueryController.class).getAnchorDataByName( + private String getRelativeLinkForGetAnchorDataByName(final SearchCriteria searchCriteria, + final Pageable pageable) { + final Link absoluteLink = linkTo(methodOn(QueryController.class).getAnchorDataByName( searchCriteria.getDataspaceName(), searchCriteria.getAnchorName(), DateTimeUtility.toString(searchCriteria.getObservedAfter()), - null, + searchCriteria.getSimplePayloadFilter(), DateTimeUtility.toString(searchCriteria.getCreatedBefore()), pageable.getPageNumber(), pageable.getPageSize(), - sortMapper.sortAsString(searchCriteria.getPageable().getSort()))) - .toUriComponentsBuilder(); - addSimplePayloadFilter(uriComponentsBuilder, searchCriteria.getSimplePayloadFilter()); - return encodePlusSign(uriComponentsBuilder.toUriString()); + sortMapper.sortAsString(searchCriteria.getPageable().getSort()))).withSelfRel(); + return Link.of(toRelativeLink(absoluteLink.getHref())).expand().getHref(); } - private String getAbsoluteLinkForGetAnchorsDataByFilter(final SearchCriteria searchCriteria, - final Pageable pageable) { - final var uriComponentsBuilder = linkTo(methodOn(QueryController.class).getAnchorsDataByFilter( + private String getRelativeLinkForGetAnchorsDataByFilter(final SearchCriteria searchCriteria, + final Pageable pageable) { + final Link absoluteLink = linkTo(methodOn(QueryController.class).getAnchorsDataByFilter( searchCriteria.getDataspaceName(), searchCriteria.getSchemaSetName(), DateTimeUtility.toString(searchCriteria.getObservedAfter()), - null, + searchCriteria.getSimplePayloadFilter(), DateTimeUtility.toString(searchCriteria.getCreatedBefore()), pageable.getPageNumber(), pageable.getPageSize(), - sortMapper.sortAsString(searchCriteria.getPageable().getSort()))) - .toUriComponentsBuilder(); - addSimplePayloadFilter(uriComponentsBuilder, searchCriteria.getSimplePayloadFilter()); - return encodePlusSign(uriComponentsBuilder.toUriString()); - } - - /* - Spring hateoas does double encoding when generting URI. - To avoid it in the case of simplePayloadFilter, - the 'simplePayloadFilter is being added explicitly to UriComponentsBuilder - */ - private UriComponentsBuilder addSimplePayloadFilter(final UriComponentsBuilder uriComponentsBuilder, - final String simplePayloadFilter) { - if (simplePayloadFilter != null) { - uriComponentsBuilder.queryParam("simplePayloadFilter", simplePayloadFilter); - } - return uriComponentsBuilder; - } - - /* - Spring hateoas does not encode '+' in the query param but it deccodes '+' as space. - Due to this inconsistency, API was failing to convert datetime with positive timezone. - The fix is done in the spring-hateoas 1.4 version but it is yet to release. - As a workaround, we are replacing all the '+' with '%2B' - https://github.com/spring-projects/spring-hateoas/issues/1485 - */ - private String encodePlusSign(final String link) { - return link.replace("+", "%2B"); + sortMapper.sortAsString(searchCriteria.getPageable().getSort()))).withSelfRel(); + return Link.of(toRelativeLink(absoluteLink.getHref())).expand().getHref(); } } } diff --git a/src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy b/src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy index 305a55b..fd81f0f 100644 --- a/src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy +++ b/src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy @@ -135,7 +135,7 @@ class QueryControllerSpec extends Specification { responseBody.getRecords() == [toAnchorDetails(networkData)] where: scenario | endpointName | urlSpecifParams | parameters - 'without observedTimestampAfter and with payloadFilter' | 'anchor by name' | [anchor: myAnchor] | [observedTimestampAfter: null, payloadFilter: null] + 'without observedTimestampAfter and without payloadFilter' | 'anchor by name' | [anchor: myAnchor] | [observedTimestampAfter: null, payloadFilter: null] 'with observedTimestampAfter and without payloadFilter' | 'anchor by name' | [anchor: myAnchor] | [observedTimestampAfter: '2021-07-24T03:00:01.000-0400', payloadFilter: null] 'without observedTimestampAfter and with payloadFilter' | 'anchor by name' | [anchor: myAnchor] | [observedTimestampAfter: null, payloadFilter: '{"message" : "hello+world"}'] 'with observedTimestampAfter and with payloadFilter' | 'anchor by name' | [anchor: myAnchor] | [observedTimestampAfter: '2021-07-24T03:00:01.000+0400', payloadFilter: '{"message" : "hello world"}'] diff --git a/version.properties b/version.properties index b7e44af..df5632b 100644 --- a/version.properties +++ b/version.properties @@ -20,7 +20,7 @@ # because they are used in Jenkins, whose plug-in doesn't support this major=1 -minor=1 +minor=2 patch=0 base_version=${major}.${minor}.${patch} |