Move integration test (DataService)
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / impl / CpsDataPersistenceServiceImpl.java
index 3d2b87d..02f7230 100644 (file)
@@ -86,13 +86,6 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
     private static final String QUERY_ACROSS_ANCHORS = null;
     private static final AnchorEntity ALL_ANCHORS = null;
 
-    @Override
-    public void addChildDataNode(final String dataspaceName, final String anchorName, final String parentNodeXpath,
-                                 final DataNode newChildDataNode) {
-        final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName);
-        addNewChildDataNode(anchorEntity, parentNodeXpath, newChildDataNode);
-    }
-
     @Override
     public void addChildDataNodes(final String dataspaceName, final String anchorName,
                                   final String parentNodeXpath, final Collection<DataNode> dataNodes) {
@@ -225,7 +218,6 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
 
     private FragmentEntity toFragmentEntity(final AnchorEntity anchorEntity, final DataNode dataNode) {
         return FragmentEntity.builder()
-                .dataspace(anchorEntity.getDataspace())
                 .anchor(anchorEntity)
                 .xpath(dataNode.getXpath())
                 .attributes(jsonObjectMapper.asJsonString(dataNode.getLeaves()))
@@ -354,10 +346,10 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
             fragmentRepository.findExtractsWithDescendantsByIds(fragmentEntityIds, fetchDescendantsOption.getDepth());
 
         if (anchorEntity == ALL_ANCHORS) {
-            final Collection<Integer> anchorIds = fragmentExtracts.stream()
+            final Collection<Long> anchorIds = fragmentExtracts.stream()
                 .map(FragmentExtract::getAnchorId).collect(Collectors.toSet());
             final List<AnchorEntity> anchorEntities = anchorRepository.findAllById(anchorIds);
-            final Map<Integer, AnchorEntity> anchorEntityPerId = anchorEntities.stream()
+            final Map<Long, AnchorEntity> anchorEntityPerId = anchorEntities.stream()
                 .collect(Collectors.toMap(AnchorEntity::getId, Function.identity()));
             return FragmentEntityArranger.toFragmentEntityTreesAcrossAnchors(anchorEntityPerId, fragmentExtracts);
         }
@@ -700,8 +692,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService
     private String mergeLeaves(final Map<String, Serializable> updateLeaves, final String currentLeavesAsString) {
         Map<String, Serializable> currentLeavesAsMap = new HashMap<>();
         if (currentLeavesAsString != null) {
-            currentLeavesAsMap = currentLeavesAsString.isEmpty()
-                    ? new HashMap<>() : jsonObjectMapper.convertJsonString(currentLeavesAsString, Map.class);
+            currentLeavesAsMap = jsonObjectMapper.convertJsonString(currentLeavesAsString, Map.class);
             currentLeavesAsMap.putAll(updateLeaves);
         }