2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 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.controlloop.drl.legacy;
23 import static org.junit.Assert.assertEquals;
25 import org.junit.Before;
26 import org.junit.Test;
28 public class ControlLoopParamsTest {
29 private static final String CONTROL_LOOP_NAME = "c";
30 private static final String POLICY_NAME = "m";
31 private static final String POLICY_SCOPE = "s";
32 private static final String POLICY_VERSION = "v";
33 private static final String CONTROL_LOOP_YAML = "y";
35 private ControlLoopParams clp = new ControlLoopParams();
42 clp.setClosedLoopControlName(CONTROL_LOOP_NAME);
43 clp.setPolicyName(POLICY_NAME);
44 clp.setPolicyScope(POLICY_SCOPE);
45 clp.setPolicyVersion(POLICY_VERSION);
46 clp.setControlLoopYaml(CONTROL_LOOP_YAML);
50 public void getClosedLoopControlName() {
51 assertEquals(CONTROL_LOOP_NAME, clp.getClosedLoopControlName());
55 public void getControlLoopYaml() {
56 assertEquals(CONTROL_LOOP_YAML, clp.getControlLoopYaml());
60 public void getPolicyName() {
61 assertEquals(POLICY_NAME, clp.getPolicyName());
65 public void getPolicyScope() {
66 assertEquals(POLICY_SCOPE, clp.getPolicyScope());
70 public void getPolicyVersion() {
71 assertEquals(POLICY_VERSION, clp.getPolicyVersion());
75 public void setClosedLoopControlName() {
76 clp.setClosedLoopControlName(CONTROL_LOOP_NAME.toUpperCase());
77 assertEquals(CONTROL_LOOP_NAME.toUpperCase(), clp.getClosedLoopControlName());
81 public void setControlLoopYaml() {
82 clp.setControlLoopYaml(CONTROL_LOOP_YAML.toUpperCase());
83 assertEquals(CONTROL_LOOP_YAML.toUpperCase(), clp.getControlLoopYaml());
87 public void setPolicyName() {
88 clp.setPolicyName(POLICY_NAME.toUpperCase());
89 assertEquals(POLICY_NAME.toUpperCase(), clp.getPolicyName());
93 public void setPolicyScope() {
94 clp.setPolicyScope(POLICY_SCOPE.toUpperCase());
95 assertEquals(POLICY_SCOPE.toUpperCase(), clp.getPolicyScope());
99 public void setPolicyVersion() {
100 clp.setPolicyVersion(POLICY_VERSION.toUpperCase());
101 assertEquals(POLICY_VERSION.toUpperCase(), clp.getPolicyVersion());
105 public void testTwo() {
106 ControlLoopParams other = new ControlLoopParams();
107 other.setClosedLoopControlName(CONTROL_LOOP_NAME);
108 other.setPolicyName(POLICY_NAME);
109 other.setPolicyScope(POLICY_SCOPE);
110 other.setPolicyVersion(POLICY_VERSION);
111 other.setControlLoopYaml(CONTROL_LOOP_YAML);
113 assertEquals(clp, other);
114 assertEquals(clp.hashCode(), other.hashCode());
115 assertEquals(clp.toString(), other.toString());