diff options
author | sourabh_sourabh <sourabh.sourabh@est.tech> | 2023-08-15 12:15:33 +0100 |
---|---|---|
committer | sourabh_sourabh <sourabh.sourabh@est.tech> | 2023-08-18 12:43:48 +0100 |
commit | 17aab0023e514cfe99b70ea161b271c9e42c5667 (patch) | |
tree | ef37ad266262058ea027308eac48aba150714196 /cps-service | |
parent | a92d488934c016f0f2645382f7fcdec0ad446f2e (diff) |
CPS-Core : Expose a java interface to update schema set
- Exposed an interface to update anchor by schema set name.
- New interface is implemented into RI model.
- New native query is exposed to update id with given schema set name.
- A new integration test is written to test new interface into cps core.
Issue-ID: CPS-1800
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Change-Id: Ibf44712e11b53cb6673b04b9e3fd864321c90839
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-service')
4 files changed, 32 insertions, 0 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java index fcf3f54cce..edd052a51c 100755 --- a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java +++ b/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java @@ -135,4 +135,13 @@ public interface CpsAdminService { * given module names */ Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames); + + /** + * Update schema set of an anchor. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @param schemaSetName schema set name + */ + void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName); } diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java index e286eea173..d83ee434de 100755 --- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java +++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java @@ -120,4 +120,11 @@ public class CpsAdminServiceImpl implements CpsAdminService { final Collection<Anchor> anchors = cpsAdminPersistenceService.queryAnchors(dataspaceName, moduleNames); return anchors.stream().map(Anchor::getName).collect(Collectors.toList()); } + + @Override + public void updateAnchorSchemaSet(final String dataspaceName, + final String anchorName, + final String schemaSetName) { + cpsAdminPersistenceService.updateAnchorSchemaSet(dataspaceName, anchorName, schemaSetName); + } } diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java index 1c1e80a20f..5a1810f473 100755 --- a/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java +++ b/cps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java @@ -133,4 +133,13 @@ public interface CpsAdminPersistenceService { * @param anchorNames anchor names */ void deleteAnchors(String dataspaceName, Collection<String> anchorNames); + + /** + * Delete anchors by name in given dataspace. + * + * @param dataspaceName dataspace name + * @param anchorName anchor name + * @param schemaSetName schema set name + */ + void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName); } diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy index eb41e2085f..12564fb6d4 100755 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy @@ -178,4 +178,11 @@ class CpsAdminServiceImplSpec extends Specification { and: 'the CpsValidator is called on the dataspaceName' 1 * mockCpsValidator.validateNameCharacters('someDataspace') } + + def 'Update anchor schema set.'() { + when: 'update anchor is invoked' + objectUnderTest.updateAnchorSchemaSet('someDataspace', 'someAnchor', 'someSchemaSetName') + then: 'associated persistence service method is invoked with correct parameter' + 1 * mockCpsAdminPersistenceService.updateAnchorSchemaSet('someDataspace', 'someAnchor', 'someSchemaSetName') + } } |