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.BeforeMethod;
6 import org.testng.annotations.Test;
8 import java.io.IOException;
12 public class PortMirroringEnricherTest extends BaseToscaEnrichmentTest {
14 private PortMirroringEnricher portMirroringEnricher;
16 @BeforeMethod(alwaysRun = true)
17 public void init() throws IOException {
18 portMirroringEnricher = new PortMirroringEnricher();
22 public void testEnrichNoPorts() throws Exception {
23 outputFilesPath = "/mock/enrichPortMirroring/noPorts/out/";
24 ToscaServiceModel toscaServiceModel =
25 loadToscaServiceModel("/mock/enrichPortMirroring/noPorts/in/",
26 "/mock/toscaGlobalServiceTemplates/",
27 "MainServiceTemplate.yaml");
28 Map<String, List<ErrorMessage>> errors =
29 portMirroringEnricher.enrich(toscaServiceModel);
31 compareActualAndExpectedModel(toscaServiceModel);
35 public void testEnrichSingleSubstitutionSamePortType() throws Exception {
36 outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/samePortType/out/";
37 ToscaServiceModel toscaServiceModel =
38 loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/samePortType/in",
39 "/mock/toscaGlobalServiceTemplates/",
40 "MainServiceTemplate.yaml");
41 Map<String, List<ErrorMessage>> errors =
42 portMirroringEnricher.enrich(toscaServiceModel);
44 compareActualAndExpectedModel(toscaServiceModel);
48 public void testEnrichSingleSubstitutionDiffPortType() throws Exception {
49 outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/";
50 ToscaServiceModel toscaServiceModel =
51 loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/diffPortType/in",
52 "/mock/toscaGlobalServiceTemplates/",
53 "MainServiceTemplate.yaml");
54 Map<String, List<ErrorMessage>> errors =
55 portMirroringEnricher.enrich(toscaServiceModel);
57 compareActualAndExpectedModel(toscaServiceModel);
61 public void testEnrichScalingInstance() throws Exception {
62 outputFilesPath = "/mock/enrichPortMirroring/scalingInstance/out/";
63 ToscaServiceModel toscaServiceModel =
64 loadToscaServiceModel("/mock/enrichPortMirroring/scalingInstance/in",
65 "/mock/toscaGlobalServiceTemplates/",
66 "MainServiceTemplate.yaml");
67 Map<String, List<ErrorMessage>> errors =
68 portMirroringEnricher.enrich(toscaServiceModel);
70 compareActualAndExpectedModel(toscaServiceModel);
74 public void testEnrichCatalogInstance() throws Exception {
75 outputFilesPath = "/mock/enrichPortMirroring/catalogInstance/out/";
76 ToscaServiceModel toscaServiceModel =
77 loadToscaServiceModel("/mock/enrichPortMirroring/catalogInstance/in",
78 "/mock/toscaGlobalServiceTemplates/",
79 "MainServiceTemplate.yaml");
80 Map<String, List<ErrorMessage>> errors =
81 portMirroringEnricher.enrich(toscaServiceModel);
83 compareActualAndExpectedModel(toscaServiceModel);
87 public void testEnrichNestedOneLevel() throws Exception {
88 outputFilesPath = "/mock/enrichPortMirroring/nested/oneLevel/out/";
89 ToscaServiceModel toscaServiceModel =
90 loadToscaServiceModel("/mock/enrichPortMirroring/nested/oneLevel/in",
91 "/mock/toscaGlobalServiceTemplates/",
92 "MainServiceTemplate.yaml");
93 Map<String, List<ErrorMessage>> errors =
94 portMirroringEnricher.enrich(toscaServiceModel);
96 compareActualAndExpectedModel(toscaServiceModel);
100 public void testEnrichNestedMultiLevel() throws Exception {
101 outputFilesPath = "/mock/enrichPortMirroring/nested/multiLevel/out/";
102 ToscaServiceModel toscaServiceModel =
103 loadToscaServiceModel("/mock/enrichPortMirroring/nested/multiLevel/in",
104 "/mock/toscaGlobalServiceTemplates/",
105 "MainServiceTemplate.yaml");
106 Map<String, List<ErrorMessage>> errors =
107 portMirroringEnricher.enrich(toscaServiceModel);
109 compareActualAndExpectedModel(toscaServiceModel);