summaryrefslogtreecommitdiffstats
path: root/cps-service
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service')
-rw-r--r--[-rwxr-xr-x]cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java (renamed from cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java)45
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/CpsDataspaceService.java66
-rw-r--r--[-rwxr-xr-x]cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java (renamed from cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java)56
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java22
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java64
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java12
-rw-r--r--cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java6
-rw-r--r--[-rwxr-xr-x]cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy (renamed from cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy)60
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy16
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy67
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy21
-rwxr-xr-xcps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy12
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy8
13 files changed, 273 insertions, 182 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/CpsAnchorService.java
index edd052a51c..a247150c15 100755..100644
--- a/cps-service/src/main/java/org/onap/cps/api/CpsAdminService.java
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsAnchorService.java
@@ -1,9 +1,6 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020-2023 Nordix Foundation
- * Modifications Copyright (C) 2020-2022 Bell Canada.
- * Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2022 TechMahindra Ltd.
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,46 +21,10 @@
package org.onap.cps.api;
import java.util.Collection;
-import org.onap.cps.spi.exceptions.AlreadyDefinedException;
import org.onap.cps.spi.exceptions.CpsException;
import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.Dataspace;
-/**
- * CPS Admin Service.
- */
-public interface CpsAdminService {
-
- /**
- * Create dataspace.
- *
- * @param dataspaceName dataspace name
- * @throws AlreadyDefinedException if dataspace with same name already exists
- */
- void createDataspace(String dataspaceName);
-
- /**
- * Delete dataspace.
- *
- * @param dataspaceName the name of the dataspace to delete
- */
- void deleteDataspace(String dataspaceName);
-
- /**
- * Get dataspace by given dataspace name.
- *
- * @param dataspaceName dataspace name
- * @return a dataspace
- */
- Dataspace getDataspace(String dataspaceName);
-
- /**
- * Get All Dataspaces.
- *
- *
- * @return a collection of dataspaces
- */
- Collection<Dataspace> getAllDataspaces();
+public interface CpsAnchorService {
/**
* Create an Anchor.
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsDataspaceService.java b/cps-service/src/main/java/org/onap/cps/api/CpsDataspaceService.java
new file mode 100644
index 0000000000..7b94604261
--- /dev/null
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsDataspaceService.java
@@ -0,0 +1,66 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020-2023 Nordix Foundation
+ * Modifications Copyright (C) 2020-2022 Bell Canada.
+ * Modifications Copyright (C) 2021 Pantheon.tech
+ * Modifications Copyright (C) 2022 TechMahindra Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.api;
+
+import java.util.Collection;
+import org.onap.cps.spi.exceptions.AlreadyDefinedException;
+import org.onap.cps.spi.model.Dataspace;
+
+/**
+ * CPS Admin Service.
+ */
+public interface CpsDataspaceService {
+
+ /**
+ * Create dataspace.
+ *
+ * @param dataspaceName dataspace name
+ * @throws AlreadyDefinedException if dataspace with same name already exists
+ */
+ void createDataspace(String dataspaceName);
+
+ /**
+ * Delete dataspace.
+ *
+ * @param dataspaceName the name of the dataspace to delete
+ */
+ void deleteDataspace(String dataspaceName);
+
+ /**
+ * Get dataspace by given dataspace name.
+ *
+ * @param dataspaceName dataspace name
+ * @return a dataspace
+ */
+ Dataspace getDataspace(String dataspaceName);
+
+ /**
+ * Get All Dataspaces.
+ *
+ *
+ * @return a collection of dataspaces
+ */
+ Collection<Dataspace> getAllDataspaces();
+
+}
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/CpsAnchorServiceImpl.java
index d83ee434de..f09a795a66 100755..100644
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsAdminServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsAnchorServiceImpl.java
@@ -1,9 +1,6 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020-2023 Nordix Foundation
- * Modifications Copyright (C) 2020-2022 Bell Canada.
- * Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2022 TechMahindra Ltd.
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,52 +20,25 @@
package org.onap.cps.api.impl;
-import java.time.OffsetDateTime;
import java.util.Collection;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
-import org.onap.cps.api.CpsAdminService;
-import org.onap.cps.api.CpsDataService;
+import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.spi.CpsAdminPersistenceService;
+import org.onap.cps.spi.CpsDataPersistenceService;
import org.onap.cps.spi.model.Anchor;
-import org.onap.cps.spi.model.Dataspace;
import org.onap.cps.spi.utils.CpsValidator;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
-@Component("CpsAdminServiceImpl")
-@RequiredArgsConstructor(onConstructor = @__(@Lazy))
-public class CpsAdminServiceImpl implements CpsAdminService {
+@Service
+@RequiredArgsConstructor
+public class CpsAnchorServiceImpl implements CpsAnchorService {
private final CpsAdminPersistenceService cpsAdminPersistenceService;
- @Lazy
- private final CpsDataService cpsDataService;
+ private final CpsDataPersistenceService cpsDataPersistenceService;
private final CpsValidator cpsValidator;
@Override
- public void createDataspace(final String dataspaceName) {
- cpsValidator.validateNameCharacters(dataspaceName);
- cpsAdminPersistenceService.createDataspace(dataspaceName);
- }
-
- @Override
- public void deleteDataspace(final String dataspaceName) {
- cpsValidator.validateNameCharacters(dataspaceName);
- cpsAdminPersistenceService.deleteDataspace(dataspaceName);
- }
-
- @Override
- public Dataspace getDataspace(final String dataspaceName) {
- cpsValidator.validateNameCharacters(dataspaceName);
- return cpsAdminPersistenceService.getDataspace(dataspaceName);
- }
-
- @Override
- public Collection<Dataspace> getAllDataspaces() {
- return cpsAdminPersistenceService.getAllDataspaces();
- }
-
- @Override
public void createAnchor(final String dataspaceName, final String schemaSetName, final String anchorName) {
cpsValidator.validateNameCharacters(dataspaceName, schemaSetName, anchorName);
cpsAdminPersistenceService.createAnchor(dataspaceName, schemaSetName, anchorName);
@@ -102,7 +72,7 @@ public class CpsAdminServiceImpl implements CpsAdminService {
@Override
public void deleteAnchor(final String dataspaceName, final String anchorName) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- cpsDataService.deleteDataNodes(dataspaceName, anchorName, OffsetDateTime.now());
+ cpsDataPersistenceService.deleteDataNodes(dataspaceName, anchorName);
cpsAdminPersistenceService.deleteAnchor(dataspaceName, anchorName);
}
@@ -110,7 +80,7 @@ public class CpsAdminServiceImpl implements CpsAdminService {
public void deleteAnchors(final String dataspaceName, final Collection<String> anchorNames) {
cpsValidator.validateNameCharacters(dataspaceName);
cpsValidator.validateNameCharacters(anchorNames);
- cpsDataService.deleteDataNodes(dataspaceName, anchorNames, OffsetDateTime.now());
+ cpsDataPersistenceService.deleteDataNodes(dataspaceName, anchorNames);
cpsAdminPersistenceService.deleteAnchors(dataspaceName, anchorNames);
}
@@ -123,8 +93,8 @@ public class CpsAdminServiceImpl implements CpsAdminService {
@Override
public void updateAnchorSchemaSet(final String dataspaceName,
- final String anchorName,
- final String schemaSetName) {
+ final String anchorName,
+ final String schemaSetName) {
cpsAdminPersistenceService.updateAnchorSchemaSet(dataspaceName, anchorName, schemaSetName);
}
}
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
index 6672d6883f..a1bae6a441 100755
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
@@ -35,7 +35,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.onap.cps.api.CpsAdminService;
+import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsDataService;
import org.onap.cps.api.CpsDeltaService;
import org.onap.cps.cpspath.parser.CpsPathUtil;
@@ -62,7 +62,7 @@ public class CpsDataServiceImpl implements CpsDataService {
private static final long DEFAULT_LOCK_TIMEOUT_IN_MILLISECONDS = 300L;
private final CpsDataPersistenceService cpsDataPersistenceService;
- private final CpsAdminService cpsAdminService;
+ private final CpsAnchorService cpsAnchorService;
private final YangTextSchemaSourceSetCache yangTextSchemaSourceSetCache;
private final CpsValidator cpsValidator;
private final TimedYangParser timedYangParser;
@@ -80,7 +80,7 @@ public class CpsDataServiceImpl implements CpsDataService {
public void saveData(final String dataspaceName, final String anchorName, final String nodeData,
final OffsetDateTime observedTimestamp, final ContentType contentType) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodes = buildDataNodes(anchor, ROOT_NODE_XPATH, nodeData, contentType);
cpsDataPersistenceService.storeDataNodes(dataspaceName, anchorName, dataNodes);
}
@@ -98,7 +98,7 @@ public class CpsDataServiceImpl implements CpsDataService {
final String nodeData, final OffsetDateTime observedTimestamp,
final ContentType contentType) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodes = buildDataNodes(anchor, parentNodeXpath, nodeData, contentType);
cpsDataPersistenceService.addChildDataNodes(dataspaceName, anchorName, parentNodeXpath, dataNodes);
}
@@ -109,7 +109,7 @@ public class CpsDataServiceImpl implements CpsDataService {
public void saveListElements(final String dataspaceName, final String anchorName,
final String parentNodeXpath, final String jsonData, final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> listElementDataNodeCollection =
buildDataNodes(anchor, parentNodeXpath, jsonData, ContentType.JSON);
if (isRootNodeXpath(parentNodeXpath)) {
@@ -126,7 +126,7 @@ public class CpsDataServiceImpl implements CpsDataService {
public void saveListElementsBatch(final String dataspaceName, final String anchorName, final String parentNodeXpath,
final Collection<String> jsonDataList, final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<Collection<DataNode>> listElementDataNodeCollections =
buildDataNodes(anchor, parentNodeXpath, jsonDataList, ContentType.JSON);
cpsDataPersistenceService.addMultipleLists(dataspaceName, anchorName, parentNodeXpath,
@@ -160,7 +160,7 @@ public class CpsDataServiceImpl implements CpsDataService {
public void updateNodeLeaves(final String dataspaceName, final String anchorName, final String parentNodeXpath,
final String jsonData, final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodesInPatch = buildDataNodes(anchor, parentNodeXpath, jsonData,
ContentType.JSON);
final Map<String, Map<String, Serializable>> xpathToUpdatedLeaves = dataNodesInPatch.stream()
@@ -176,7 +176,7 @@ public class CpsDataServiceImpl implements CpsDataService {
final String dataNodeUpdatesAsJson,
final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodeUpdates =
buildDataNodes(anchor, parentNodeXpath, dataNodeUpdatesAsJson, ContentType.JSON);
for (final DataNode dataNodeUpdate : dataNodeUpdates) {
@@ -228,7 +228,7 @@ public class CpsDataServiceImpl implements CpsDataService {
final String parentNodeXpath, final String jsonData,
final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodes = buildDataNodes(anchor, parentNodeXpath, jsonData, ContentType.JSON);
cpsDataPersistenceService.updateDataNodesAndDescendants(dataspaceName, anchorName, dataNodes);
}
@@ -240,7 +240,7 @@ public class CpsDataServiceImpl implements CpsDataService {
final Map<String, String> nodesJsonData,
final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> dataNodes = buildDataNodes(anchor, nodesJsonData);
cpsDataPersistenceService.updateDataNodesAndDescendants(dataspaceName, anchorName, dataNodes);
}
@@ -251,7 +251,7 @@ public class CpsDataServiceImpl implements CpsDataService {
public void replaceListContent(final String dataspaceName, final String anchorName, final String parentNodeXpath,
final String jsonData, final OffsetDateTime observedTimestamp) {
cpsValidator.validateNameCharacters(dataspaceName, anchorName);
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final Collection<DataNode> newListElements =
buildDataNodes(anchor, parentNodeXpath, jsonData, ContentType.JSON);
replaceListContent(dataspaceName, anchorName, parentNodeXpath, newListElements, observedTimestamp);
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java
new file mode 100644
index 0000000000..a7f5da4874
--- /dev/null
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataspaceServiceImpl.java
@@ -0,0 +1,64 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020-2023 Nordix Foundation
+ * Modifications Copyright (C) 2020-2022 Bell Canada.
+ * Modifications Copyright (C) 2021 Pantheon.tech
+ * Modifications Copyright (C) 2022 TechMahindra Ltd.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.api.impl;
+
+import java.util.Collection;
+import lombok.RequiredArgsConstructor;
+import org.onap.cps.api.CpsDataspaceService;
+import org.onap.cps.spi.CpsAdminPersistenceService;
+import org.onap.cps.spi.model.Dataspace;
+import org.onap.cps.spi.utils.CpsValidator;
+import org.springframework.stereotype.Service;
+
+@Service
+@RequiredArgsConstructor
+public class CpsDataspaceServiceImpl implements CpsDataspaceService {
+
+ private final CpsAdminPersistenceService cpsAdminPersistenceService;
+ private final CpsValidator cpsValidator;
+
+ @Override
+ public void createDataspace(final String dataspaceName) {
+ cpsValidator.validateNameCharacters(dataspaceName);
+ cpsAdminPersistenceService.createDataspace(dataspaceName);
+ }
+
+ @Override
+ public void deleteDataspace(final String dataspaceName) {
+ cpsValidator.validateNameCharacters(dataspaceName);
+ cpsAdminPersistenceService.deleteDataspace(dataspaceName);
+ }
+
+ @Override
+ public Dataspace getDataspace(final String dataspaceName) {
+ cpsValidator.validateNameCharacters(dataspaceName);
+ return cpsAdminPersistenceService.getDataspace(dataspaceName);
+ }
+
+ @Override
+ public Collection<Dataspace> getAllDataspaces() {
+ return cpsAdminPersistenceService.getAllDataspaces();
+ }
+
+}
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java
index 5337237846..61a4e623af 100644
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java
@@ -28,7 +28,7 @@ import java.util.Collection;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
-import org.onap.cps.api.CpsAdminService;
+import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.CpsModuleService;
import org.onap.cps.spi.CascadeDeleteAllowed;
import org.onap.cps.spi.CpsModulePersistenceService;
@@ -49,7 +49,7 @@ public class CpsModuleServiceImpl implements CpsModuleService {
private final CpsModulePersistenceService cpsModulePersistenceService;
private final YangTextSchemaSourceSetCache yangTextSchemaSourceSetCache;
- private final CpsAdminService cpsAdminService;
+ private final CpsAnchorService cpsAnchorService;
private final CpsValidator cpsValidator;
private final TimedYangTextSchemaSourceSetBuilder timedYangTextSchemaSourceSetBuilder;
@@ -97,12 +97,12 @@ public class CpsModuleServiceImpl implements CpsModuleService {
public void deleteSchemaSet(final String dataspaceName, final String schemaSetName,
final CascadeDeleteAllowed cascadeDeleteAllowed) {
cpsValidator.validateNameCharacters(dataspaceName, schemaSetName);
- final Collection<Anchor> anchors = cpsAdminService.getAnchors(dataspaceName, schemaSetName);
+ final Collection<Anchor> anchors = cpsAnchorService.getAnchors(dataspaceName, schemaSetName);
if (!anchors.isEmpty() && isCascadeDeleteProhibited(cascadeDeleteAllowed)) {
throw new SchemaSetInUseException(dataspaceName, schemaSetName);
}
for (final Anchor anchor : anchors) {
- cpsAdminService.deleteAnchor(dataspaceName, anchor.getName());
+ cpsAnchorService.deleteAnchor(dataspaceName, anchor.getName());
}
cpsModulePersistenceService.deleteSchemaSet(dataspaceName, schemaSetName);
yangTextSchemaSourceSetCache.removeFromCache(dataspaceName, schemaSetName);
@@ -114,9 +114,9 @@ public class CpsModuleServiceImpl implements CpsModuleService {
public void deleteSchemaSetsWithCascade(final String dataspaceName, final Collection<String> schemaSetNames) {
cpsValidator.validateNameCharacters(dataspaceName);
cpsValidator.validateNameCharacters(schemaSetNames);
- final Collection<String> anchorNames = cpsAdminService.getAnchors(dataspaceName, schemaSetNames)
+ final Collection<String> anchorNames = cpsAnchorService.getAnchors(dataspaceName, schemaSetNames)
.stream().map(Anchor::getName).collect(Collectors.toSet());
- cpsAdminService.deleteAnchors(dataspaceName, anchorNames);
+ cpsAnchorService.deleteAnchors(dataspaceName, anchorNames);
cpsModulePersistenceService.deleteUnusedYangResourceModules();
cpsModulePersistenceService.deleteSchemaSets(dataspaceName, schemaSetNames);
for (final String schemaSetName : schemaSetNames) {
diff --git a/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java b/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
index d58ddf4fa9..35dc7347b2 100644
--- a/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
+++ b/cps-service/src/main/java/org/onap/cps/utils/PrefixResolver.java
@@ -26,7 +26,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import lombok.RequiredArgsConstructor;
-import org.onap.cps.api.CpsAdminService;
+import org.onap.cps.api.CpsAnchorService;
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache;
import org.onap.cps.cache.AnchorDataCacheEntry;
import org.onap.cps.cpspath.parser.CpsPathPrefixType;
@@ -48,7 +48,7 @@ public class PrefixResolver {
private static final String CACHE_ENTRY_PROPERTY_NAME = "prefixPerContainerName";
- private final CpsAdminService cpsAdminService;
+ private final CpsAnchorService cpsAnchorService;
private final YangTextSchemaSourceSetCache yangTextSchemaSourceSetCache;
@@ -63,7 +63,7 @@ public class PrefixResolver {
* @return the prefix of the module the top level element of given xpath
*/
public String getPrefix(final String dataspaceName, final String anchorName, final String xpath) {
- final Anchor anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final Anchor anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
return getPrefix(anchor, xpath);
}
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/CpsAnchorServiceImplSpec.groovy
index 12564fb6d4..3546b81671 100755..100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAnchorServiceImplSpec.groovy
@@ -1,9 +1,6 @@
/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020-2023 Nordix Foundation
- * Modifications Copyright (C) 2020-2022 Bell Canada.
- * Modifications Copyright (C) 2021 Pantheon.tech
- * Modifications Copyright (C) 2022 TechMahindra Ltd.
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,29 +20,20 @@
package org.onap.cps.api.impl
-import org.onap.cps.api.CpsDataService
import org.onap.cps.spi.CpsAdminPersistenceService
+import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.spi.exceptions.ModuleNamesNotFoundException
import org.onap.cps.spi.model.Anchor
-import org.onap.cps.spi.model.Dataspace
import org.onap.cps.spi.utils.CpsValidator
import spock.lang.Specification
-import java.time.OffsetDateTime
-class CpsAdminServiceImplSpec extends Specification {
+class CpsAnchorServiceImplSpec extends Specification {
+
def mockCpsAdminPersistenceService = Mock(CpsAdminPersistenceService)
- def mockCpsDataService = Mock(CpsDataService)
+ def mockCpsDataPersistenceService = Mock(CpsDataPersistenceService)
def mockCpsValidator = Mock(CpsValidator)
- def objectUnderTest = new CpsAdminServiceImpl(mockCpsAdminPersistenceService, mockCpsDataService,mockCpsValidator)
- def 'Create dataspace method invokes persistence service.'() {
- when: 'create dataspace method is invoked'
- objectUnderTest.createDataspace('someDataspace')
- then: 'the persistence service method is invoked with same parameters'
- 1 * mockCpsAdminPersistenceService.createDataspace('someDataspace')
- and: 'the CpsValidator is called on the dataspaceName'
- 1 * mockCpsValidator.validateNameCharacters('someDataspace')
- }
+ def objectUnderTest = new CpsAnchorServiceImpl(mockCpsAdminPersistenceService, mockCpsDataPersistenceService, mockCpsValidator)
def 'Create anchor method invokes persistence service.'() {
when: 'create anchor method is invoked'
@@ -105,29 +93,13 @@ class CpsAdminServiceImplSpec extends Specification {
1 * mockCpsValidator.validateNameCharacters('someDataspace', 'someAnchor')
}
- def 'Retrieve dataspace.'() {
- given: 'a dataspace is already created'
- def dataspace = new Dataspace(name: "someDataspace")
- mockCpsAdminPersistenceService.getDataspace('someDataspace') >> dataspace
- expect: 'the dataspace provided by persistence service is returned as result'
- assert objectUnderTest.getDataspace('someDataspace') == dataspace
- }
-
- def 'Retrieve all dataspaces.'() {
- given: 'that all given dataspaces are already created'
- def dataspaces = [new Dataspace(name: "test-dataspace1"), new Dataspace(name: "test-dataspace2")]
- mockCpsAdminPersistenceService.getAllDataspaces() >> dataspaces
- expect: 'the dataspace provided by persistence service is returned as result'
- assert objectUnderTest.getAllDataspaces() == dataspaces
- }
-
def 'Delete anchor.'() {
when: 'delete anchor is invoked'
objectUnderTest.deleteAnchor('someDataspace','someAnchor')
then: 'delete data nodes is invoked on the data service with expected parameters'
- 1 * mockCpsDataService.deleteDataNodes('someDataspace','someAnchor', _ as OffsetDateTime )
+ 1 * mockCpsDataPersistenceService.deleteDataNodes('someDataspace','someAnchor')
and: 'the persistence service method is invoked with same parameters to delete anchor'
- 1 * mockCpsAdminPersistenceService.deleteAnchor('someDataspace','someAnchor')
+ 1 * mockCpsAdminPersistenceService.deleteAnchor('someDataspace','someAnchor')
and: 'the CpsValidator is called on the dataspaceName, anchorName'
1 * mockCpsValidator.validateNameCharacters('someDataspace', 'someAnchor')
}
@@ -136,7 +108,7 @@ class CpsAdminServiceImplSpec extends Specification {
when: 'delete anchors is invoked'
objectUnderTest.deleteAnchors('someDataspace', ['anchor1', 'anchor2'])
then: 'delete data nodes is invoked on the data service with expected parameters'
- 1 * mockCpsDataService.deleteDataNodes('someDataspace', _ as Collection<String>, _ as OffsetDateTime)
+ 1 * mockCpsDataPersistenceService.deleteDataNodes('someDataspace', _ as Collection<String>)
and: 'the persistence service method is invoked with same parameters to delete anchor'
1 * mockCpsAdminPersistenceService.deleteAnchors('someDataspace',_ as Collection<String>)
and: 'the CpsValidator is called on the dataspace name and anchor names'
@@ -157,7 +129,7 @@ class CpsAdminServiceImplSpec 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'])
+ def originalException = new ModuleNamesNotFoundException('exception-ds', ['m1', 'm2'])
mockCpsAdminPersistenceService.queryAnchors(*_) >> { throw originalException}
when: 'attempt query anchors'
objectUnderTest.queryAnchorNames('some-dataspace-name', [])
@@ -170,19 +142,11 @@ class CpsAdminServiceImplSpec extends Specification {
assert thrownUp.details.contains('m2')
}
- def 'Delete dataspace.'() {
- when: 'delete dataspace is invoked'
- objectUnderTest.deleteDataspace('someDataspace')
- then: 'associated persistence service method is invoked with correct parameter'
- 1 * mockCpsAdminPersistenceService.deleteDataspace('someDataspace')
- 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')
}
+
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
index 6ff708a6ea..77e15c320e 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
@@ -24,7 +24,7 @@
package org.onap.cps.api.impl
import org.onap.cps.TestUtils
-import org.onap.cps.api.CpsAdminService
+import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDeltaService
import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.spi.FetchDescendantsOption
@@ -43,26 +43,24 @@ import org.onap.cps.yang.YangTextSchemaSourceSet
import org.onap.cps.yang.YangTextSchemaSourceSetBuilder
import spock.lang.Shared
import spock.lang.Specification
-
import java.time.OffsetDateTime
import java.util.stream.Collectors
class CpsDataServiceImplSpec extends Specification {
def mockCpsDataPersistenceService = Mock(CpsDataPersistenceService)
- def mockCpsAdminService = Mock(CpsAdminService)
+ def mockCpsAnchorService = Mock(CpsAnchorService)
def mockYangTextSchemaSourceSetCache = Mock(YangTextSchemaSourceSetCache)
def mockCpsValidator = Mock(CpsValidator)
def timedYangParser = new TimedYangParser()
def mockCpsDeltaService = Mock(CpsDeltaService);
- def objectUnderTest = new CpsDataServiceImpl(mockCpsDataPersistenceService, mockCpsAdminService,
+ def objectUnderTest = new CpsDataServiceImpl(mockCpsDataPersistenceService, mockCpsAnchorService,
mockYangTextSchemaSourceSetCache, mockCpsValidator, timedYangParser, mockCpsDeltaService)
def setup() {
-
- mockCpsAdminService.getAnchor(dataspaceName, anchorName) >> anchor
- mockCpsAdminService.getAnchor(dataspaceName, ANCHOR_NAME_1) >> anchor1
- mockCpsAdminService.getAnchor(dataspaceName, ANCHOR_NAME_2) >> anchor2
+ mockCpsAnchorService.getAnchor(dataspaceName, anchorName) >> anchor
+ mockCpsAnchorService.getAnchor(dataspaceName, ANCHOR_NAME_1) >> anchor1
+ mockCpsAnchorService.getAnchor(dataspaceName, ANCHOR_NAME_2) >> anchor2
}
@Shared
@@ -426,7 +424,7 @@ class CpsDataServiceImplSpec extends Specification {
def 'Delete all data nodes for given dataspace and multiple anchors.'() {
given: 'schema set for given anchors and dataspace references test tree model'
setupSchemaSetMocks('test-tree.yang')
- mockCpsAdminService.getAnchors(dataspaceName, ['anchor1', 'anchor2']) >>
+ mockCpsAnchorService.getAnchors(dataspaceName, ['anchor1', 'anchor2']) >>
[new Anchor(name: 'anchor1', dataspaceName: dataspaceName),
new Anchor(name: 'anchor2', dataspaceName: dataspaceName)]
when: 'delete data node method is invoked with correct parameters'
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy
new file mode 100644
index 0000000000..8e17594bd1
--- /dev/null
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataspaceServiceImplSpec.groovy
@@ -0,0 +1,67 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2023 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.cps.api.impl
+
+import org.onap.cps.spi.CpsAdminPersistenceService
+import org.onap.cps.spi.model.Dataspace
+import org.onap.cps.spi.utils.CpsValidator
+import spock.lang.Specification
+
+class CpsDataspaceServiceImplSpec extends Specification {
+ def mockCpsAdminPersistenceService = Mock(CpsAdminPersistenceService)
+ def mockCpsValidator = Mock(CpsValidator)
+ def objectUnderTest = new CpsDataspaceServiceImpl(mockCpsAdminPersistenceService,mockCpsValidator)
+
+ def 'Create dataspace method invokes persistence service.'() {
+ when: 'create dataspace method is invoked'
+ objectUnderTest.createDataspace('someDataspace')
+ then: 'the persistence service method is invoked with same parameters'
+ 1 * mockCpsAdminPersistenceService.createDataspace('someDataspace')
+ and: 'the CpsValidator is called on the dataspaceName'
+ 1 * mockCpsValidator.validateNameCharacters('someDataspace')
+ }
+
+ def 'Retrieve dataspace.'() {
+ given: 'a dataspace is already created'
+ def dataspace = new Dataspace(name: "someDataspace")
+ mockCpsAdminPersistenceService.getDataspace('someDataspace') >> dataspace
+ expect: 'the dataspace provided by persistence service is returned as result'
+ assert objectUnderTest.getDataspace('someDataspace') == dataspace
+ }
+
+ def 'Retrieve all dataspaces.'() {
+ given: 'that all given dataspaces are already created'
+ def dataspaces = [new Dataspace(name: "test-dataspace1"), new Dataspace(name: "test-dataspace2")]
+ mockCpsAdminPersistenceService.getAllDataspaces() >> dataspaces
+ expect: 'the dataspace provided by persistence service is returned as result'
+ assert objectUnderTest.getAllDataspaces() == dataspaces
+ }
+
+ def 'Delete dataspace.'() {
+ when: 'delete dataspace is invoked'
+ objectUnderTest.deleteDataspace('someDataspace')
+ then: 'associated persistence service method is invoked with correct parameter'
+ 1 * mockCpsAdminPersistenceService.deleteDataspace('someDataspace')
+ and: 'the CpsValidator is called on the dataspaceName'
+ 1 * mockCpsValidator.validateNameCharacters('someDataspace')
+ }
+
+}
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
index d8edb02abd..d909e27abf 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
@@ -23,11 +23,12 @@
package org.onap.cps.api.impl
+import org.onap.cps.api.CpsAnchorService
+
import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_ALLOWED
import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
import org.onap.cps.TestUtils
-import org.onap.cps.api.CpsAdminService
import org.onap.cps.spi.CpsModulePersistenceService
import org.onap.cps.spi.exceptions.DuplicatedYangResourceException
import org.onap.cps.spi.exceptions.ModelValidationException
@@ -45,12 +46,12 @@ import spock.lang.Specification
class CpsModuleServiceImplSpec extends Specification {
def mockCpsModulePersistenceService = Mock(CpsModulePersistenceService)
- def mockCpsAdminService = Mock(CpsAdminService)
def mockYangTextSchemaSourceSetCache = Mock(YangTextSchemaSourceSetCache)
+ def mockCpsAnchorService = Mock(CpsAnchorService)
def mockCpsValidator = Mock(CpsValidator)
def timedYangTextSchemaSourceSetBuilder = new TimedYangTextSchemaSourceSetBuilder()
- def objectUnderTest = new CpsModuleServiceImpl(mockCpsModulePersistenceService, mockYangTextSchemaSourceSetCache, mockCpsAdminService, mockCpsValidator,timedYangTextSchemaSourceSetBuilder)
+ def objectUnderTest = new CpsModuleServiceImpl(mockCpsModulePersistenceService, mockYangTextSchemaSourceSetCache, mockCpsAnchorService, mockCpsValidator,timedYangTextSchemaSourceSetBuilder)
def 'Create schema set.'() {
when: 'Create schema set method is invoked'
@@ -133,11 +134,11 @@ class CpsModuleServiceImplSpec extends Specification {
def 'Delete schema-set when cascade is allowed.'() {
given: '#numberOfAnchors anchors are associated with schemaset'
def associatedAnchors = createAnchors(numberOfAnchors)
- mockCpsAdminService.getAnchors('my-dataspace', 'my-schemaset') >> associatedAnchors
+ mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> associatedAnchors
when: 'schema set deletion is requested with cascade allowed'
objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_ALLOWED)
then: 'anchor deletion is called #numberOfAnchors times'
- numberOfAnchors * mockCpsAdminService.deleteAnchor('my-dataspace', _)
+ numberOfAnchors * mockCpsAnchorService.deleteAnchor('my-dataspace', _)
and: 'persistence service method is invoked with same parameters'
1 * mockCpsModulePersistenceService.deleteSchemaSet('my-dataspace', 'my-schemaset')
and: 'schema set will be removed from the cache'
@@ -152,11 +153,11 @@ class CpsModuleServiceImplSpec extends Specification {
def 'Delete schema-set when cascade is prohibited.'() {
given: 'no anchors are associated with schemaset'
- mockCpsAdminService.getAnchors('my-dataspace', 'my-schemaset') >> Collections.emptyList()
+ mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> Collections.emptyList()
when: 'schema set deletion is requested with cascade allowed'
objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_PROHIBITED)
then: 'no anchors are deleted'
- 0 * mockCpsAdminService.deleteAnchor(_, _)
+ 0 * mockCpsAnchorService.deleteAnchor(_, _)
and: 'persistence service method is invoked with same parameters'
1 * mockCpsModulePersistenceService.deleteSchemaSet('my-dataspace', 'my-schemaset')
and: 'schema set will be removed from the cache'
@@ -169,7 +170,7 @@ class CpsModuleServiceImplSpec extends Specification {
def 'Delete schema-set when cascade is prohibited and schema-set has anchors.'() {
given: '2 anchors are associated with schemaset'
- mockCpsAdminService.getAnchors('my-dataspace', 'my-schemaset') >> createAnchors(2)
+ mockCpsAnchorService.getAnchors('my-dataspace', 'my-schemaset') >> createAnchors(2)
when: 'schema set deletion is requested with cascade allowed'
objectUnderTest.deleteSchemaSet('my-dataspace', 'my-schemaset', CASCADE_DELETE_PROHIBITED)
then: 'Schema-Set in Use exception is thrown'
@@ -178,11 +179,11 @@ class CpsModuleServiceImplSpec extends Specification {
def 'Delete multiple schema-sets when cascade is allowed.'() {
given: '#numberOfAnchors anchors are associated with each schemaset'
- mockCpsAdminService.getAnchors('my-dataspace', ['my-schemaset1', 'my-schemaset2']) >> createAnchors(numberOfAnchors * 2)
+ mockCpsAnchorService.getAnchors('my-dataspace', ['my-schemaset1', 'my-schemaset2']) >> createAnchors(numberOfAnchors * 2)
when: 'schema set deletion is requested with cascade allowed'
objectUnderTest.deleteSchemaSetsWithCascade('my-dataspace', ['my-schemaset1', 'my-schemaset2'])
then: 'anchor deletion is called #numberOfAnchors times'
- mockCpsAdminService.deleteAnchors('my-dataspace', _)
+ mockCpsAnchorService.deleteAnchors('my-dataspace', _)
and: 'persistence service method is invoked with same parameters'
mockCpsModulePersistenceService.deleteSchemaSets('my-dataspace', _)
and: 'schema sets will be removed from the cache'
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy
index 118ee1cd02..4782468f19 100755
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/E2ENetworkSliceSpec.groovy
@@ -24,7 +24,7 @@
package org.onap.cps.api.impl
import org.onap.cps.TestUtils
-import org.onap.cps.api.CpsAdminService
+import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.CpsDeltaService
import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.spi.CpsDataPersistenceService
@@ -40,7 +40,7 @@ import spock.lang.Specification
class E2ENetworkSliceSpec extends Specification {
def mockModuleStoreService = Mock(CpsModulePersistenceService)
def mockDataStoreService = Mock(CpsDataPersistenceService)
- def mockCpsAdminService = Mock(CpsAdminService)
+ def mockCpsAnchorService = Mock(CpsAnchorService)
def mockYangTextSchemaSourceSetCache = Mock(YangTextSchemaSourceSetCache)
def mockCpsValidator = Mock(CpsValidator)
def timedYangTextSchemaSourceSetBuilder = new TimedYangTextSchemaSourceSetBuilder()
@@ -48,9 +48,9 @@ class E2ENetworkSliceSpec extends Specification {
def mockCpsDeltaService = Mock(CpsDeltaService)
def cpsModuleServiceImpl = new CpsModuleServiceImpl(mockModuleStoreService,
- mockYangTextSchemaSourceSetCache, mockCpsAdminService, mockCpsValidator,timedYangTextSchemaSourceSetBuilder)
+ mockYangTextSchemaSourceSetCache, mockCpsAnchorService, mockCpsValidator,timedYangTextSchemaSourceSetBuilder)
- def cpsDataServiceImpl = new CpsDataServiceImpl(mockDataStoreService, mockCpsAdminService,
+ def cpsDataServiceImpl = new CpsDataServiceImpl(mockDataStoreService, mockCpsAnchorService,
mockYangTextSchemaSourceSetCache, mockCpsValidator, timedYangParser, mockCpsDeltaService)
def dataspaceName = 'someDataspace'
@@ -90,7 +90,7 @@ class E2ENetworkSliceSpec extends Specification {
and : 'a valid json is provided for the model'
def jsonData = TestUtils.getResourceFileContent('e2e/basic/cps-Cavsta-Data.txt')
and : 'all the further dependencies are mocked '
- mockCpsAdminService.getAnchor(dataspaceName, anchorName) >>
+ mockCpsAnchorService.getAnchor(dataspaceName, anchorName) >>
new Anchor().builder().name(anchorName).schemaSetName(schemaSetName).dataspaceName(dataspaceName).build()
mockYangTextSchemaSourceSetCache.get(dataspaceName, schemaSetName) >>
YangTextSchemaSourceSetBuilder.of(yangResourcesNameToContentMap)
@@ -123,7 +123,7 @@ class E2ENetworkSliceSpec extends Specification {
and : 'a valid json is provided for the model'
def jsonData = TestUtils.getResourceFileContent('e2e/basic/cps-ran-inventory-data.json')
and : 'all the further dependencies are mocked '
- mockCpsAdminService.getAnchor('someDataspace', 'someAnchor') >>
+ mockCpsAnchorService.getAnchor('someDataspace', 'someAnchor') >>
new Anchor().builder().name('someAnchor').schemaSetName('someSchemaSet').dataspaceName(dataspaceName).build()
mockYangTextSchemaSourceSetCache.get('someDataspace', 'someSchemaSet') >> YangTextSchemaSourceSetBuilder.of(yangResourcesNameToContentMap)
mockModuleStoreService.getYangSchemaResources('someDataspace', 'someSchemaSet') >> schemaContext
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
index ff6ab346f2..b975de6555 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy
@@ -24,7 +24,7 @@ package org.onap.cps.utils
import com.hazelcast.map.IMap
import org.onap.cps.TestUtils
-import org.onap.cps.api.CpsAdminService
+import org.onap.cps.api.CpsAnchorService
import org.onap.cps.api.impl.YangTextSchemaSourceSetCache
import org.onap.cps.cache.AnchorDataCacheEntry
import org.onap.cps.spi.model.Anchor
@@ -34,13 +34,13 @@ import spock.lang.Specification
class PrefixResolverSpec extends Specification {
- def mockCpsAdminService = Mock(CpsAdminService)
+ def mockCpsAnchorService = Mock(CpsAnchorService)
def mockYangTextSchemaSourceSetCache = Mock(YangTextSchemaSourceSetCache)
def mockAnchorDataCache = Mock(IMap<String, AnchorDataCacheEntry>)
- def objectUnderTest = new PrefixResolver(mockCpsAdminService, mockYangTextSchemaSourceSetCache, mockAnchorDataCache)
+ def objectUnderTest = new PrefixResolver(mockCpsAnchorService, mockYangTextSchemaSourceSetCache, mockAnchorDataCache)
def mockYangTextSchemaSourceSet = Mock(YangTextSchemaSourceSet)
@@ -52,7 +52,7 @@ class PrefixResolverSpec extends Specification {
given: 'an anchor for the test-tree model'
def anchor = new Anchor(dataspaceName: 'testDataspace', name: 'testAnchor')
and: 'the system can get this anchor'
- mockCpsAdminService.getAnchor('testDataspace', 'testAnchor') >> anchor
+ mockCpsAnchorService.getAnchor('testDataspace', 'testAnchor') >> anchor
and: 'the schema source cache contains the schema context for the test-tree module'
mockYangTextSchemaSourceSet.getSchemaContext() >> schemaContext
}