summaryrefslogtreecommitdiffstats
path: root/cps-ri/src
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ri/src')
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java7
-rw-r--r--cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java5
2 files changed, 6 insertions, 6 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
index 3e3a4b43e4..23a384306f 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java
@@ -32,11 +32,9 @@ import org.onap.cps.spi.entities.Dataspace;
import org.onap.cps.spi.entities.SchemaSet;
import org.onap.cps.spi.entities.YangResource;
import org.onap.cps.spi.exceptions.SchemaSetAlreadyDefinedException;
-import org.onap.cps.spi.model.ModuleReference;
import org.onap.cps.spi.repository.DataspaceRepository;
import org.onap.cps.spi.repository.SchemaSetRepository;
import org.onap.cps.spi.repository.YangResourceRepository;
-import org.onap.cps.yang.YangTextSchemaSourceSetBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Component;
@@ -102,11 +100,10 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ
}
@Override
- public Collection<ModuleReference> getModuleReferences(final String dataspaceName, final String schemaSetName) {
+ public Map<String, String> getYangSchemaResources(final String dataspaceName, final String schemaSetName) {
final Dataspace dataspace = dataspaceRepository.getByName(dataspaceName);
final SchemaSet schemaSet = schemaSetRepository.getByDataspaceAndName(dataspace, schemaSetName);
- final Map<String, String> yangResourceNameToContent = schemaSet.getYangResources().stream().collect(
+ return schemaSet.getYangResources().stream().collect(
Collectors.toMap(YangResource::getName, YangResource::getContent));
- return YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getModuleReferences();
}
}
diff --git a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java
index 46f017bed7..77c8003a17 100644
--- a/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java
+++ b/cps-ri/src/test/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceTest.java
@@ -100,10 +100,13 @@ public class CpsModulePersistenceServiceTest {
@Test
@SqlGroup({@Sql(CLEAR_DATA), @Sql(SET_DATA)})
public void testStoreSchemaSetWithNewYangResource() {
+ final Map<String, String> yangResourcesNameToContentMap = toMap(NEW_RESOURCE_NAME, NEW_RESOURCE_CONTENT);
cpsModulePersistenceService.storeSchemaSet(DATASPACE_NAME, SCHEMA_SET_NAME_NEW,
- toMap(NEW_RESOURCE_NAME, NEW_RESOURCE_CONTENT));
+ yangResourcesNameToContentMap);
assertSchemaSetPersisted(DATASPACE_NAME, SCHEMA_SET_NAME_NEW,
NEW_RESOURCE_ABSTRACT_ID, NEW_RESOURCE_NAME, NEW_RESOURCE_CONTENT, NEW_RESOURCE_CHECKSUM);
+ assertEquals(yangResourcesNameToContentMap,
+ cpsModulePersistenceService.getYangSchemaResources(DATASPACE_NAME, SCHEMA_SET_NAME_NEW));
}
@Test