try {
List<IArtifactInfo> serviceArtifacts = data.getServiceArtifacts();
+ List<IResourceInstance> resourcesArtifacts = data.getResources();
+
JSONArray jsonData = new JSONArray(new String(payload));
boolean artifactIsFound = true;
for (int index = 0 ; index < jsonData.length(); index++) {
JSONArray artifacts = (JSONArray) jsonObject.get("artifacts");
for (int i = 0 ; i < artifacts.length(); i++) {
String artifact = artifacts.getString(i).toString();
+
Optional<IArtifactInfo> serviceArtifactFound = serviceArtifacts.stream().filter(x -> x.getArtifactUUID().equals(artifact)).findFirst();
- if (!serviceArtifactFound.isPresent()) {
+
+ boolean isResourceFound = false;
+ for (int j = 0 ; j < resourcesArtifacts.size(); j++) {
+ Optional<IArtifactInfo> resourceArtifactFound = resourcesArtifacts.get(j).getArtifacts().stream().filter(x -> x.getArtifactUUID().equals(artifact)).findFirst();
+ isResourceFound = resourceArtifactFound.isPresent() || isResourceFound;
+ }
+
+ if (!serviceArtifactFound.isPresent() && !isResourceFound) {
artifactIsFound = false;
System.out.println("################ Artifact: " + artifact + " NOT FOUND in Notification Data ################");
}
*\r
* @param csarPath - the absolute path to CSAR file.\r
* @return ISdcCsarHelper object.\r
- * @throws SdcToscaParserException - in case the path or CSAR are invalid.\r
+ * @throws SdcToscaParserException - in case the path or CSAR are invalid.<br>\r
+ * Possible codes of SdcToscaParserException:<br>\r
+ * TP0001 - CSAR file not found.<br>\r
+ * TP0002 - CSAR file bad format. Check the log for details.<br>\r
+ * TP0003 - CSAR version is unsupported by the parser.<br>\r
+ * TP0004 - Unexpected general error.<br>\r
+ * \r
*/\r
public ISdcCsarHelper getSdcCsarHelper(String csarPath) throws SdcToscaParserException {\r
synchronized (SdcToscaParserFactory.class) {\r