[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 / functiontranslation / FunctionTranslationGetAttrImplTest.java
1 package org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation;
2
3 import org.junit.Before;
4 import org.junit.Test;
5 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants;
6 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest;
7
8 import java.io.IOException;
9
10 public class FunctionTranslationGetAttrImplTest extends BaseResourceTranslationTest {
11
12   @Override
13   @Before
14   public void setUp() throws IOException {
15     // do not delete this function. it prevents the superclass setup from running
16   }
17
18   @Test
19   public void testTranslateGetAtt() throws Exception {
20     inputFilesPath =
21         "/mock/services/heattotosca/getAttr/getAttrUC/inputfiles";
22     outputFilesPath =
23         "/mock/services/heattotosca/getAttr/getAttrUC/expectedoutputfiles";
24     initTranslatorAndTranslate();
25     testTranslation();
26     validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_MORE_THAN_ONE_ATTR_IN_ATTR_LIST);
27   }
28
29   @Test
30   public void testTranslateGetAttUnsupportedResource() throws Exception {
31     inputFilesPath =
32         "/mock/services/heattotosca/getAttr/getAttrUnsupportedResource/inputfiles";
33     outputFilesPath =
34         "/mock/services/heattotosca/getAttr/getAttrUnsupportedResource/expectedoutputfiles";
35     initTranslatorAndTranslate();
36     testTranslation();
37     validateGetAttribute(TestConstants.TEST_IGNORE_GET_ATTR_FROM_OUTPUT);
38   }
39
40   @Test
41   public void testTranslateGetAttUnsupportedAttr() throws Exception {
42     inputFilesPath =
43         "/mock/services/heattotosca/getAttr/getAttrUnsupportedAttr/inputfiles";
44     outputFilesPath =
45         "/mock/services/heattotosca/getAttr/getAttrUnsupportedAttr/expectedoutputfiles";
46     initTranslatorAndTranslate();
47     testTranslation();
48     validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_NOT_SUPPORTED_ATTR_IN_ATTR_LIST);
49   }
50
51   @Test
52   public void testTranslateGetAttNestedAttr() throws Exception {
53     inputFilesPath =
54         "/mock/services/heattotosca/getAttrNestedAtt/inputfiles";
55     outputFilesPath =
56         "/mock/services/heattotosca/getAttrNestedAtt/expectedoutputfiles";
57     initTranslatorAndTranslate();
58     testTranslation();
59   }
60
61   @Test
62   public void testTranslateGetAttDynamicParam() throws Exception {
63     inputFilesPath =
64         "/mock/services/heattotosca/getAttrDynamicParam/inputfiles";
65     outputFilesPath =
66         "/mock/services/heattotosca/getAttrDynamicParam/expectedoutputfiles";
67     initTranslatorAndTranslate();
68     testTranslation();
69     validateGetAttribute(TestConstants.TEST_OUTPUT_GET_ATTR);
70   }
71
72   @Test
73   public void testTranslateGetAttOnlyResourceName() throws Exception {
74     inputFilesPath =
75         "/mock/services/heattotosca/getAttr/getAttrOnlyResourceName/inputfiles";
76     outputFilesPath =
77         "/mock/services/heattotosca/getAttr/getAttrOnlyResourceName/expectedoutputfiles";
78     initTranslatorAndTranslate();
79     testTranslation();
80     validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_ONLY_RESOURCE_NAME);
81   }
82
83   @Test
84   public void testTranslateGetAttNonePortOrCompute() throws Exception {
85     inputFilesPath =
86         "/mock/services/heattotosca/buildconsolidationdata/getattribute/noneToPortOrCompute/inputs";
87     outputFilesPath =
88         "/mock/services/heattotosca/buildconsolidationdata/getattribute/noneToPortOrCompute/expectedoutputfiles";
89     initTranslatorAndTranslate();
90     testTranslation();
91     validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_NONE_TO_PORT_OR_COMPUTE);
92   }
93
94   @Test
95   public void testTranslateDynamicGetAttrWithEmptyMapDefaultValue() throws IOException {
96     inputFilesPath =
97         "/mock/services/heattotosca/getAttrDynamicParamEmptyMap/inputs";
98     outputFilesPath =
99         "/mock/services/heattotosca/getAttrDynamicParamEmptyMap/expectedoutputfiles";
100     initTranslatorAndTranslate();
101     testTranslation();
102   }
103
104 }