Processing CSAR failed 93/35493/2
authorshrikantawachar <shrikant.awachar@amdocs.com>
Tue, 13 Mar 2018 13:28:28 +0000 (18:58 +0530)
committerAvi Gaffa <avi.gaffa@amdocs.com>
Tue, 13 Mar 2018 14:32:44 +0000 (14:32 +0000)
The *.csar packages not passing onboarding during SDC sanity.

Change-Id: I0fc57296bad85928c704dd1b18a7e60a996c13a9
Issue-ID: SDC-1124
Signed-off-by: shrikantawachar <shrikant.awachar@amdocs.com>
openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/OrchestrationTemplateCandidateDaoZusammenImpl.java
openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VspZusammenUtil.java

index cfb4c9d..9d36ad4 100644 (file)
@@ -25,8 +25,6 @@ import org.openecomp.sdc.common.errors.CoreException;
 import org.openecomp.sdc.common.utils.CommonUtil;
 import org.openecomp.sdc.common.utils.SdcCommon;
 import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
 import org.openecomp.sdc.logging.api.annotations.Metrics;
 import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
 import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
@@ -48,12 +46,12 @@ import java.io.InputStream;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 
 public class OrchestrationTemplateCandidateManagerImpl
     implements OrchestrationTemplateCandidateManager {
-  private static final Logger LOGGER =
-      LoggerFactory.getLogger(OrchestrationTemplateCandidateManagerImpl.class);
+
   private final VendorSoftwareProductInfoDao vspInfoDao;
   private final CandidateService candidateService;
 
@@ -126,6 +124,11 @@ public class OrchestrationTemplateCandidateManagerImpl
     if (!candidateDataEntity.isPresent()) {
       return Optional.empty();
     }
+
+    if(Objects.isNull(candidateDataEntity.get().getFileSuffix())) {
+      return Optional.empty();
+    }
+
     OnboardingTypesEnum type =
         OnboardingTypesEnum.getOnboardingTypesEnum(candidateDataEntity.get().getFileSuffix());
 
index b72d684..22fe1dd 100644 (file)
@@ -72,7 +72,7 @@ public class OrchestrationTemplateCandidateDaoZusammenImpl
         zusammenAdaptor.getElementByName(context, elementContext, null,
             ElementType.OrchestrationTemplateCandidate.name());
     if (candidateElement.isPresent()) {
-      if (VspZusammenUtil.isEmpty(candidateElement.get().getData())) {
+      if (VspZusammenUtil.hasEmptyData(candidateElement.get().getData())) {
         return null;
       }
       OrchestrationTemplateCandidateData candidateData = new OrchestrationTemplateCandidateData();
index 09fd948..da22324 100644 (file)
@@ -2,7 +2,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen;
 
 import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.ArrayUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -30,19 +29,6 @@ class VspZusammenUtil {
     return head;
   }
 
-  static boolean isEmpty(InputStream elementData) {
-    byte[] byteElementData;
-    if (Objects.isNull(elementData)) {
-      return true;
-    }
-    try {
-      byteElementData = IOUtils.toByteArray(elementData);
-    } catch (IOException e) {
-      return false;
-    }
-    return ArrayUtils.isEmpty(byteElementData);
-  }
-
   static boolean hasEmptyData(InputStream elementData) {
     String EMPTY_DATA = "{}";
     byte[] byteElementData;