Support TOSCA functions in Node Filters
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / utils / CINodeFilterUtilsTest.java
1 /*
2  * -
3  *  * ============LICENSE_START=======================================================
4  *  *  Copyright (C) 2019  Nordix Foundation.
5  *  * ================================================================================
6  *  * Licensed under the Apache License, Version 2.0 (the "License");
7  *  * you may not use this file except in compliance with the License.
8  *  * You may obtain a copy of the License at
9  *  *
10  *  *      http://www.apache.org/licenses/LICENSE-2.0
11  *  *
12  *  * Unless required by applicable law or agreed to in writing, software
13  *  * distributed under the License is distributed on an "AS IS" BASIS,
14  *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  * See the License for the specific language governing permissions and
16  *  * limitations under the License.
17  *  *
18  *  * SPDX-License-Identifier: Apache-2.0
19  *  * ============LICENSE_END=========================================================
20  *
21  */
22
23 package org.openecomp.sdc.be.components.impl.utils;
24
25 import static org.junit.jupiter.api.Assertions.assertEquals;
26
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31 import org.junit.jupiter.api.Test;
32 import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
33 import org.openecomp.sdc.be.model.UploadNodeFilterCapabilitiesInfo;
34 import org.openecomp.sdc.be.model.UploadNodeFilterInfo;
35 import org.openecomp.sdc.be.model.UploadNodeFilterPropertyInfo;
36
37
38 class CINodeFilterUtilsTest {
39
40     private final CINodeFilterUtils ciNodeFilterUtils = new CINodeFilterUtils();
41
42     @Test
43     void testNodeFilterDataDefinition() {
44         UploadNodeFilterInfo uNodeFilterInfo = new UploadNodeFilterInfo();
45
46         UploadNodeFilterPropertyInfo propertyInfo = new UploadNodeFilterPropertyInfo();
47         propertyInfo.setName("prop1");
48         List<UploadNodeFilterPropertyInfo> properties = new ArrayList<>();
49         properties.add(propertyInfo);
50
51         UploadNodeFilterCapabilitiesInfo capabilitiesInfo = new UploadNodeFilterCapabilitiesInfo();
52         capabilitiesInfo.setName("cap1");
53         capabilitiesInfo.setProperties(properties);
54
55         Map<String, UploadNodeFilterCapabilitiesInfo> capabilities = new HashMap<>();
56         capabilities.put("test", capabilitiesInfo);
57         uNodeFilterInfo.setCapabilities(capabilities);
58
59         CINodeFilterDataDefinition dataDefinition = ciNodeFilterUtils.getNodeFilterDataDefinition(uNodeFilterInfo, "id");
60         assertEquals("id", dataDefinition.getID());
61     }
62 }