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.actorserviceprovider.impl;
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import static org.mockito.Mockito.spy;
26 import static org.mockito.Mockito.verify;
29 import java.util.TreeMap;
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.onap.policy.controlloop.actorserviceprovider.Operation;
33 import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
35 public class OperatorPartialTest {
36 private static final String ACTOR = "my-actor";
37 private static final String OPERATION = "my-name";
39 private OperatorPartial operator;
42 * Initializes {@link #operator}.
46 operator = new OperatorPartial(ACTOR, OPERATION) {
48 public Operation buildOperation(ControlLoopOperationParams params) {
55 public void testOperatorPartial_testGetActorName_testGetName() {
56 assertEquals(ACTOR, operator.getActorName());
57 assertEquals(OPERATION, operator.getName());
58 assertEquals(ACTOR + "." + OPERATION, operator.getFullName());
62 public void testDoStart() {
63 operator.configure(null);
65 operator = spy(operator);
68 verify(operator).doStart();
72 public void testDoStop() {
73 operator.configure(null);
76 operator = spy(operator);
79 verify(operator).doStop();
83 public void testDoShutdown() {
84 operator.configure(null);
87 operator = spy(operator);
90 verify(operator).doShutdown();
94 public void testDoConfigureMapOfStringObject() {
95 operator = spy(operator);
97 Map<String, Object> params = new TreeMap<>();
98 operator.configure(params);
100 verify(operator).doConfigure(params);
104 public void testGetBlockingExecutor() {
105 assertNotNull(operator.getBlockingExecutor());