[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 / SecurityRulesToPortResourceConnectionTest.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 static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedNodesConnectedInSecurityRuleToPort;
24
25 import org.junit.Before;
26 import org.junit.Test;
27 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants;
28
29 import java.io.IOException;
30
31
32 public class SecurityRulesToPortResourceConnectionTest extends BaseResourceTranslationTest {
33   @Override
34   @Before
35   public void setUp() throws IOException {
36     // do not delete this function. it prevents the superclass setup from running
37   }
38
39   @Test
40   public void testTranslateSecurityRuleToPortNestedConnection() throws Exception {
41     inputFilesPath =
42         "/mock/services/heattotosca/securityrulestoportconnection/securityrulestoportnestedconnection/inputfiles";
43     outputFilesPath =
44         "/mock/services/heattotosca/securityrulestoportconnection/securityrulestoportnestedconnection/expectedoutputfiles";
45     initTranslatorAndTranslate();
46     testTranslation();
47     validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
48         .TEST_SECURITY_RULE_PORT_NESTED_CONNECTION, translationContext);
49   }
50
51   @Test
52   public void testTranslateSecurityRuleToPortSharedPortNestedConnection() throws Exception {
53     inputFilesPath =
54         "/mock/services/heattotosca/securityrulestoportconnection/securityruletosharedportlinking/inputfiles";
55     outputFilesPath =
56         "/mock/services/heattotosca/securityrulestoportconnection/securityruletosharedportlinking/expectedoutputfiles";
57     initTranslatorAndTranslate();
58     testTranslation();
59     validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
60         .TEST_SECURITY_RULE_PORT_NESTED_SHARED_PORT, translationContext);
61   }
62
63   @Test
64   public void testSecurityRuleToPortConnectionSharedAddOnConnection() throws Exception {
65     inputFilesPath =
66             "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortSharedAddOn/inputfiles";
67     outputFilesPath =
68             "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortSharedAddOn/expectedoutputfiles";
69     initTranslatorAndTranslate();
70     testTranslation();
71   }
72
73   @Test
74   public void testSecurityRuleToPortConnectionNestedGetResource() throws Exception {
75     inputFilesPath =
76             "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortGetResource/inputfiles";
77     outputFilesPath =
78             "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortGetResource/out";
79     initTranslatorAndTranslate();
80     testTranslation();
81   }
82
83
84   @Test
85   public void testSecurityRuleToPortConnectionNestedMultiLevelsGetResource() throws Exception {
86     inputFilesPath =
87         "/mock/services/heattotosca/securityrulestoportconnection/nestedMultiLevels/inputfiles";
88     outputFilesPath =
89         "/mock/services/heattotosca/securityrulestoportconnection/nestedMultiLevels/expectedoutputfiles";
90     initTranslatorAndTranslate();
91     testTranslation();
92     validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
93         .TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_CONNECTION, translationContext);
94   }
95
96   @Test
97   public void testSecurityRuleToPortConnectionSharedNestedMultiLevelsGetResource()
98       throws Exception {
99     inputFilesPath =
100         "/mock/services/heattotosca/securityrulestoportconnection/sharedNestedMultiLevels/inputfiles";
101     outputFilesPath =
102         "/mock/services/heattotosca/securityrulestoportconnection/sharedNestedMultiLevels/expectedoutputfiles";
103     initTranslatorAndTranslate();
104     testTranslation();
105     validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
106         .TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_SHARED_PORT, translationContext);
107   }
108
109 }