summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java
diff options
context:
space:
mode:
authorAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
commitb8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch)
treef78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java
parent75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff)
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java')
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/external/artifact/MonitoringMibEnricherTest.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/BaseToscaEnrichmentTest.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/ComponentQuestionnaireDataTest.java28
4 files changed, 43 insertions, 29 deletions
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 7a16b6945d..38f7a1c56e 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
@@ -26,16 +26,16 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.openecomp.core.enrichment.types.ArtifactCategory;
-import org.openecomp.core.enrichment.types.ArtifactType;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
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.MibDao;
+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.MibEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
@@ -60,7 +60,7 @@ import static org.mockito.Mockito.times;
public class MonitoringMibEnricherTest {
@Mock
- private MibDao mibDaoMock;
+ private ComponentArtifactDao componentArtifactDaoMock;
@Mock
private EnrichedServiceModelDao enrichedServiceModelDaoMock;
@Mock
@@ -99,7 +99,7 @@ public class MonitoringMibEnricherTest {
.assertEquals(expectedServiceArtifact.getValue().getName().startsWith(componentName), true);
Assert.assertEquals(expectedServiceArtifact.getValue().getName(),
componentName + File.separator + ArtifactCategory.DEPLOYMENT.getDisplayName() +
- File.separator + ArtifactType.SNMP_POLL + File.separator + "mib1.yml");
+ File.separator + MonitoringUploadType.VES_EVENTS + File.separator + "mib1.yml");
}
@@ -125,20 +125,20 @@ public class MonitoringMibEnricherTest {
setMockToEnrichComponent(vspId, componentId1, version);
monitoringMibEnricher.enrich(enrichmentInfo);
- Mockito.verify(enrichedServiceModelDaoMock, times(8)).storeExternalArtifact(anyObject());
+ Mockito.verify(enrichedServiceModelDaoMock, times(12)).storeExternalArtifact(anyObject());
}
private void setMockToEnrichComponent(String vspId, String componentId, Version version) {
- MibEntity returnedArtifact = new MibEntity();
+ ComponentMonitoringUploadEntity returnedArtifact = new ComponentMonitoringUploadEntity();
returnedArtifact.setVspId(vspId);
returnedArtifact.setVersion(version);
returnedArtifact.setComponentId(componentId);
- returnedArtifact.setType(ArtifactType.SNMP_POLL);
+ returnedArtifact.setType(MonitoringUploadType.SNMP_POLL);
returnedArtifact.setArtifactName("mib.zip");
returnedArtifact.setArtifact(getMibByteBuffer("/mock/enrichMib/MIB.zip"));
- Mockito.when(mibDaoMock.getByType(anyObject()))
+ Mockito.when(componentArtifactDaoMock.getByType(anyObject()))
.thenReturn(Optional.of(returnedArtifact));
Mockito.doNothing().when(enrichedServiceModelDaoMock).storeExternalArtifact(anyObject());
}
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
index ae1b613f75..ca116a9ae3 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/java/org/openecomp/sdc/enrichment/impl/tosca/AbstractSubstituteToscaEnricherTest.java
@@ -1,13 +1,6 @@
package org.openecomp.sdc.enrichment.impl.tosca;
-import static org.mockito.Mockito.when;
-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_NAMING_CODE;
-
import org.apache.commons.collections.map.HashedMap;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -24,6 +17,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static org.mockito.Mockito.when;
+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 AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest {
@Mock
@@ -51,11 +53,13 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest
loadToscaServiceModel("/mock/enrichHA/in/", "/mock/toscaGlobalServiceTemplates/",
"MainServiceTemplate.yaml");
- Map<String, Map<String, Object>> componentTypetoParams = new HashMap();
- Map<String, Object> innerProps = new HashedMap();
+ Map<String, Map<String, Object>> componentTypetoParams = new HashMap<>();
+ Map<String, Object> innerProps = new HashMap<>();
innerProps.put(MANDATORY, "YES");
innerProps.put(HIGH_AVAIL_MODE, "geo-activestandby");
innerProps.put(VFC_NAMING_CODE, "Code1");
+ innerProps.put(VFC_CODE, "pd_server_code");
+ innerProps.put(VFC_FUNCTION, "pd_server_description");
innerProps.put(MIN_INSTANCES, 1);
innerProps.put(MAX_INSTANCES, 2);
@@ -96,6 +100,8 @@ public class AbstractSubstituteToscaEnricherTest extends BaseToscaEnrichmentTest
innerProps.put(MANDATORY, "NO");
innerProps.put(HIGH_AVAIL_MODE, "");
innerProps.put(VFC_NAMING_CODE, "pd_server_code1");
+ innerProps.put(VFC_CODE, "pd_server_code");
+ innerProps.put(VFC_FUNCTION, "pd_server_description");
innerProps.put(MIN_INSTANCES, null);
innerProps.put(MAX_INSTANCES, null);
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 366bd82eab..4196168b2c 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
@@ -26,7 +26,7 @@ import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
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.yamlutil.ToscaExtensionYamlUtil;
+import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
import java.io.*;
import java.net.URL;
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 d281604227..d825504d81 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,12 +1,5 @@
package org.openecomp.sdc.enrichment.impl.tosca;
-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_NAMING_CODE;
-
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -14,7 +7,6 @@ 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.VersioningManager;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
@@ -25,6 +17,15 @@ 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);
@@ -47,8 +48,13 @@ public class ComponentQuestionnaireDataTest {
@Test
public void testGetData() {
ComponentEntity componentEntity = new ComponentEntity(VSP_ID, VERSION01,"ID1" );
- componentEntity.setCompositionData("{\"name\": \"org.openecomp.resource.vfc.nodes.heat.be\"," +
- "\"displayName\": \"be\", \"vfcCode\": \"be_1\"}");
+ componentEntity.setCompositionData("{\n" +
+ " \"name\": \"org.openecomp.resource.vfc.nodes.heat.be\",\n" +
+ " \"displayName\": \"be\",\n" +
+ " \"vfcCode\": \"be_1\",\n" +
+ " \"nfcCode\": \"code\",\n" +
+ " \"nfcFunction\": \"desc\"\n" +
+ "}");
componentEntity.setQuestionnaireData
("{\"highAvailabilityAndLoadBalancing\":{\"isComponentMandatory\" : \"NO\"," +
"\"highAvailabilityMode\":\"geo-activeactive\"},\"compute\":{\"numOfVMs\" " +
@@ -64,6 +70,8 @@ public class ComponentQuestionnaireDataTest {
final Map<String, Object> be = propertiesfromCompQuestionnaire.get("be");
Assert.assertEquals(be.get(VFC_NAMING_CODE) , "be_1");
+ Assert.assertEquals(be.get(VFC_CODE), "code");
+ Assert.assertEquals(be.get(VFC_FUNCTION), "desc");
Assert.assertEquals(be.get(MANDATORY) ,"NO");
Assert.assertEquals(be.get(HIGH_AVAIL_MODE) ,"geo-activeactive");
Assert.assertEquals(be.get(MIN_INSTANCES) ,null);