automate dependency.json version population
[policy/engine.git] / BRMSGateway / src / test / java / org / onap / policy / brms / BrmsJpaTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP Policy Engine
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
21 package org.onap.policy.brms;
22
23 import static org.junit.Assert.assertEquals;
24
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
28 import java.util.Map;
29
30 import org.junit.Test;
31 import org.onap.policy.api.PEDependency;
32 import org.onap.policy.brms.entity.BrmsGroupInfo;
33 import org.onap.policy.brms.entity.BrmsPolicyInfo;
34 import org.onap.policy.brms.entity.DependencyInfo;
35
36 public class BrmsJpaTest {
37     @Test
38     public void testJpa() {
39         final String testVal = "testVal";
40         final BrmsGroupInfo groupInfo = new BrmsGroupInfo();
41
42         // Test group info
43         groupInfo.setControllerName(testVal);
44         assertEquals(groupInfo.getControllerName(), testVal);
45         groupInfo.setGroupId(testVal);
46         assertEquals(groupInfo.getGroupId(), testVal);
47         groupInfo.setArtifactId(testVal);
48         assertEquals(groupInfo.getArtifactId(), testVal);
49         groupInfo.setVersion(testVal);
50         assertEquals(groupInfo.getVersion(), testVal);
51
52         // Test policy info
53         final BrmsPolicyInfo policyInfo = new BrmsPolicyInfo();
54         policyInfo.setPolicyName(testVal);
55         assertEquals(policyInfo.getPolicyName(), testVal);
56         policyInfo.setControllerName(groupInfo);
57         assertEquals(policyInfo.getControllerName(), groupInfo);
58     }
59
60     @Test
61     public void testDependencyInfo() {
62         final String testKey = "testKey";
63         final PEDependency dependency = new PEDependency();
64         final List<PEDependency> list = new ArrayList<PEDependency>();
65         list.add(dependency);
66         final Map<String, List<PEDependency>> map = new HashMap<String, List<PEDependency>>();
67         map.put(testKey, list);
68         final DependencyInfo info = new DependencyInfo();
69
70         info.setDependencies(map);
71         assertEquals(info.getDependencies(), map);
72     }
73 }