[SDC-29] Amdocs OnBoard 1707 initial commit.
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / java / org / openecomp / sdc / translator / services / heattotosca / impl / resourcetranslation / ResourceTranslationResourceGroupImplTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
22
23 import org.junit.Before;
24 import org.junit.Rule;
25 import org.junit.Test;
26 import org.junit.rules.ExpectedException;
27 import org.junit.runner.RunWith;
28 import org.mockito.runners.MockitoJUnitRunner;
29
30 import java.io.IOException;
31
32 @RunWith(MockitoJUnitRunner.class)
33 public class ResourceTranslationResourceGroupImplTest extends BaseResourceTranslationTest {
34   @Rule
35   public ExpectedException thrown = ExpectedException.none();
36
37   @Override
38   @Before
39   public void setUp() throws IOException {
40     // do not delete this function. it prevents the superclass setup from running
41   }
42
43   @Test
44   public void testTranslateResourceGroup() throws Exception {
45     inputFilesPath = "/mock/heat/nested/resource_group/inputs";
46     outputFilesPath = "/mock/heat/nested/resource_group/expectedoutputfiles";
47     initTranslatorAndTranslate();
48     testTranslation();
49   }
50
51   @Test
52   public void testTranslateMultiResourceGroup() throws Exception {
53     inputFilesPath = "/mock/heat/nested/multiple_resource_groups/inputs";
54     outputFilesPath = "/mock/heat/nested/multiple_resource_groups/expectedoutputfiles";
55     initTranslatorAndTranslate();
56     testTranslation();
57   }
58
59   @Test
60   public void testTranslateResourceGroupDynamicCount() throws Exception {
61     inputFilesPath = "/mock/heat/nested/resource_group_with_dynamic_count/inputs";
62     outputFilesPath = "/mock/heat/nested/resource_group_with_dynamic_count/expectedoutputfiles";
63     initTranslatorAndTranslate();
64     testTranslation();
65   }
66
67
68   @Test
69   public void testTranslatePortToNetNestedByResourceGroupConnection() throws Exception {
70     inputFilesPath = "/mock/services/heattotosca/porttonetresourcegroupconnection/inputfiles";
71     outputFilesPath =
72         "/mock/services/heattotosca/porttonetresourcegroupconnection/expectedoutputfiles";
73     initTranslatorAndTranslate();
74     testTranslation();
75   }
76
77   @Test
78   public void testTranslatePortToNetSharedConnection() throws Exception {
79     inputFilesPath = "/mock/services/heattotosca/porttosharednetresourcegrouplinking/inputfiles";
80     outputFilesPath =
81         "/mock/services/heattotosca/porttosharednetresourcegrouplinking/expectedoutputfiles";
82     initTranslatorAndTranslate();
83     testTranslation();
84   }
85
86   @Test
87   public void testTranslateSecurityGroupToSharedPortConnection() throws Exception {
88     inputFilesPath =
89         "/mock/services/heattotosca/securityruletosharedportresourcegrouplinking/inputfiles";
90     outputFilesPath =
91         "/mock/services/heattotosca/securityruletosharedportresourcegrouplinking/expectedoutputfiles";
92     initTranslatorAndTranslate();
93     testTranslation();
94   }
95
96   @Test
97   public void testTranslateResourceGroupIndexVar() throws Exception {
98     inputFilesPath = "/mock/heat/nested/resourceGroupIndexVar/inputs";
99     outputFilesPath = "/mock/heat/nested/resourceGroupIndexVar/expectedoutputfiles";
100     initTranslatorAndTranslate();
101     testTranslation();
102   }
103
104   @Test
105   public void testTranslateMDNS() throws Exception {
106     inputFilesPath = "/mock/heat/nested/resourceGroupMDNS/inputs";
107     outputFilesPath = "/mock/heat/nested/resourceGroupMDNS/expectedoutputfiles";
108     initTranslatorAndTranslate();
109     testTranslation();
110   }
111
112
113 }