diff options
author | 2022-01-10 12:58:37 +0000 | |
---|---|---|
committer | 2022-01-12 09:45:47 +0000 | |
commit | cb23b1771e3fc552090f80791b852ce8ad05f150 (patch) | |
tree | 9ff89a6cbb8fcd39ebc1b710d151e8c89717f1ad /src/test/groovy | |
parent | 43a3982feeab703d165788e8871b435fc1ae63d9 (diff) |
Support operation field for CPS Temporal Query Output API
- Update in openapi.yaml to support operation field
- Repository test updated to test the operation field
- Rest api test updated
- Updates in documentation to include the operation field
Issue-ID: CPS-844
Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca>
Change-Id: If424c273b84b1f415ba706d0956f0841ce9c4196
Diffstat (limited to 'src/test/groovy')
-rw-r--r-- | src/test/groovy/org/onap/cps/temporal/controller/rest/QueryControllerSpec.groovy | 6 | ||||
-rw-r--r-- | src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositoryImplSpec.groovy | 5 |
2 files changed, 9 insertions, 2 deletions
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 7847b34..305a55b 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 @@ -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. @@ -22,6 +22,8 @@ package org.onap.cps.temporal.controller.rest import org.onap.cps.temporal.controller.utils.DateTimeUtility import com.fasterxml.jackson.databind.ObjectMapper +import org.onap.cps.temporal.domain.Operation + import java.time.OffsetDateTime import org.onap.cps.temporal.controller.rest.model.AnchorDetails import org.onap.cps.temporal.controller.rest.model.AnchorDetailsMapperImpl @@ -239,6 +241,7 @@ class QueryControllerSpec extends Specification { return NetworkData.builder().dataspace(myDataspace) .schemaSet(mySchemaset).anchor(myAnchor).payload('{"message" : "Hello World"}') .observedTimestamp(OffsetDateTime.now()) + .operation(Operation.CREATE) .createdTimestamp(OffsetDateTime.now()).build() } @@ -248,6 +251,7 @@ class QueryControllerSpec extends Specification { anchorDetails.setAnchor(networkData.getAnchor()) anchorDetails.setSchemaSet(networkData.getSchemaSet()) anchorDetails.setObservedTimestamp(DateTimeUtility.toString(networkData.getObservedTimestamp())) + anchorDetails.setOperation(AnchorDetails.OperationEnum.valueOf(networkData.getOperation().toString())) anchorDetails.setData(networkData.getPayload()) return anchorDetails } diff --git a/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositoryImplSpec.groovy b/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositoryImplSpec.groovy index d33df75..ad7ea75 100644 --- a/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositoryImplSpec.groovy +++ b/src/test/groovy/org/onap/cps/temporal/repository/NetworkDataRepositoryImplSpec.groovy @@ -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. @@ -21,6 +21,7 @@ package org.onap.cps.temporal.repository import org.onap.cps.temporal.domain.NetworkData +import org.onap.cps.temporal.domain.Operation import org.onap.cps.temporal.domain.SearchCriteria import org.onap.cps.temporal.repository.containers.TimescaleContainer import org.springframework.beans.factory.annotation.Autowired @@ -118,6 +119,7 @@ class NetworkDataRepositoryImplSpec extends Specification { assert data.getObservedTimestamp().isAfter(observedAfter) || data.getObservedTimestamp().isEqual(observedAfter) assert data.getAnchor() == queryAnchorName assert data.getDataspace() == queryDataspaceName + assert data.getOperation() != null } } @@ -141,6 +143,7 @@ class NetworkDataRepositoryImplSpec extends Specification { assert data.getCreatedTimestamp().isBefore(createdBefore) || data.getCreatedTimestamp().isEqual(createdBefore) assert data.getAnchor() == queryAnchorName assert data.getDataspace() == queryDataspaceName + assert data.getOperation() != null } } |