2 * Copyright © 2016-2018 European Support Limited
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.openecomp.sdc.translator.services.heattotosca.impl.functiontranslation;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants;
22 import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest;
24 import java.io.IOException;
26 public class FunctionTranslationGetAttrImplTest extends BaseResourceTranslationTest {
30 public void setUp() throws IOException {
31 // do not delete this function. it prevents the superclass setup from running
35 public void testTranslateGetAtt() throws Exception {
37 "/mock/services/heattotosca/getAttr/getAttrUC/inputfiles";
39 "/mock/services/heattotosca/getAttr/getAttrUC/expectedoutputfiles";
40 initTranslatorAndTranslate();
42 validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_MORE_THAN_ONE_ATTR_IN_ATTR_LIST);
46 public void testTranslateGetAttUnsupportedResource() throws Exception {
48 "/mock/services/heattotosca/getAttr/getAttrUnsupportedResource/inputfiles";
50 "/mock/services/heattotosca/getAttr/getAttrUnsupportedResource/expectedoutputfiles";
51 initTranslatorAndTranslate();
53 validateGetAttribute(TestConstants.TEST_IGNORE_GET_ATTR_FROM_OUTPUT);
57 public void testTranslateGetAttUnsupportedAttr() throws Exception {
59 "/mock/services/heattotosca/getAttr/getAttrUnsupportedAttr/inputfiles";
61 "/mock/services/heattotosca/getAttr/getAttrUnsupportedAttr/expectedoutputfiles";
62 initTranslatorAndTranslate();
64 validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_NOT_SUPPORTED_ATTR_IN_ATTR_LIST);
68 public void testTranslateGetAttNestedAttr() throws Exception {
70 "/mock/services/heattotosca/getAttrNestedAtt/inputfiles";
72 "/mock/services/heattotosca/getAttrNestedAtt/expectedoutputfiles";
73 initTranslatorAndTranslate();
78 public void testTranslateGetAttDynamicParam() throws Exception {
80 "/mock/services/heattotosca/getAttrDynamicParam/inputfiles";
82 "/mock/services/heattotosca/getAttrDynamicParam/expectedoutputfiles";
83 initTranslatorAndTranslate();
85 validateGetAttribute(TestConstants.TEST_OUTPUT_GET_ATTR);
89 public void testTranslateGetAttOnlyResourceName() throws Exception {
91 "/mock/services/heattotosca/getAttr/getAttrOnlyResourceName/inputfiles";
93 "/mock/services/heattotosca/getAttr/getAttrOnlyResourceName/expectedoutputfiles";
94 initTranslatorAndTranslate();
96 validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_ONLY_RESOURCE_NAME);
100 public void testTranslateGetAttNonePortOrCompute() throws Exception {
102 "/mock/services/heattotosca/buildconsolidationdata/getattribute/noneToPortOrCompute/inputs";
104 "/mock/services/heattotosca/buildconsolidationdata/getattribute/noneToPortOrCompute/expectedoutputfiles";
105 initTranslatorAndTranslate();
107 validateGetAttribute(TestConstants.TEST_GET_ATTR_FOR_NONE_TO_PORT_OR_COMPUTE);
111 public void testTranslateDynamicGetAttrWithEmptyMapDefaultValue() throws IOException {
113 "/mock/services/heattotosca/getAttrDynamicParamEmptyMap/inputs";
115 "/mock/services/heattotosca/getAttrDynamicParamEmptyMap/expectedoutputfiles";
116 initTranslatorAndTranslate();