Sorted out unit-test libraries in onboarding
[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 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.openecomp.sdc.enrichment.impl.tosca;
18
19 import java.io.IOException;
20 import java.util.List;
21 import java.util.Map;
22 import org.junit.Before;
23 import org.junit.Test;
24 import org.openecomp.sdc.datatypes.error.ErrorMessage;
25 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
26
27 public class PortMirroringEnricherTest extends BaseToscaEnrichmentTest {
28
29   private PortMirroringEnricher portMirroringEnricher;
30
31   @Before
32   public void init() {
33     portMirroringEnricher = new PortMirroringEnricher();
34   }
35
36   @Test
37   public void testEnrichNoPorts() throws Exception {
38     outputFilesPath = "/mock/enrichPortMirroring/noPorts/out/";
39     ToscaServiceModel toscaServiceModel =
40         loadToscaServiceModel("/mock/enrichPortMirroring/noPorts/in/",
41             "/mock/toscaGlobalServiceTemplates/",
42             "MainServiceTemplate.yaml");
43     Map<String, List<ErrorMessage>> errors =
44         portMirroringEnricher.enrich(toscaServiceModel);
45
46     compareActualAndExpectedModel(toscaServiceModel);
47   }
48
49   @Test
50   public void testEnrichSingleSubstitutionSamePortType() throws Exception {
51     outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/samePortType/out/";
52     ToscaServiceModel toscaServiceModel =
53         loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/samePortType/in",
54             "/mock/toscaGlobalServiceTemplates/",
55             "MainServiceTemplate.yaml");
56     Map<String, List<ErrorMessage>> errors =
57         portMirroringEnricher.enrich(toscaServiceModel);
58
59     compareActualAndExpectedModel(toscaServiceModel);
60   }
61
62   @Test
63   public void testEnrichSingleSubstitutionDiffPortType() throws Exception {
64     outputFilesPath = "/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/";
65     ToscaServiceModel toscaServiceModel =
66         loadToscaServiceModel("/mock/enrichPortMirroring/singleSubstitution/diffPortType/in",
67             "/mock/toscaGlobalServiceTemplates/",
68             "MainServiceTemplate.yaml");
69     Map<String, List<ErrorMessage>> errors =
70         portMirroringEnricher.enrich(toscaServiceModel);
71
72     compareActualAndExpectedModel(toscaServiceModel);
73   }
74
75   @Test
76   public void testEnrichScalingInstance() throws Exception {
77     outputFilesPath = "/mock/enrichPortMirroring/scalingInstance/out/";
78     ToscaServiceModel toscaServiceModel =
79         loadToscaServiceModel("/mock/enrichPortMirroring/scalingInstance/in",
80             "/mock/toscaGlobalServiceTemplates/",
81             "MainServiceTemplate.yaml");
82     Map<String, List<ErrorMessage>> errors =
83         portMirroringEnricher.enrich(toscaServiceModel);
84
85     compareActualAndExpectedModel(toscaServiceModel);
86   }
87
88   @Test
89   public void testEnrichCatalogInstance() throws Exception {
90     outputFilesPath = "/mock/enrichPortMirroring/catalogInstance/out/";
91     ToscaServiceModel toscaServiceModel =
92         loadToscaServiceModel("/mock/enrichPortMirroring/catalogInstance/in",
93             "/mock/toscaGlobalServiceTemplates/",
94             "MainServiceTemplate.yaml");
95     Map<String, List<ErrorMessage>> errors =
96         portMirroringEnricher.enrich(toscaServiceModel);
97
98     compareActualAndExpectedModel(toscaServiceModel);
99   }
100
101   @Test
102   public void testEnrichNestedOneLevel() throws Exception {
103     outputFilesPath = "/mock/enrichPortMirroring/nested/oneLevel/out/";
104     ToscaServiceModel toscaServiceModel =
105         loadToscaServiceModel("/mock/enrichPortMirroring/nested/oneLevel/in",
106             "/mock/toscaGlobalServiceTemplates/",
107             "MainServiceTemplate.yaml");
108     Map<String, List<ErrorMessage>> errors =
109         portMirroringEnricher.enrich(toscaServiceModel);
110
111     compareActualAndExpectedModel(toscaServiceModel);
112   }
113
114   @Test
115   public void testEnrichNestedMultiLevel() throws Exception {
116     outputFilesPath = "/mock/enrichPortMirroring/nested/multiLevel/out/";
117     ToscaServiceModel toscaServiceModel =
118         loadToscaServiceModel("/mock/enrichPortMirroring/nested/multiLevel/in",
119             "/mock/toscaGlobalServiceTemplates/",
120             "MainServiceTemplate.yaml");
121     Map<String, List<ErrorMessage>> errors =
122         portMirroringEnricher.enrich(toscaServiceModel);
123
124     compareActualAndExpectedModel(toscaServiceModel);
125   }
126
127 }