[SDC] Onboarding 1710 rebase.
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / java / org / openecomp / sdc / translator / services / heattotosca / impl / fulltest / UnifiedCompositionNestedPatternsFullTest.java
1 package org.openecomp.sdc.translator.services.heattotosca.impl.fulltest;
2
3 import org.junit.Before;
4 import org.junit.Test;
5 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseFullTranslationTest;
6
7 import java.io.IOException;
8
9 public class UnifiedCompositionNestedPatternsFullTest extends BaseFullTranslationTest {
10
11     @Override
12     @Before
13     public void setUp() throws IOException {
14         // do not delete this function. it prevents the superclass setup from running
15     }
16
17     @Test
18     public void testNestedWithOneLevelMultipleComputesSingleSubstitution() throws IOException {
19         inputFilesPath =
20             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedSingleSubstitution1B/in";
21         outputFilesPath =
22             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedSingleSubstitution1B/out";
23
24         testTranslationWithInit();
25     }
26
27     @Test
28     public void testNestedWithOneLevelMultipleComputesScalingInstance() throws IOException {
29         inputFilesPath =
30             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedScalingInstance/in";
31         outputFilesPath =
32             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedScalingInstance/out";
33
34         testTranslationWithInit();
35     }
36
37     @Test
38     public void testNestedWithOneLevelMultipleComputesCatalogInstance() throws IOException {
39         inputFilesPath =
40             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedCatalogInstance/in";
41         outputFilesPath =
42             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedCatalogInstance/out";
43
44         testTranslationWithInit();
45     }
46
47     @Test
48     public void testNestedWithOneLevelAllNonNestedPatterns() throws IOException {
49         inputFilesPath =
50             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllNonNestedPatterns/in";
51         outputFilesPath =
52             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllNonNestedPatterns/out";
53
54         testTranslationWithInit();
55     }
56
57     @Test
58     public void testNestedWithOneLevelNoCompute() throws IOException {
59         inputFilesPath =
60             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedNoCompute/in";
61         outputFilesPath =
62             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedNoCompute/out";
63
64         testTranslationWithInit();
65     }
66
67     @Test
68     public void testNestedWithOneLevelOtherPatternsNoComputeWithConnectivity() throws IOException {
69         //One nested resource with no Compute, one nested resource having all non nested patterns
70         // with connectivity between themo
71         inputFilesPath =
72             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/in";
73         outputFilesPath =
74             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedAllPatternsConnectivity/out";
75
76         testTranslationWithInit();
77     }
78
79     @Test
80     public void testNestedWithOneLevelTwoSameFileOneOtherAllPattern1B() throws IOException {
81         // Heat file with 3 nested resources, while 2 point to the same nested heat file, and all
82         // nested heat file including pattern 1B.
83         inputFilesPath =
84             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameFileOneDiff/in";
85         outputFilesPath =
86             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameFileOneDiff/out";
87
88         testTranslationWithInit();
89     }
90
91     @Test
92     public void testNestedWithOneLevelTwoSameFileOneOtherAllPattern1BWithConnectivity() throws
93         IOException {
94         // Heat file with 3 nested resources, while 2 point to the same nested heat file, and all
95         // nested heat file including pattern 1B. +  conectivity between all nested resources
96         inputFilesPath =
97             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameOneDiffWithConnectivity/in";
98         outputFilesPath =
99             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/oneLevel/nestedTwoSameOneDiffWithConnectivity/out";
100
101         testTranslationWithInit();
102     }
103
104     //**************** NESTED MULTI-LEVEL TESTS ******************************
105
106     @Test
107     public void testNestedMultiLevelPortSecurityGroupNetworkPattern1B() throws
108         IOException {
109         // heat file - 1 nested resource + security group which will be connected to port in ALL
110         // nested levels, network which will be connected from port in ALL nested level.
111         //nested heat level 1 - 1 nested resource  + pattern 1B
112         //nested heat level 2 - 1 nested resource  + pattern 1B
113         inputFilesPath =
114             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/in";
115         outputFilesPath =
116             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/portSecurityGroupNetPattern1B/out";
117
118         testTranslationWithInit();
119     }
120
121     @Test
122     public void testNestedMultiLevelAllPatternsDependsOnConnectivity() throws
123         IOException {
124         /*
125         HEAT FILE - 1 : nested resource to heat without nova in the nested heat + 1 nested
126         resource + pattern 1B +  pattern C1 + pattern 4 + connectivity between them all (using
127         depends on from/to the first nested resource, without nova)
128
129         NESTED HEAT LEVEL 1 - 1 nested resource + pattern 1B +  pattern C1 + pattern 4 +
130         connectivity between them all (VM Types same as Main)
131
132         NESTED HEAT LEVEL 2 - 1 nested resource + pattern 1B +  pattern C1 + pattern 4 +
133         connectivity between them all
134         */
135
136         inputFilesPath =
137             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/in";
138         outputFilesPath =
139             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/allPatternsDependsOnConnectivity/out";
140
141         testTranslationWithInit();
142     }
143
144     @Test
145     public void testThreeNestedLevelsDiffVmTypePattern1B() throws IOException {
146         inputFilesPath =
147             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsDiffVmTypePattern1B/in";
148         outputFilesPath =
149             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsDiffVmTypePattern1B/out";
150
151         testTranslationWithInit();
152     }
153
154     @Test
155     public void testThreeNestedLevelsSameVmTypePattern1B() throws IOException {
156         inputFilesPath =
157             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsSameVmTypePattern1B/in";
158         outputFilesPath =
159             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/threeNestedLevelsSameVmTypePattern1B/out";
160
161         testTranslationWithInit();
162     }
163
164     @Test
165     public void testTwoNestedLevelsWithAllPatternsAndConnectionsBetweenThem() throws IOException {
166         inputFilesPath =
167             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/in";
168         outputFilesPath =
169             "/mock/services/heattotosca/fulltest/nestedOtherScenarios/multiLevel/twoNestedLevelsWithAllPatternsAndConnectivities/out";
170
171         testTranslationWithInit();
172     }
173
174 }