1 package org.openecomp.sdc.enrichment.impl.tosca;
3 import org.openecomp.sdc.datatypes.error.ErrorMessage;
4 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
5 import org.testng.annotations.AfterClass;
6 import org.testng.annotations.BeforeClass;
7 import org.testng.annotations.BeforeMethod;
8 import org.testng.annotations.Test;
10 import java.io.IOException;
11 import java.util.List;
14 public class PortMirroringEnricherTest extends BaseToscaEnrichmentTest {
16 private PortMirroringEnricher portMirroringEnricher;
18 @BeforeMethod(alwaysRun = true)
19 public void init() throws IOException {
20 portMirroringEnricher = new PortMirroringEnricher();
24 public void testEnrichNoPorts() throws Exception {
25 outputFilesPath = "/mock/enrichPortMirroring/noPorts/out/";
26 ToscaServiceModel toscaServiceModel =
27 loadToscaServiceModel("/mock/enrichPortMirroring/noPorts/in/",
28 "/mock/toscaGlobalServiceTemplates/",
29 "MainServiceTemplate.yaml");
30 Map<String, List<ErrorMessage>> errors =
31 portMirroringEnricher.enrich(toscaServiceModel);
33 compareActualAndExpectedModel(toscaServiceModel);
37 public void testEnrichSingleSubstitutionSamePortType() throws Exception {
38 outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/samePortType/out/";
39 ToscaServiceModel toscaServiceModel =
40 loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/samePortType/in",
41 "/mock/toscaGlobalServiceTemplates/",
42 "MainServiceTemplate.yaml");
43 Map<String, List<ErrorMessage>> errors =
44 portMirroringEnricher.enrich(toscaServiceModel);
46 compareActualAndExpectedModel(toscaServiceModel);
50 public void testEnrichSingleSubstitutionDiffPortType() throws Exception {
51 outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/";
52 ToscaServiceModel toscaServiceModel =
53 loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/diffPortType/in",
54 "/mock/toscaGlobalServiceTemplates/",
55 "MainServiceTemplate.yaml");
56 Map<String, List<ErrorMessage>> errors =
57 portMirroringEnricher.enrich(toscaServiceModel);
59 compareActualAndExpectedModel(toscaServiceModel);
63 public void testEnrichScalingInstance() throws Exception {
64 outputFilesPath = "/mock/enrichPortMirroring/scalingInstance/out/";
65 ToscaServiceModel toscaServiceModel =
66 loadToscaServiceModel("/mock/enrichPortMirroring/scalingInstance/in",
67 "/mock/toscaGlobalServiceTemplates/",
68 "MainServiceTemplate.yaml");
69 Map<String, List<ErrorMessage>> errors =
70 portMirroringEnricher.enrich(toscaServiceModel);
72 compareActualAndExpectedModel(toscaServiceModel);
76 public void testEnrichCatalogInstance() throws Exception {
77 outputFilesPath = "/mock/enrichPortMirroring/catalogInstance/out/";
78 ToscaServiceModel toscaServiceModel =
79 loadToscaServiceModel("/mock/enrichPortMirroring/catalogInstance/in",
80 "/mock/toscaGlobalServiceTemplates/",
81 "MainServiceTemplate.yaml");
82 Map<String, List<ErrorMessage>> errors =
83 portMirroringEnricher.enrich(toscaServiceModel);
85 compareActualAndExpectedModel(toscaServiceModel);
89 public void testEnrichNestedOneLevel() throws Exception {
90 outputFilesPath = "/mock/enrichPortMirroring/nested/oneLevel/out/";
91 ToscaServiceModel toscaServiceModel =
92 loadToscaServiceModel("/mock/enrichPortMirroring/nested/oneLevel/in",
93 "/mock/toscaGlobalServiceTemplates/",
94 "MainServiceTemplate.yaml");
95 Map<String, List<ErrorMessage>> errors =
96 portMirroringEnricher.enrich(toscaServiceModel);
98 compareActualAndExpectedModel(toscaServiceModel);
102 public void testEnrichNestedMultiLevel() throws Exception {
103 outputFilesPath = "/mock/enrichPortMirroring/nested/multiLevel/out/";
104 ToscaServiceModel toscaServiceModel =
105 loadToscaServiceModel("/mock/enrichPortMirroring/nested/multiLevel/in",
106 "/mock/toscaGlobalServiceTemplates/",
107 "MainServiceTemplate.yaml");
108 Map<String, List<ErrorMessage>> errors =
109 portMirroringEnricher.enrich(toscaServiceModel);
111 compareActualAndExpectedModel(toscaServiceModel);