diff options
author | Toine Siebelink <toine.siebelink@est.tech> | 2022-01-13 10:05:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-01-13 10:05:29 +0000 |
commit | fc0ec237b82e0e80685de45c8db5741638e031d7 (patch) | |
tree | dd8e8f47eac918425777d573e1d388a3d67115a1 /src | |
parent | 38e50f6f932ab170203362ed6513d41f0e2d9b0f (diff) | |
parent | cb23b1771e3fc552090f80791b852ce8ad05f150 (diff) |
Merge "Support operation field for CPS Temporal Query Output API"
Diffstat (limited to 'src')
-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 } } |