2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.rest.jpa;
24 import static org.junit.Assert.assertTrue;
26 import java.util.Date;
28 import org.junit.Before;
29 import org.junit.Test;
30 import org.onap.policy.common.logging.flexlogger.FlexLogger;
31 import org.onap.policy.common.logging.flexlogger.Logger;
34 * The Class DecisionDictionaryJpaTest.
36 public class DecisionDictionaryJpaTest {
38 private static Logger logger = FlexLogger.getLogger(DecisionDictionaryJpaTest.class);
39 private UserInfo userInfo;
44 * @throws Exception the exception
47 public void setUp() throws Exception {
48 logger.info("setUp: Entering");
49 userInfo = new UserInfo();
50 userInfo.setUserLoginId("Test");
51 userInfo.setUserName("Test");
52 logger.info("setUp: exit");
56 * Test decision settings.
59 public void testDecisionSettings() {
60 DecisionSettings data = new DecisionSettings();
62 assertTrue(1 == data.getId());
65 data.setDescription("Test");
66 assertTrue("Test".equals(data.getDescription()));
67 data.setXacmlId("Test");
68 assertTrue("Test".equals(data.getXacmlId()));
69 data.setDatatypeBean(new Datatype());
70 assertTrue(data.getDatatypeBean() != null);
71 data.setIssuer("Test");
72 assertTrue("Test".equals(data.getIssuer()));
73 data.setMustBePresent(true);
74 assertTrue(data.isMustBePresent());
75 data.setPriority("Test");
76 assertTrue("Test".equals(data.getPriority()));
77 data.setCreatedDate(new Date());
78 assertTrue(data.getCreatedDate() != null);
79 data.setModifiedDate(new Date());
80 assertTrue(data.getModifiedDate() != null);
81 data.setUserCreatedBy(userInfo);
82 assertTrue(data.getUserCreatedBy() != null);
83 data.setUserModifiedBy(userInfo);
84 assertTrue(data.getUserModifiedBy() != null);
88 * Test rainy day treatments.
91 public void testRainyDayTreatments() {
92 RainyDayTreatments data = new RainyDayTreatments();
94 assertTrue(1 == data.getId());
96 assertTrue("Test".equals(data.getBbid()));
97 data.setWorkstep("Test");
98 assertTrue("Test".equals(data.getWorkstep()));
99 data.setTreatments("Test");
100 assertTrue("Test".equals(data.getTreatments()));