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.actor.vfc;
23 import static org.mockito.Mockito.when;
25 import org.mockito.Mock;
26 import org.onap.policy.controlloop.actor.test.BasicHttpOperation;
27 import org.onap.policy.vfc.VfcRequest;
28 import org.onap.policy.vfc.VfcResponse;
30 public abstract class BasicVfcOperation extends BasicHttpOperation<VfcRequest> {
31 public static final String PATH_GET = "my-path-get/";
32 public static final int MAX_GETS = 3;
33 public static final int WAIT_SEC_GETS = 20;
36 protected VfcConfig config;
38 protected VfcResponse response;
41 * Constructs the object using a default actor and operation name.
43 public BasicVfcOperation() {
48 * Constructs the object.
50 * @param actor actor name
51 * @param operation operation name
53 public BasicVfcOperation(String actor, String operation) {
54 super(actor, operation);
58 * Initializes mocks and sets up.
60 public void setUp() throws Exception {
63 response = new VfcResponse();
67 when(rawResponse.getStatus()).thenReturn(200);
68 when(rawResponse.readEntity(String.class)).thenReturn(coder.encode(response));
74 protected void initConfig() {
76 when(config.getClient()).thenReturn(client);
77 when(config.getMaxGets()).thenReturn(MAX_GETS);
78 when(config.getPathGet()).thenReturn(PATH_GET);
79 when(config.getWaitSecGet()).thenReturn(WAIT_SEC_GETS);