2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.sdc.impl;
23 import org.testng.annotations.Test;
24 import org.onap.sdc.toscaparser.api.parameters.Input;
26 import java.util.List;
28 import static org.testng.Assert.assertEquals;
29 import static org.testng.Assert.assertNotNull;
30 import static org.testng.Assert.assertNull;
32 public class ToscaParserServiceInputTest extends SdcToscaParserBasicTest {
34 //region getServiceInputs
36 public void testGetServiceInputs(){
37 List<Input> serviceInputs = fdntCsarHelper.getServiceInputs();
38 assertNotNull(serviceInputs);
39 assertEquals(1, serviceInputs.size());
43 public void testServiceInputs() {
44 List<Input> inputs = rainyCsarHelperSingleVf.getServiceInputs();
45 assertNotNull(inputs);
46 assertEquals(0, inputs.size());
50 //region getServiceInputLeafValueOfDefault
52 public void testGetServiceInputLeafValue(){
53 String serviceInputLeafValue = fdntCsarHelper.getServiceInputLeafValueOfDefault("service_naming#default");
54 assertEquals("test service naming", serviceInputLeafValue);
58 // public void testGetServiceInputLeafValueWithGetInput(){
59 // String serviceInputLeafValue = fdntCsarHelperWithInputs.getServiceInputLeafValueOfDefault("my_input#default");
60 // assertEquals(null, serviceInputLeafValue);
64 public void testGetServiceInputLeafValueNotExists(){
65 String serviceInputLeafValue = fdntCsarHelper.getServiceInputLeafValueOfDefault("service_naming#default#kuku");
66 assertNull(serviceInputLeafValue);
70 public void testGetServiceInputLeafValueNull(){
71 String serviceInputLeafValue = fdntCsarHelper.getServiceInputLeafValueOfDefault(null);
72 assertNull(serviceInputLeafValue);
76 //region getServiceInputLeafValueOfDefaultAsObject
78 public void testGetServiceInputLeafValueOfDefaultAsObject() {
79 Object serviceInputLeafValue = fdntCsarHelper.getServiceInputLeafValueOfDefault("service_naming#default");
80 assertEquals("test service naming", serviceInputLeafValue);
84 public void testGetServiceComplexInputLeafValueOfDefault() {
85 String serviceInputLeafValue = fdntCsarHelperWithInputs.getServiceInputLeafValueOfDefault("complex_input#default#ipv4_subnet_default_assignment#cidr_mask");
86 assertEquals(serviceInputLeafValue, "24");
90 public void testGetServiceDummyComplexInputLeafValueOfDefault() {
91 String serviceInputLeafValue = fdntCsarHelperWithInputs.getServiceInputLeafValueOfDefault("complex_input#default#ipv4_subnet_default_assignment#XXX");
92 assertNull(serviceInputLeafValue);