aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org')
-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 4e5c9bc..8af3db0 100644
--- a/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java
+++ b/src/test/java/org/openecomp/sdc/impl/ToscaParserMetadataTest.java
@@ -59,6 +59,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");
+ }
+
+
}