summaryrefslogtreecommitdiffstats
path: root/cps-service
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service')
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java4
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/spi/CpsAdminPersistenceService.java2
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy4
3 files changed, 4 insertions, 6 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java
index f09a795a66..aa9c45d09a 100644
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java
@@ -21,7 +21,6 @@
package org.onap.cps.api.impl;
import java.util.Collection;
-import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.spi.CpsAdminPersistenceService;
@@ -87,8 +86,7 @@ public class CpsAnchorServiceImpl implements CpsAnchorService {
@Override
public Collection<String> queryAnchorNames(final String dataspaceName, final Collection<String> moduleNames) {
cpsValidator.validateNameCharacters(dataspaceName);
- final Collection<Anchor> anchors = cpsAdminPersistenceService.queryAnchors(dataspaceName, moduleNames);
- return anchors.stream().map(Anchor::getName).collect(Collectors.toList());
+ return cpsAdminPersistenceService.queryAnchorNames(dataspaceName, moduleNames);
}
@Override
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 5a1810f473..2b21619cb7 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
@@ -107,7 +107,7 @@ public interface CpsAdminPersistenceService {
* @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
* given module names
*/
- Collection<Anchor> queryAnchors(String dataspaceName, Collection<String> moduleNames);
+ Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames);
/**
* Get an anchor in the given dataspace using the anchor name.
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy
index 3546b81671..c7865386bc 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy
@@ -118,7 +118,7 @@ class CpsAnchorServiceImplSpec extends Specification {
def 'Query all anchor identifiers for a dataspace and module names.'() {
given: 'the persistence service is invoked with the expected parameters and returns a list of anchors'
- mockCpsAdminPersistenceService.queryAnchors('some-dataspace-name', ['some-module-name']) >> [new Anchor(name:'some-anchor-identifier')]
+ mockCpsAdminPersistenceService.queryAnchorNames('some-dataspace-name', ['some-module-name']) >> ['some-anchor-identifier']
when: 'query anchor names is called using a dataspace name and module name'
def result = objectUnderTest.queryAnchorNames('some-dataspace-name', ['some-module-name'])
then: 'get anchor identifiers returns the same anchor identifier returned by the persistence layer'
@@ -130,7 +130,7 @@ class CpsAnchorServiceImplSpec extends Specification {
def 'Query all anchors with Module Names Not Found Exception in persistence layer.'() {
given: 'the persistence layer throws a Module Names Not Found Exception'
def originalException = new ModuleNamesNotFoundException('exception-ds', ['m1', 'm2'])
- mockCpsAdminPersistenceService.queryAnchors(*_) >> { throw originalException}
+ mockCpsAdminPersistenceService.queryAnchorNames(*_) >> { throw originalException}
when: 'attempt query anchors'
objectUnderTest.queryAnchorNames('some-dataspace-name', [])
then: 'the same exception is thrown (up)'