dd19382fdcb610d3571c62035983605c76d8dff7
[dcaegen2/platform.git] / mod2 / helm-generator / helmchartgenerator-core / src / test / java / org / onap / dcaegen2 / platform / helmchartgenerator / ChartBuilderTest.java
1  /** # ============LICENSE_START=======================================================
2  * # Copyright (c) 2021 AT&T Intellectual Property. All rights reserved.
3  * # ================================================================================
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
7  * #
8  * #      http://www.apache.org/licenses/LICENSE-2.0
9  * #
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.
15  * # ============LICENSE_END=========================================================
16 */
17
18
19 package org.onap.dcaegen2.platform.helmchartgenerator;
20
21  import org.junit.jupiter.api.Test;
22  import org.junit.jupiter.api.extension.ExtendWith;
23  import org.mockito.Mock;
24  import org.mockito.Mockito;
25  import org.mockito.junit.jupiter.MockitoExtension;
26  import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ChartBuilder;
27  import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ChartGenerator;
28  import org.onap.dcaegen2.platform.helmchartgenerator.chartbuilder.ComponentSpecParser;
29  import org.onap.dcaegen2.platform.helmchartgenerator.validation.ChartTemplateStructureValidator;
30
31  import static org.mockito.ArgumentMatchers.any;
32
33  @ExtendWith(MockitoExtension.class)
34 class ChartBuilderTest {
35
36     @Mock
37     private ChartGenerator chartGenerator;
38
39     @Mock
40     private ComponentSpecParser specParser;
41
42     @Mock
43     private ChartTemplateStructureValidator validator;
44
45     @Test
46     void testChartBuilderSteps() throws Exception{
47         ChartBuilder builder = new ChartBuilder(specParser, chartGenerator, validator);
48         builder.build("someSpec", "someChartLocation", "someOutputLocation", "someSpecSchemaLocation");
49
50         Mockito.verify(specParser, Mockito.times(1)).extractChartInfo(any(), any(), any());
51         Mockito.verify(chartGenerator, Mockito.times(1)).generate(any(), any(), any());
52         Mockito.verify(validator, Mockito.times(1)).validateChartTemplateStructure(any());
53     }
54 }