Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-enrichment-lib / openecomp-sdc-enrichment-impl / src / test / java / org / openecomp / sdc / enrichment / impl / tosca / PortMirroringEnricherTest.java
1 package org.openecomp.sdc.enrichment.impl.tosca;
2
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;
7
8 import java.io.IOException;
9 import java.util.List;
10 import java.util.Map;
11
12 public class PortMirroringEnricherTest extends BaseToscaEnrichmentTest {
13
14   private PortMirroringEnricher portMirroringEnricher;
15
16   @BeforeMethod(alwaysRun = true)
17   public void init() throws IOException {
18     portMirroringEnricher = new PortMirroringEnricher();
19   }
20
21   @Test
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);
30
31     compareActualAndExpectedModel(toscaServiceModel);
32   }
33
34   @Test
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);
43
44     compareActualAndExpectedModel(toscaServiceModel);
45   }
46
47   @Test
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);
56
57     compareActualAndExpectedModel(toscaServiceModel);
58   }
59
60   @Test
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);
69
70     compareActualAndExpectedModel(toscaServiceModel);
71   }
72
73   @Test
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);
82
83     compareActualAndExpectedModel(toscaServiceModel);
84   }
85
86   @Test
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);
95
96     compareActualAndExpectedModel(toscaServiceModel);
97   }
98
99   @Test
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);
108
109     compareActualAndExpectedModel(toscaServiceModel);
110   }
111
112 }