1c2c9bc0628be8e333911ec2f375eb659bd6ff85
[dcaegen2/platform.git] / mod2 / helm-generator / helmchartgenerator-core / src / test / java / org / onap / dcaegen2 / platform / helmchartgenerator / ChartGeneratorTest.java
1 /*
2  * # ============LICENSE_START=======================================================
3  * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
4  * # ================================================================================
5  * # Licensed under the Apache License, Version 2.0 (the "License");
6  * # you may not use this file except in compliance with the License.
7  * # You may obtain a copy of the License at
8  * #
9  * #      http://www.apache.org/licenses/LICENSE-2.0
10  * #
11  * # Unless required by applicable law or agreed to in writing, software
12  * # distributed under the License is distributed on an "AS IS" BASIS,
13  * # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * # See the License for the specific language governing permissions and
15  * # limitations under the License.
16  * # ============LICENSE_END=========================================================
17  */
18
19
20 package org.onap.dcaegen2.platform.helmchartgenerator;
21
22 import org.junit.jupiter.api.Test;
23 import org.junit.jupiter.api.extension.ExtendWith;
24 import org.mockito.Mock;
25 import org.mockito.Mockito;
26 import org.mockito.junit.jupiter.MockitoExtension;
27 import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ChartGenerator;
28 import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.HelmClient;
29 import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.KeyValueMerger;
30 import org.onap.dcaegen2.platform.helmchartgenerator.models.chartinfo.ChartInfo;
31
32 import static org.mockito.ArgumentMatchers.any;
33
34 @ExtendWith(MockitoExtension.class)
35 class ChartGeneratorTest {
36
37     @Mock
38     private KeyValueMerger kvMerger;
39
40     @Mock
41     private HelmClient helmClient;
42
43     @Mock
44     private Utils utils;
45
46     @Test
47     void testChartGenerationSteps() throws Exception{
48         ChartGenerator chartGenerator = new ChartGenerator(helmClient, kvMerger, utils);
49         Mockito.when(utils.cloneFileToTempLocation(any())).thenReturn(any());
50
51         chartGenerator.generate("src/test/input/blueprint", new ChartInfo(), "src/test/output");
52
53         Mockito.verify(kvMerger, Mockito.times(1)).mergeValuesToChart(any(), any());
54         Mockito.verify(helmClient, Mockito.times(1)).lint(any());
55         Mockito.verify(helmClient, Mockito.times(1)).packageChart(any(), any());
56     }
57
58 }