aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org/onap
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2023-12-05 11:02:17 +0000
committersourabh_sourabh <sourabh.sourabh@est.tech>2023-12-13 12:53:38 +0000
commit541ed451d1257f6eb72517f33f470db53fdd7fb4 (patch)
tree28ebef126cedbda25ce315cefb0798e8b8cd2401 /cps-service/src/main/java/org/onap
parent7e94b26a666907cc97d692b8dda8364bb0a0ef45 (diff)
Introduce Schema Set upgrade method
- Incl. integration test - Prod code is changed to use new method that update yand module. - updated module resource to return multiple modules. Issue-ID: CPS-1806 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I751d9393ce78a3be9daeaff6d0252738c02115e0 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-service/src/main/java/org/onap')
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java15
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/impl/CpsModuleServiceImpl.java17
-rwxr-xr-xcps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java15
3 files changed, 42 insertions, 5 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
index e8c3e7775c..2928464461 100644
--- a/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
+++ b/cps-service/src/main/java/org/onap/cps/api/CpsModuleService.java
@@ -53,7 +53,7 @@ public interface CpsModuleService {
* @param newModuleNameToContentMap YANG resources map where key is a module name and value is content
* @param allModuleReferences All YANG resource module references
*/
- void createOrUpgradeSchemaSetFromModules(String dataspaceName, String schemaSetName,
+ void createSchemaSetFromModules(String dataspaceName, String schemaSetName,
Map<String, String> newModuleNameToContentMap,
Collection<ModuleReference> allModuleReferences);
@@ -94,6 +94,19 @@ public interface CpsModuleService {
*/
void deleteSchemaSetsWithCascade(String dataspaceName, Collection<String> schemaSetNames);
+
+ /**
+ * upgrade schema sets with existing or new modules.
+ *
+ * @param dataspaceName dataspace name
+ * @param schemaSetName schema set name
+ * @param newModuleNameToContentMap YANG resources map where key is a module name and value is content
+ * @param allModuleReferences All YANG resource module references
+ */
+ void upgradeSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
+ final Map<String, String> newModuleNameToContentMap,
+ final Collection<ModuleReference> allModuleReferences);
+
/**
* Retrieve module references for the given dataspace name.
*
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 d274b51bf6..5337237846 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
@@ -66,9 +66,9 @@ public class CpsModuleServiceImpl implements CpsModuleService {
}
@Override
- public void createOrUpgradeSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
- final Map<String, String> newModuleNameToContentMap,
- final Collection<ModuleReference> allModuleReferences) {
+ public void createSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
+ final Map<String, String> newModuleNameToContentMap,
+ final Collection<ModuleReference> allModuleReferences) {
cpsValidator.validateNameCharacters(dataspaceName, schemaSetName);
cpsModulePersistenceService.storeSchemaSetFromModules(dataspaceName, schemaSetName,
newModuleNameToContentMap, allModuleReferences);
@@ -125,6 +125,17 @@ public class CpsModuleServiceImpl implements CpsModuleService {
}
@Override
+ public void upgradeSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
+ final Map<String, String> newModuleNameToContentMap,
+ final Collection<ModuleReference> allModuleReferences) {
+ cpsValidator.validateNameCharacters(dataspaceName, schemaSetName);
+ cpsModulePersistenceService.updateSchemaSetFromModules(dataspaceName, schemaSetName,
+ newModuleNameToContentMap, allModuleReferences);
+ yangTextSchemaSourceSetCache.removeFromCache(dataspaceName, schemaSetName);
+ }
+
+
+ @Override
public Collection<ModuleReference> getYangResourceModuleReferences(final String dataspaceName) {
cpsValidator.validateNameCharacters(dataspaceName);
return cpsModulePersistenceService.getYangResourceModuleReferences(dataspaceName);
diff --git a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java
index beb3d4fa8c..aaca2ee5b5 100755
--- a/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java
+++ b/cps-service/src/main/java/org/onap/cps/spi/CpsModulePersistenceService.java
@@ -43,7 +43,7 @@ public interface CpsModulePersistenceService {
void storeSchemaSet(String dataspaceName, String schemaSetName, Map<String, String> yangResourcesNameToContentMap);
/**
- * Stores a schema set from new modules and existing modules.
+ * Stores a new schema set from new modules and existing modules.
*
* @param dataspaceName Dataspace name
* @param schemaSetName Schema set name
@@ -54,6 +54,19 @@ public interface CpsModulePersistenceService {
Map<String, String> newModuleNameToContentMap, Collection<ModuleReference> allModuleReferences);
/**
+ * Update an existing schema set from new modules and existing modules.
+ *
+ * @param dataspaceName Dataspace name
+ * @param schemaSetName Schema set name
+ * @param newModuleNameToContentMap YANG resources map where key is a module name and value is content
+ * @param allModuleReferences All YANG resources module references
+ */
+ void updateSchemaSetFromModules(final String dataspaceName, final String schemaSetName,
+ final Map<String, String> newModuleNameToContentMap,
+ final Collection<ModuleReference> allModuleReferences);
+
+
+ /**
* Get all schema sets for a given dataspace.
*
* @param dataspaceName dataspace name.