[SDC-24] sdnc problems 89/4689/1
authorPavel Aharoni <pa0916@att.com>
Tue, 6 Jun 2017 08:48:14 +0000 (11:48 +0300)
committerPavel Aharoni <pa0916@att.com>
Tue, 6 Jun 2017 08:52:55 +0000 (11:52 +0300)
Change-Id: I990126b83b11ae23090bb22bf0a5d46adf71a61a
Signed-off-by: Pavel Aharoni <pa0916@att.com>
sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleCallback.java
sdc-tosca-parser/src/main/java/org/openecomp/sdc/tosca/parser/impl/SdcToscaParserFactory.java

index c5cce09..98df4d0 100644 (file)
@@ -277,6 +277,8 @@ public class SimpleCallback implements INotificationCallback {
                        
                        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++)  {
@@ -285,8 +287,16 @@ public class SimpleCallback implements INotificationCallback {
                                        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 ################");
                                                }
index 2ddde1f..a3b2391 100644 (file)
@@ -41,7 +41,13 @@ public class SdcToscaParserFactory {
      *\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