CLAMP Model policy creation support
[policy/engine.git] / ONAP-REST / src / test / java / org / onap / policy / rest / util / MSAttributeObjectTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2018-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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.policy.rest.util;
22
23 import static org.junit.Assert.assertTrue;
24 import java.util.HashMap;
25 import org.junit.Test;
26
27 public class MSAttributeObjectTest {
28
29     @Test
30     public void testMSAttributeObject() {
31         MSAttributeObject data = new MSAttributeObject();
32         data.setClassName("Test");
33         assertTrue("Test".equals(data.getClassName()));
34         data.setRefAttribute(new HashMap<>());
35         assertTrue(data.getRefAttribute() != null);
36         data.setAttribute(new HashMap<>());
37         assertTrue(data.getAttribute() != null);
38         data.setEnumType(new HashMap<>());
39         assertTrue(data.getEnumType() != null);
40         data.addAttribute("test", "test");
41         data.addRefAttribute("test", "test");
42         data.addAllAttribute(new HashMap<>());
43         data.addAllRefAttribute(new HashMap<>());
44         data.setSubClass(new HashMap<>());
45         assertTrue(data.getSubClass() != null);
46         data.addAllSubClass(new HashMap<>());
47         data.setDependency("Test");
48         assertTrue("Test".equals(data.getDependency()));
49         data.addSingleEnum("test", "test");
50         data.setMatchingSet(new HashMap<>());
51         assertTrue(data.getMatchingSet() != null);
52         data.addMatchingSet("test", "test");
53         data.addMatchingSet(new HashMap<>());
54         data.setPolicyTempalate(true);
55         assertTrue(data.isPolicyTempalate());
56         data.setRuleFormation("ruleFormation");
57         assertTrue(data.getRuleFormation() != null);
58         data.setDataOrderInfo("dataOrderInfo");
59         assertTrue(data.getDataOrderInfo() != null);
60     }
61
62     @Test
63     public void testMSAttributeValue() {
64         MSAttributeValue data = new MSAttributeValue();
65         data.setName("Test");
66         assertTrue("Test".equals(data.getName()));
67         data.setType("Test");
68         assertTrue("Test".equals(data.getType()));
69         data.setRequired(true);
70         assertTrue(data.getRequired());
71         data.setArrayValue(true);
72         assertTrue(data.getArrayValue());
73         data.setDefaultValue("Test");
74         assertTrue("Test".equals(data.getDefaultValue()));
75     }
76 }