548e3fc84d56f44368188ca9924bb315534eb2ba
[policy/engine.git] / ONAP-REST / src / test / java / org / onap / policy / rest / jpa / MicroServiceDictionaryJPATest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2018 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 package org.onap.policy.rest.jpa;
21
22 import static org.junit.Assert.assertTrue;
23
24 import org.junit.Before;
25 import org.junit.Test;
26 import org.onap.policy.common.logging.flexlogger.FlexLogger;
27 import org.onap.policy.common.logging.flexlogger.Logger;
28
29 public class MicroServiceDictionaryJPATest {
30
31     private static Logger logger = FlexLogger.getLogger(MicroServiceDictionaryJPATest.class);
32     private UserInfo userInfo;
33
34     @Before
35     public void setUp() throws Exception {
36         logger.info("setUp: Entering");
37         userInfo = new UserInfo();
38         userInfo.setUserLoginId("Test");
39         userInfo.setUserName("Test");
40         logger.info("setUp: exit");
41     }
42
43     @Test
44     public void testDCAEUsers(){
45         DCAEUsers data = new DCAEUsers();
46         data.setId(1);
47         assertTrue(1 == data.getId());
48         data.setName("Test");
49         assertTrue("Test".equals(data.getName()));
50         data.setDescriptionValue("Test");
51         assertTrue("Test".equals(data.getDescriptionValue()));
52     }
53
54     @Test
55     public void testDCAEuuid(){
56         DCAEuuid data = new DCAEuuid();
57         data.setId(1);
58         assertTrue(1 == data.getId());
59         data.setName("Test");
60         assertTrue("Test".equals(data.getName()));
61         data.setDescription("Test");
62         assertTrue("Test".equals(data.getDescription()));
63     }
64
65     @Test
66     public void testMSConfigName(){
67         MicroServiceConfigName data = new MicroServiceConfigName();
68         data.setId(1);
69         assertTrue(1 == data.getId());
70         data.setName("Test");
71         assertTrue("Test".equals(data.getName()));
72         data.setDescriptionValue("Test");
73         assertTrue("Test".equals(data.getDescriptionValue()));
74     }
75
76     @Test
77     public void testMSConfigLocation(){
78         MicroServiceLocation data = new MicroServiceLocation();
79         data.setId(1);
80         assertTrue(1 == data.getId());
81         data.setName("Test");
82         assertTrue("Test".equals(data.getName()));
83         data.setDescriptionValue("Test");
84         assertTrue("Test".equals(data.getDescriptionValue()));
85     }
86
87     @Test
88     public void testMSModels(){
89         MicroServiceModels data = new MicroServiceModels();
90         data.setId(1);
91         assertTrue(1 == data.getId());
92         data.setModelName("Test");
93         assertTrue("Test".equals(data.getModelName()));
94         data.setDescription("Test");
95         assertTrue("Test".equals(data.getDescription()));
96         data.setDependency("Test");
97         assertTrue("Test".equals(data.getDependency()));
98         data.setEnumValues("Test");
99         assertTrue("Test".equals(data.getEnumValues()));
100         data.setAnnotation("Test");
101         assertTrue("Test".equals(data.getAnnotation()));
102         data.setAttributes("Test");
103         assertTrue("Test".equals(data.getAttributes()));
104         data.setRef_attributes("Test");
105         assertTrue("Test".equals(data.getRef_attributes()));
106         data.setUserCreatedBy(userInfo);
107         assertTrue(data.getUserCreatedBy()!=null);
108         data.setSub_attributes("Test");
109         assertTrue("Test".equals(data.getSub_attributes()));
110         data.setVersion("Test");
111         assertTrue("Test".equals(data.getVersion()));
112     }
113
114     @Test
115     public void testMSAttributeDictionary(){
116         MicroServiceAttribute data = new MicroServiceAttribute();
117         data.setId(1);
118         assertTrue(1 == data.getId());
119         data.setName("Test");
120         assertTrue("Test".equals(data.getName()));
121         data.setValue("Test");
122         assertTrue("Test".equals(data.getValue()));
123         data.setModelName("Test");
124         assertTrue("Test".equals(data.getModelName()));
125     }
126
127     @Test
128     public void testPolicyScopeService(){
129         PolicyScopeService data = new PolicyScopeService();
130         data.setId(1);
131         assertTrue(1 == data.getId());
132         data.setName("Test");
133         assertTrue("Test".equals(data.getName()));
134         data.setDescriptionValue("Test");
135         assertTrue("Test".equals(data.getDescriptionValue()));
136     }
137
138     @Test
139     public void testPolicyScopeResource(){
140         PolicyScopeResource data = new PolicyScopeResource();
141         data.setId(1);
142         assertTrue(1 == data.getId());
143         data.setName("Test");
144         assertTrue("Test".equals(data.getName()));
145         data.setDescriptionValue("Test");
146         assertTrue("Test".equals(data.getDescriptionValue()));
147     }
148
149     @Test
150     public void testPolicyScopeType(){
151         PolicyScopeType data = new PolicyScopeType();
152         data.setId(1);
153         assertTrue(1 == data.getId());
154         data.setName("Test");
155         assertTrue("Test".equals(data.getName()));
156         data.setDescriptionValue("Test");
157         assertTrue("Test".equals(data.getDescriptionValue()));
158     }
159
160     @Test
161     public void testPolicyScopeClosedLoop(){
162         PolicyScopeClosedLoop data = new PolicyScopeClosedLoop();
163         data.setId(1);
164         assertTrue(1 == data.getId());
165         data.setName("Test");
166         assertTrue("Test".equals(data.getName()));
167         data.setDescriptionValue("Test");
168         assertTrue("Test".equals(data.getDescriptionValue()));
169     }
170
171     @Test
172     public void testPolicyScopeGroupPolicyScopeList(){
173         GroupPolicyScopeList data = new GroupPolicyScopeList();
174         data.setId(1);
175         assertTrue(1 == data.getId());
176         data.setGroupName("Test");
177         assertTrue("Test".equals(data.getGroupName()));
178         data.setDescription("Test");
179         assertTrue("Test".equals(data.getDescription()));
180         data.setGroupList("Test");
181         assertTrue("Test".equals(data.getGroupList()));
182     }
183
184     @Test
185     public void testClosedLoops(){
186         ClosedLoops data = new ClosedLoops();
187         data.setId(1);
188         assertTrue(1 == data.getId());
189         data.setClosedLoopControlName("Test");
190         assertTrue("Test".equals(data.getClosedLoopControlName()));
191         data.setAlarmConditions("Test");
192         assertTrue("Test".equals(data.getAlarmConditions()));
193         data.setYaml("Test");
194         assertTrue("Test".equals(data.getYaml()));
195     }
196
197     @Test
198     public void testVMType(){
199         VMType data = new VMType();
200         data.setId(1);
201         assertTrue(1 == data.getId());
202         data.setName("Test");
203         assertTrue("Test".equals(data.getName()));
204         data.setDescription("Test");
205         assertTrue("Test".equals(data.getDescription()));
206     }
207
208 }

© 2017 ONAP. Copyright © The Linux Foundation ®. All Rights Reserved.
The Linux Foundation has registered trademarks and uses trademarks.
For a list of trademarks of The Linux Foundation, please see our Trademark Usage page.
Linux is a registered trademark of Linus Torvalds.
Privacy Policy and Terms of Use