aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorShwetank Dave <shwetank.dave@amdocs.com>2017-08-23 12:07:33 -0400
committerShwetank Dave <shwetank.dave@amdocs.com>2017-08-23 12:41:05 -0400
commit6d3581b757316b2a61814d83bff874ce434db90c (patch)
tree469f49bfd0640c4f173a6c019b612e4612e7b92e /src/main
parentddc73b563fcd2b3e47b5d0f54139f20ed3cdcba1 (diff)
Safeguard against deprecated DbEdgeRules versions.
Currently we require a DbEdgeRules_vX.json file and it's associated edge_properties_vX.json files. If an edge_properties file is not found for a DbEdgeRules file, it throws an exeption. We should log and entry stating DbEdgeRules and it's associaded edge_properties files is not found and not throw an error. Issue-ID: AAI-21 Change-Id: I05f5b4d14c3cef1586cefe579e38df03ca4fb438 Signed-off-by: Shwetank Dave <shwetank.dave@amdocs.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/openecomp/schema/RelationshipSchemaLoader.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/org/openecomp/schema/RelationshipSchemaLoader.java b/src/main/java/org/openecomp/schema/RelationshipSchemaLoader.java
index 7b68b35..d4ae2b9 100644
--- a/src/main/java/org/openecomp/schema/RelationshipSchemaLoader.java
+++ b/src/main/java/org/openecomp/schema/RelationshipSchemaLoader.java
@@ -145,7 +145,14 @@ public class RelationshipSchemaLoader {
// Also update the "versionContextMap" with the version and it's schema.
rulesFiles.stream().sorted(Comparator.comparing(RelationshipSchemaLoader::filename))
.collect(Collectors.groupingBy(f -> myMatcher(versionPattern, filename(f))))
- .forEach((version, resourceAndFile) -> versionContextMap.put(version, jsonFilesLoader(version, resourceAndFile)));
+ .forEach((version, resourceAndFile) -> {
+ if (resourceAndFile.size() == 2 ) {
+ versionContextMap.put(version, jsonFilesLoader(version, resourceAndFile));
+ } else {
+ String filenames = resourceAndFile.stream().map(f-> filename(f)).collect(Collectors.toList()).toString();
+ String errorMsg = "Expecting a rules and a edge_properties files for " + version + ". Found: " + filenames;
+ logger.warn(CrudServiceMsgs.INVALID_OXM_FILE, errorMsg);
+ }});
logger.info(CrudServiceMsgs.LOADED_OXM_FILE, "Relationship Schema and Properties files: " + rulesFiles.stream().map(f -> filename(f)).collect(Collectors.toList()));
} catch (IOException e) {
@@ -181,9 +188,6 @@ public class RelationshipSchemaLoader {
files.stream().map(f -> filename(f)).collect(Collectors.toList()).toString(), e.getMessage());
}
return rsSchema;
- } else {
- logger.debug(CrudServiceMsgs.INVALID_OXM_FILE, "Expecting a rules file and a properties file but found: " +
- files.stream().map(f-> filename(f)).collect(Collectors.toList()).toString());
}
return rsSchema;
}