New Optimization Policy
[policy/engine.git] / ONAP-REST / src / test / java / org / onap / policy / rest / jpa / OptimizationModelsJPATest.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 OptimizationModelsJPATest {
30
31         private static Logger logger = FlexLogger.getLogger(OptimizationModelsJPATest.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 testMSModels(){
45                 OptimizationModels data = new OptimizationModels();
46                 data.setId(1);
47                 assertTrue(1 == data.getId());
48                 data.setModelName("Test");
49                 assertTrue("Test".equals(data.getModelName()));
50                 data.setDescription("Test");
51                 assertTrue("Test".equals(data.getDescription()));
52                 data.setDependency("Test");
53                 assertTrue("Test".equals(data.getDependency()));
54                 data.setEnumValues("Test");
55                 assertTrue("Test".equals(data.getEnumValues()));
56                 data.setAnnotation("Test");
57                 assertTrue("Test".equals(data.getAnnotation()));
58                 data.setAttributes("Test");
59                 assertTrue("Test".equals(data.getAttributes()));
60                 data.setRefattributes("Test");
61                 assertTrue("Test".equals(data.getRefattributes()));
62                 data.setUserCreatedBy(userInfo);
63                 assertTrue(data.getUserCreatedBy()!=null);
64                 data.setSubattributes("Test");
65                 assertTrue("Test".equals(data.getSubattributes()));
66                 data.setVersion("Test");
67                 assertTrue("Test".equals(data.getVersion()));
68         }
69         
70         
71 }