2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.brms;
23 import static org.junit.Assert.assertEquals;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
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;
36 public class BrmsJpaTest {
38 public void testJpa() {
39 final String testVal = "testVal";
40 final BrmsGroupInfo groupInfo = new BrmsGroupInfo();
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);
53 final BrmsPolicyInfo policyInfo = new BrmsPolicyInfo();
54 policyInfo.setPolicyName(testVal);
55 assertEquals(policyInfo.getPolicyName(), testVal);
56 policyInfo.setControllerName(groupInfo);
57 assertEquals(policyInfo.getControllerName(), groupInfo);
61 public void testDependencyInfo() {
62 final String testKey = "testKey";
63 final PEDependency dependency = new PEDependency();
64 final List<PEDependency> list = new ArrayList<PEDependency>();
66 final Map<String, List<PEDependency>> map = new HashMap<String, List<PEDependency>>();
67 map.put(testKey, list);
68 final DependencyInfo info = new DependencyInfo();
70 info.setDependencies(map);
71 assertEquals(info.getDependencies(), map);