aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2018-02-08 15:34:34 +0000
committerGerrit Code Review <gerrit@onap.org>2018-02-08 15:34:34 +0000
commit0a340cbdee6eec3005541f3f10fa97dafe8d4d67 (patch)
treeb4aec59840804712f88afac7ec1ea6c4dca5bed1 /src/test/java
parent0dcd1eef24541d074edcf3c8640b38cf7528ef6b (diff)
parent8a2ddc31c576e4a8a39e01bfe1e0fe7631e6cdf2 (diff)
Merge "Support CR type Issue-ID: SDC-965 "
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java2
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java11
-rw-r--r--src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java33
3 files changed, 46 insertions, 0 deletions
diff --git a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
index 74e52db..1695671 100644
--- a/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/SdcToscaParserBasicTest.java
@@ -35,6 +35,7 @@ public abstract class SdcToscaParserBasicTest {
static ISdcCsarHelper resolveGetInputCsarQA;
static ISdcCsarHelper resolveReqsCapsCsarQA;
static ISdcCsarHelper portMirroring;
+ static ISdcCsarHelper csarHelperServiceWithCrs;
static Map<String, HashMap<String, List<String>>> fdntCsarHelper_Data;
@@ -57,6 +58,7 @@ public abstract class SdcToscaParserBasicTest {
QAServiceForToscaParserTests = getCsarHelper("csars/service-ServiceForToscaParserTests-csar.csar");
resolveReqsCapsCsarQA = getCsarHelper("csars/service-sunny-flow2.csar");
portMirroring = getCsarHelper("csars/service-PortMirroring.csar");
+ csarHelperServiceWithCrs = getCsarHelper("csars/service-CrTestService-csar.csar");
fdntCsarHelper_Data = new HashMap<String, HashMap<String, List<String>>>(){
{
diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java
index 65c013a..4a17b66 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java
@@ -62,6 +62,17 @@ public class ToscaParserMetadataTest extends SdcToscaParserBasicTest {
}
//endregion
+ @Test
+ public void GetServiceNodeTemplateMetadataTypeCR() {
+ NodeTemplate nodeTemplate = csarHelperServiceWithCrs.getServiceNodeTemplateByNodeName("chaya best cr 0");
+ Metadata nodeTemplateMetadata = csarHelperServiceWithCrs.getNodeTemplateMetadata(nodeTemplate);
+ assertNotNull(nodeTemplateMetadata);
+ assertEquals(nodeTemplateMetadata.getValue("resourceVendorModelNumber"), "");
+ assertEquals(nodeTemplateMetadata.getValue("type"), "CR");
+ assertEquals(nodeTemplateMetadata.getValue("name"), "chaya best cr");
+ assertEquals(nodeTemplateMetadata.getValue("version"), "0.1");
+ }
+
//region getConformanceLevel
@Test
public void testSunnyGetConformanceLevel() {
diff --git a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
index 7cb99e3..04675b4 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserNodeTemplateTest.java
@@ -6,6 +6,8 @@ import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import java.util.*;
import static org.hamcrest.CoreMatchers.is;
+
+import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
import org.openecomp.sdc.tosca.parser.impl.FilterType;
@@ -934,6 +936,37 @@ public class ToscaParserNodeTemplateTest extends SdcToscaParserBasicTest {
propertyAsObject = resolveGetInputCsarQA.getNodeTemplatePropertyAsObject(vfcs.get(0), "port_pd01_port_ip_requirements");
assertEquals( ((ArrayList)propertyAsObject).get(1), null);
}
+
+ @Test
+ public void testServiceNodeTemplateByCRType() {
+ List<NodeTemplate> serviceCRList = csarHelperServiceWithCrs.getServiceNodeTemplateBySdcType(SdcTypes.CR);
+ assertNotNull(serviceCRList);
+ assertEquals(serviceCRList.size(), 2);
+ assertEquals(serviceCRList.get(0).getName(), "chaya best cr 1");
+ assertEquals(serviceCRList.get(0).getType(), "org.openecomp.resource.cr.ChayaBestCr");
+ assertEquals(serviceCRList.get(1).getName(), "chaya best cr 0");
+ assertEquals(serviceCRList.get(1).getType(), "org.openecomp.resource.cr.ChayaBestCr");
+ }
+
+ @Test
+ public void testGetCPOfCRNodeTemplate() {
+ NodeTemplate nodeTemplate = csarHelperServiceWithCrs.getServiceNodeTemplateByNodeName("chaya best cr 0");
+ List<NodeTemplate> crCpChildren = csarHelperServiceWithCrs.getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CP);
+ assertEquals(crCpChildren.get(0).getName(), "ContrailPort 0");
+ assertEquals(crCpChildren.get(0).getMetaData().getValue("type"), SdcTypes.CP.name());
+ }
+
+ @Test
+ public void testServiceCRInstanceProps() {
+ List<NodeTemplate> serviceCrList = csarHelperServiceWithCrs.getServiceNodeTemplateBySdcType(SdcTypes.CR);
+ assertNotNull(serviceCrList);
+ NodeTemplate crTemplate = serviceCrList.get(0);
+ assertNotNull(crTemplate);
+ assertEquals(crTemplate.getPropertyValue("nf_naming").toString(), ImmutableMap.of("ecomp_generated_naming", "true").toString());
+ assertEquals(crTemplate.getPropertyValue("contrailport0_virtual_network"), "chaya");
+ }
+
+
}