Add collaboration feature
[sdc.git] / openecomp-be / lib / openecomp-sdc-translator-lib / openecomp-sdc-translator-core / src / test / java / org / openecomp / sdc / translator / services / heattotosca / impl / resourcetranslation / ResourceTranslationCinderVolumeAttachmentImplTest.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.Test;
25 import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
26
27 import java.io.IOException;
28
29 import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_VOLUME_NEGATIVE;
30 import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_VOLUME_POSITIVE;
31
32
33 public class ResourceTranslationCinderVolumeAttachmentImplTest extends BaseResourceTranslationTest {
34
35   @Override
36   @Before
37   public void setUp() throws IOException {
38     // do not delete this function. it prevents the superclass setup from running
39   }
40
41   @Test
42   public void testTranslateAllResourcesInOneFile() throws Exception {
43     inputFilesPath = "/mock/services/heattotosca/vol_attach/volume_and_attach_one_file/inputfiles";
44     outputFilesPath =
45         "/mock/services/heattotosca/vol_attach/volume_and_attach_one_file/expectedoutputfiles";
46     initTranslatorAndTranslate();
47     testTranslation();
48     validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
49         TEST_VOLUME_POSITIVE);
50   }
51
52   @Test
53   public void testVolFileIsNestedInMainHeatFile() throws Exception {
54     inputFilesPath =
55         "/mock/services/heattotosca/vol_attach/volume_file_nested_in_main_file_in_manifest/inputfiles";
56     outputFilesPath =
57         "/mock/services/heattotosca/vol_attach/volume_file_nested_in_main_file_in_manifest/expectedoutputfiles";
58     initTranslatorAndTranslate();
59     testTranslation();
60     validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
61         TEST_VOLUME_POSITIVE);
62   }
63
64   @Test
65   public void testVolFileAsDataOfNested() throws Exception {
66     inputFilesPath = "/mock/services/heattotosca/vol_attach/nested_with_inner_vol/inputfiles";
67     outputFilesPath = "/mock/services/heattotosca/vol_attach/nested_with_inner_vol/out";
68     initTranslatorAndTranslate();
69     testTranslation();
70     validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
71         TEST_VOLUME_POSITIVE);
72   }
73
74   @Test
75   public void testVolFileIsParallelToMainHeatFile() throws Exception {
76     inputFilesPath =
77         "/mock/services/heattotosca/vol_attach/volume_file_parallel_to_main_file/inputfiles";
78     outputFilesPath =
79         "/mock/services/heattotosca/vol_attach/volume_file_parallel_to_main_file/expectedoutputfiles";
80     initTranslatorAndTranslate();
81     testTranslation();
82     validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
83         TEST_VOLUME_NEGATIVE);
84   }
85 }