diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src')
12 files changed, 80 insertions, 135 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java index a5eeece2b3..c9d89ee38f 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/EnricherHandlerImpl.java @@ -20,12 +20,12 @@ package org.openecomp.sdc.enrichment.impl; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.enrichment.impl.external.artifact.ExternalArtifactEnricher; import org.openecomp.sdc.enrichment.impl.tosca.ToscaEnricher; import org.openecomp.sdc.enrichment.inter.Enricher; import org.openecomp.sdc.enrichment.inter.EnricherHandler; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import java.util.ArrayList; import java.util.List; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java index a5f6529bbb..828de7244c 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricher.java @@ -10,10 +10,10 @@ import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.EnrichmentInfo; import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; +import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; @@ -28,7 +28,7 @@ import java.util.Map; public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterface { - private VendorSoftwareProductDao vendorSoftwareProductDao; + private ComponentDao componentDao; //private ProcessArtifactDao processArtifactDao; private ProcessDao processDao; private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); @@ -41,10 +41,9 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac Version version = enrichmentInfo.getVersion(); Collection<ComponentEntity> components = - getVendorSoftwareProductDao().listComponents(vspId, version); - components.stream() - .forEach(componentEntry -> errors.putAll(enrichComponent(componentEntry, - vspId, version))); + getComponentDao().list(new ComponentEntity(vspId, version, null)); + components.forEach(componentEntry -> errors.putAll(enrichComponent(componentEntry, + vspId, version))); return errors; } @@ -79,10 +78,9 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac ProcessArtifactEntity artifactEntity = new ProcessArtifactEntity(vspId, version, componentId, entity.getId());*/ - processes.stream() - .forEach(entity -> { - ProcessEntity artifactEntity = new ProcessEntity(vspId, version, - componentId, entity.getId()); + processes.forEach(entity -> { + ProcessEntity artifactEntity = new ProcessEntity(vspId, version, + componentId, entity.getId()); ProcessEntity artifactProcessEntity = getProcessDao().get(artifactEntity); //ProcessArtifactEntity artifact = getProcessArtifactDao().get(artifactEntity); @@ -105,7 +103,7 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac } }); - mdcDataDebugMessage.debugExitMessage(null, null); + mdcDataDebugMessage.debugExitMessage(null); } void enrichServiceArtifact(ComponentProcessInfo componentProcessInfo, @@ -113,19 +111,19 @@ public class ProcessArtifactEnricher implements ExternalArtifactEnricherInterfac Map<String, List<ErrorMessage>> errors) { - mdcDataDebugMessage.debugEntryMessage(null, null); + mdcDataDebugMessage.debugEntryMessage(null); processServiceArtifact.setName(componentProcessInfo.getName()); processServiceArtifact.setContentData(FileUtils.toByteArray(componentProcessInfo.getContent())); getEnrichedServiceModelDao().storeExternalArtifact(processServiceArtifact); - mdcDataDebugMessage.debugExitMessage(null, null); + mdcDataDebugMessage.debugExitMessage(null); } - private VendorSoftwareProductDao getVendorSoftwareProductDao() { - if (vendorSoftwareProductDao == null) { - vendorSoftwareProductDao = VendorSoftwareProductDaoFactory.getInstance().createInterface(); + private ComponentDao getComponentDao() { + if (componentDao == null) { + componentDao = ComponentDaoFactory.getInstance().createInterface(); } - return vendorSoftwareProductDao; + return componentDao; } private ProcessDao getProcessDao() { diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java index b7da22bdfb..9e46a5c33d 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/external/artifact/VspInformationArtifactEnricher.java @@ -32,8 +32,6 @@ import org.openecomp.sdc.enrichment.EnrichmentInfo; import org.openecomp.sdc.enrichment.inter.ExternalArtifactEnricherInterface; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants; -import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; @@ -61,8 +59,6 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI EnrichedServiceModelDaoFactory.getInstance().createInterface(); private VendorSoftwareProductInfoDao vspInfoDao = VendorSoftwareProductInfoDaoFactory .getInstance().createInterface(); - private OrchestrationTemplateDao orchestrationTemplateDataDao = - OrchestrationTemplateDaoFactory.getInstance().createInterface(); public VspInformationArtifactEnricher() { } @@ -81,7 +77,7 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI throws IOException { - mdcDataDebugMessage.debugEntryMessage(null, null); + mdcDataDebugMessage.debugEntryMessage(null); Map<String, List<ErrorMessage>> errors = new HashMap<>(); ByteBuffer infoArtifactByteBuffer = ByteBuffer.wrap(informationArtifactGenerator.generate( @@ -94,13 +90,13 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI vspId, version.toString()))); //TODO: add error to map (what is the key?) - mdcDataDebugMessage.debugExitMessage(null, null); + mdcDataDebugMessage.debugExitMessage(null); return errors; } enrichInformationArtifact(vspId, version, infoArtifactByteBuffer); - mdcDataDebugMessage.debugExitMessage(null, null); + mdcDataDebugMessage.debugExitMessage(null); return errors; } @@ -108,10 +104,7 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI ByteBuffer infoArtifactByteBuffer) { ServiceArtifact infoArtifactServiceArtifact = new ServiceArtifact(); - VspDetails vspDetails = getVspDetails(vspId, version); - - String vspName = vspDetails.getName(); - + String vspName = vspInfoDao.get(new VspDetails(vspId, version)).getName(); infoArtifactServiceArtifact.setVspId(vspId); infoArtifactServiceArtifact.setVersion(version); @@ -126,9 +119,5 @@ public class VspInformationArtifactEnricher implements ExternalArtifactEnricherI enrichedServiceModelDao.storeExternalArtifact(infoArtifactServiceArtifact); } - public VspDetails getVspDetails(String vspId,Version version){ - VspDetails vspDetails = vspInfoDao.get(new VspDetails(vspId,version)); - vspDetails.setValidationData(orchestrationTemplateDataDao.getValidationData(vspId,version)); - return vspDetails; - } + } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java index f49c53d79b..9ebe9e5e67 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireData.java @@ -26,36 +26,35 @@ import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INS import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE; - public class ComponentQuestionnaireData { ComponentDao componentDao = ComponentDaoFactory.getInstance().createInterface(); - ComponentDependencyModelDao componentDependencyModelDao = ComponentDependencyModelDaoFactory.getInstance() - .createInterface(); + ComponentDependencyModelDao componentDependencyModelDao = + ComponentDependencyModelDaoFactory.getInstance().createInterface(); - private Map<String,String> sourceToTargetComponent; + private Map<String, String> sourceToTargetComponent; - public Map<String,String> getSourceToTargetComponent() { + public Map<String, String> getSourceToTargetComponent() { return sourceToTargetComponent; } - public void setSourceToTargetComponent(Map<String,String> sourceToTargetComponent) { + public void setSourceToTargetComponent(Map<String, String> sourceToTargetComponent) { this.sourceToTargetComponent = sourceToTargetComponent; } public Map<String, Map<String, Object>> getPropertiesfromCompQuestionnaire(String key, Version version) { - Map<String, Map<String,Object>> componentProperties = - new HashMap<String, Map<String,Object>>(); + Map<String, Map<String, Object>> componentProperties = + new HashMap<String, Map<String, Object>>(); ComponentEntity entity = new ComponentEntity(key, version, null); final Collection<ComponentEntity> componentEntities = componentDao.listCompositionAndQuestionnaire(key, version); - Map<String,String> sourceToTarget = new HashMap<String, String>(); + Map<String, String> sourceToTarget = new HashMap<>(); for (ComponentEntity component : componentEntities) { - Map<String, Object> questionnaireParams = new HashMap<String, Object>(); + Map<String, Object> questionnaireParams = new HashMap<>(); final ComponentQuestionnaire componentQuestionnaire = JsonUtil.json2Object(component.getQuestionnaireData(), ComponentQuestionnaire.class); @@ -77,7 +76,7 @@ public class ComponentQuestionnaireData { questionnaireParams.put(EnrichmentConstants.VFC_FUNCTION, vfcDescription); - if (componentQuestionnaire.getHighAvailabilityAndLoadBalancing() != null ) { + if (componentQuestionnaire.getHighAvailabilityAndLoadBalancing() != null) { String mandatory = componentQuestionnaire.getHighAvailabilityAndLoadBalancing() .getIsComponentMandatory(); questionnaireParams.put(MANDATORY, mandatory); @@ -91,19 +90,20 @@ public class ComponentQuestionnaireData { final Integer maxVms = componentQuestionnaire.getCompute() != null ? (componentQuestionnaire.getCompute() .getNumOfVMs() != null ? componentQuestionnaire.getCompute().getNumOfVMs() - .getMaximum(): null) : null; + .getMaximum() : null) : null; final Integer minVms = componentQuestionnaire.getCompute() != null ? (componentQuestionnaire.getCompute() .getNumOfVMs() != null ? componentQuestionnaire.getCompute().getNumOfVMs() - .getMinimum(): null) : null; + .getMinimum() : null) : null; - questionnaireParams.put(MIN_INSTANCES,minVms != null && minVms == 0 ? null : minVms); - questionnaireParams.put(MAX_INSTANCES,maxVms != null && maxVms == 0 ? null : maxVms); + questionnaireParams.put(MIN_INSTANCES, minVms != null && minVms == 0 ? null : minVms); + questionnaireParams.put(MAX_INSTANCES, maxVms != null && maxVms == 0 ? null : maxVms); - if (! questionnaireParams.isEmpty()) + if (!questionnaireParams.isEmpty()) { componentProperties.put(JsonUtil.json2Object(component.getCompositionData(), ComponentData.class).getDisplayName(), questionnaireParams); + } } setSourceToTargetComponent(sourceToTarget); @@ -111,12 +111,12 @@ public class ComponentQuestionnaireData { return componentProperties; } - public Map<String,List<String>> populateDependencies(String vspId, Version version, Map<String, - String> componentNameData) { + public Map<String, List<String>> populateDependencies(String vspId, Version version, Map<String, + String> componentNameData) { Collection<ComponentDependencyModelEntity> componentDependencies = componentDependencyModelDao.list(new ComponentDependencyModelEntity(vspId, version, null)); - Map<String,List<String>> sourceToTargetComponent = new HashMap<String, List<String>>(); + Map<String, List<String>> sourceToTargetComponent = new HashMap<String, List<String>>(); List<String> targetComponents = null; for (ComponentDependencyModelEntity dependency : componentDependencies) { String sourceComponentName = componentNameData.get(dependency.getSourceComponentId()); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java index 705773d1fc..a855a7477f 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java @@ -1,9 +1,5 @@ package org.openecomp.sdc.enrichment.impl.tosca; -import static org.openecomp.sdc.tosca.services.DataModelUtil.getClonedObject; -import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME; -import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_ID; - import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.datatypes.error.ErrorMessage; @@ -39,6 +35,10 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import static org.openecomp.sdc.tosca.services.DataModelUtil.getClonedObject; +import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME; +import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_ID; + public class PortMirroringEnricher { //Map of service template file name and map of all port node template ids, node template private Map<String, Map<String, NodeTemplate>> portNodeTemplates = new HashMap<>(); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java index 090c3ae101..5ea1176e48 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/ToscaEnricher.java @@ -20,11 +20,13 @@ package org.openecomp.sdc.enrichment.impl.tosca; +import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.inter.Enricher; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,13 +47,19 @@ public class ToscaEnricher extends Enricher { private Map<String, List<ErrorMessage>> enrichAbstractSubstitute() { mdcDataDebugMessage.debugEntryMessage(null, null); - Map<String, List<ErrorMessage>> enrichErrors; + Map<String, List<ErrorMessage>> enrichErrors = new HashMap<>(); ToscaServiceModel toscaModel = (ToscaServiceModel) model; AbstractSubstituteToscaEnricher abstractSubstituteToscaEnricher = new AbstractSubstituteToscaEnricher(); - enrichErrors = abstractSubstituteToscaEnricher.enrich(toscaModel, data.getKey(), - data.getVersion()); + + try { + enrichErrors = abstractSubstituteToscaEnricher.enrich(toscaModel, data.getKey(), + data.getVersion()); + }catch (Exception e){ + enrichErrors.put("Tosca Enrich", Arrays.asList(new ErrorMessage(ErrorLevel.ERROR, e + .getMessage()))); + } mdcDataDebugMessage.debugExitMessage(null, null); return enrichErrors; @@ -59,10 +67,16 @@ public class ToscaEnricher extends Enricher { private Map<String, List<ErrorMessage>> enrichPortMirroring() { mdcDataDebugMessage.debugEntryMessage(null, null); - Map<String, List<ErrorMessage>> enrichErrors; + Map<String, List<ErrorMessage>> enrichErrors = new HashMap<>(); ToscaServiceModel toscaModel = (ToscaServiceModel) model; PortMirroringEnricher portMirroringEnricher = new PortMirroringEnricher(); - enrichErrors = portMirroringEnricher.enrich(toscaModel); + + try { + enrichErrors = portMirroringEnricher.enrich(toscaModel); + }catch (Exception e){ + enrichErrors.put("Tosca Enrich", Arrays.asList(new ErrorMessage(ErrorLevel.ERROR, e + .getMessage()))); + } mdcDataDebugMessage.debugExitMessage(null, null); return enrichErrors; } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java index 49b424ef05..bd250bb8f4 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/inter/ExternalArtifactEnricherInterface.java @@ -32,5 +32,5 @@ import java.util.Map; * Created by Talio on 11/24/2016. */ public interface ExternalArtifactEnricherInterface { - public Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo) throws IOException; + Map<String, List<ErrorMessage>> enrich(EnrichmentInfo enrichmentInfo) throws IOException; } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java index 3730a15465..c01f986ab1 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java @@ -35,7 +35,6 @@ import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.services.DataModelUtil; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.versioning.dao.types.Version; @@ -60,8 +59,6 @@ public class MonitoringMibEnricherTest { @Mock private EnrichedServiceModelDao enrichedServiceModelDaoMock; @Mock - private VendorSoftwareProductDao vendorSoftwareProductDaoMock; - @Mock private ComponentDao componentDaoMock; @InjectMocks @@ -157,7 +154,7 @@ public class MonitoringMibEnricherTest { private ByteBuffer getMibByteBuffer(String fileName) { byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName), - stream -> FileUtils.toByteArray(stream)); + stream -> FileUtils.toByteArray(stream)); return ByteBuffer.wrap(mibBytes); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java index 0bd84a4e30..59931a1a11 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/ProcessArtifactEnricherTest.java @@ -1,46 +1,15 @@ package org.openecomp.sdc.enrichment.impl.external.artifact; -import org.mockito.ArgumentCaptor; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.openecomp.core.enrichment.types.ArtifactCategory; -import org.openecomp.core.model.dao.EnrichedServiceModelDao; -import org.openecomp.core.model.types.ServiceArtifact; -import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.enrichment.EnrichmentInfo; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessType; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.io.File; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; - -import static org.mockito.Matchers.anyObject; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.when; - public class ProcessArtifactEnricherTest { /*@Mock ProcessDao processDaoMock; @Mock EnrichedServiceModelDao enrichedServiceModelDaoMock; @Mock - VendorSoftwareProductDao vendorSoftwareProductDaoMock; - + ComponentDao componentDaoMock; @InjectMocks ProcessArtifactEnricher processArtifactEnricher; - @BeforeMethod(alwaysRun = true) public void injectDoubles() { MockitoAnnotations.initMocks(this); @@ -65,11 +34,11 @@ public class ProcessArtifactEnricherTest { processEntity.setArtifactName("artifact_1kb.txt"); processEntity.setArtifact(getMibByteBuffer("/mock/enrichProcess/artifact_1kb.txt")); - Collection<ComponentEntity> componentList = new ArrayList<ComponentEntity>(); + Collection<ComponentEntity> componentList = new ArrayList<>(); componentList.add(componentEntity); - when(vendorSoftwareProductDaoMock.listComponents(vspId, version)).thenReturn(componentList); + when(componentDaoMock.list(anyObject())).thenReturn(componentList); - Collection<ProcessEntity> list = new ArrayList<ProcessEntity>(); + Collection<ProcessEntity> list = new ArrayList<>(); list.add(processEntity); when(processDaoMock.list(entity)).thenReturn(list); @@ -111,7 +80,7 @@ public class ProcessArtifactEnricherTest { private ByteBuffer getMibByteBuffer(String fileName) { byte[] mibBytes = FileUtils.readViaInputStream(this.getClass().getResource(fileName), - stream -> FileUtils.toByteArray(stream)); + stream -> FileUtils.toByteArray(stream)); return ByteBuffer.wrap(mibBytes); }*/ } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java index 0001cdf404..363e171c6c 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java @@ -25,12 +25,18 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.tosca.services.ToscaFileOutputService; import org.openecomp.sdc.tosca.services.ToscaUtil; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; -import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.nio.file.NotDirectoryException; import java.util.Collection; diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java index 73732575f3..d6810d92b0 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java @@ -1,31 +1,5 @@ package org.openecomp.sdc.enrichment.impl.tosca; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDependencyModelDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.versioning.dao.types.Version; -import org.testng.Assert; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.doReturn; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.HIGH_AVAIL_MODE; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MANDATORY; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MAX_INSTANCES; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.MIN_INSTANCES; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_CODE; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_FUNCTION; -import static org.openecomp.sdc.enrichment.impl.util.EnrichmentConstants.VFC_NAMING_CODE; - public class ComponentQuestionnaireDataTest { /*private static String VSP_ID = "vspId"; public static final Version VERSION01 = new Version(0, 1); diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java index 0a8fe432b0..b48fd8d8d7 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricherTest.java @@ -2,8 +2,6 @@ package org.openecomp.sdc.enrichment.impl.tosca; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; |