Catalog alignment
[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 org.junit.Test;
26 import org.openecomp.sdc.be.datatypes.elements.CINodeFilterDataDefinition;
27 import org.openecomp.sdc.be.model.UploadNodeFilterCapabilitiesInfo;
28 import org.openecomp.sdc.be.model.UploadNodeFilterInfo;
29 import org.openecomp.sdc.be.model.UploadNodeFilterPropertyInfo;
30
31 import java.util.ArrayList;
32 import java.util.HashMap;
33 import java.util.List;
34 import java.util.Map;
35
36 import static org.junit.Assert.assertEquals;
37
38 public class CINodeFilterUtilsTest {
39
40     private CINodeFilterUtils ciNodeFilterUtils;
41
42     @Test
43     public void testNodeFilterDataDefinition(){
44         ciNodeFilterUtils = new CINodeFilterUtils();
45         UploadNodeFilterInfo uNodeFilterInfo = new UploadNodeFilterInfo();
46
47         UploadNodeFilterPropertyInfo propertyInfo = new UploadNodeFilterPropertyInfo();
48         propertyInfo.setName("prop1");
49         List<UploadNodeFilterPropertyInfo> properties = new ArrayList<>();
50         properties.add(propertyInfo);
51
52         UploadNodeFilterCapabilitiesInfo capabilitiesInfo = new UploadNodeFilterCapabilitiesInfo();
53         capabilitiesInfo.setName("cap1");
54         capabilitiesInfo.setProperties(properties);
55
56         Map<String, UploadNodeFilterCapabilitiesInfo> capabilities = new HashMap<>();
57         capabilities.put("test", capabilitiesInfo);
58         uNodeFilterInfo.setCapabilities(capabilities);
59
60         CINodeFilterDataDefinition dataDefinition = ciNodeFilterUtils.getNodeFilterDataDefinition(uNodeFilterInfo, "id");
61         assertEquals("id", dataDefinition.getID());
62     }
63 }