2  * ============LICENSE_START=======================================================
 
   3  *  Copyright (C) 2018 Ericsson. All rights reserved.
 
   4  *  Modifications Copyright (C) 2020 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.
 
  18  * SPDX-License-Identifier: Apache-2.0
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.onap.policy.distribution.reception.handling.sdc;
 
  24 import java.util.ArrayList;
 
  25 import java.util.Collection;
 
  27 import org.onap.policy.distribution.forwarding.PolicyForwarder;
 
  28 import org.onap.policy.distribution.forwarding.PolicyForwardingException;
 
  29 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
 
  32  * Class to create a dummy forwarder for test cases.
 
  34  * @author Ram Krishna Verma (ram.krishna.verma@ericsson.com)
 
  36 public class DummyPolicyForwarder implements PolicyForwarder {
 
  37     private int numberOfPoliciesReceived = 0;
 
  38     private Collection<ToscaEntity> policiesReceived = new ArrayList<>();
 
  44     public void forward(final Collection<ToscaEntity> policies) throws PolicyForwardingException {
 
  45         numberOfPoliciesReceived += policies.size();
 
  46         policiesReceived.addAll(policies);
 
  50      * Returns the number of policies received by this forwarder.
 
  52      * @return the integer value
 
  54     public int getNumberOfPoliciesReceived() {
 
  55         return numberOfPoliciesReceived;
 
  59      * Checks if the forwarder has received a policy with given policy type.
 
  61      * @param policyType the policy type
 
  62      * @return the boolean result
 
  64     public boolean receivedPolicyWithGivenType(final String policyType) {
 
  65         for (final ToscaEntity policy : policiesReceived) {
 
  66             if (policy.getName().contains(policyType)) {
 
  77     public void configure(final String parameterGroupName) {