3 * ================================================================================
4 * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
20 package org.onap.policy.controlloop.actor.a1p;
22 import static org.junit.Assert.assertEquals;
23 import static org.junit.Assert.assertNotNull;
24 import static org.junit.Assert.assertSame;
26 import java.util.stream.Collectors;
27 import java.util.stream.Stream;
28 import org.junit.Test;
29 import org.onap.policy.controlloop.actor.test.BasicActor;
30 import org.onap.policy.controlloop.actorserviceprovider.Operator;
32 public class A1pActorTest extends BasicActor {
35 public void testConstructor() {
36 A1pActor prov = new A1pActor();
37 assertEquals(0, prov.getSequenceNumber());
39 // verify that it has the operators we expect
40 var expected = Stream.of(A1pOperation.NAME).collect(Collectors.toList());
41 var actual = prov.getOperationNames().stream().sorted().collect(Collectors.toList());
43 assertEquals(expected.toString(), actual.toString());
47 public void testActorService() {
48 // verify that it all plugs into the ActorService
49 verifyActorService(A1pActor.NAME, "service.yaml");
53 public void testGetOperator() {
54 A1pActor sp = new A1pActor();
56 // should always return the same operator regardless of the name
57 Operator oper = sp.getOperator("unknown");
59 assertSame(oper, sp.getOperator("another"));