2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019-2020 Nordix Foundation.
4 * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
5 * Modifications Copyright (C) 2020 Bell Canada. 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.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.models.provider.impl;
25 import java.util.ArrayList;
26 import java.util.Collections;
27 import java.util.Date;
28 import java.util.List;
29 import javax.ws.rs.core.Response;
30 import lombok.NonNull;
31 import org.onap.policy.models.base.PfModelException;
32 import org.onap.policy.models.base.PfModelRuntimeException;
33 import org.onap.policy.models.pdp.concepts.Pdp;
34 import org.onap.policy.models.pdp.concepts.PdpGroup;
35 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
36 import org.onap.policy.models.pdp.concepts.PdpStatistics;
37 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
38 import org.onap.policy.models.provider.PolicyModelsProvider;
39 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
40 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
41 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
42 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
43 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
46 * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
48 * @author Liam Fallon (liam.fallon@est.tech)
50 public class DummyBadProviderImpl implements PolicyModelsProvider {
51 public DummyBadProviderImpl() {
52 throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
56 public void close() throws PfModelException {
61 public void init() throws PfModelException {
66 public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
71 public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
72 throws PfModelException {
77 public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
78 throws PfModelException {
83 public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
88 public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
93 public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
98 public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
103 public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
108 public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
109 return Collections.emptyList();
113 public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
114 return Collections.emptyList();
118 public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
119 return Collections.emptyList();
123 public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
124 throws PfModelException {
129 public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
134 public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
135 return Collections.emptyList();
139 public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
144 public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter)
145 throws PfModelException {
146 return Collections.emptyList();
150 public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
151 return Collections.emptyList();
155 public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
160 public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
161 return Collections.emptyList();
165 public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
166 return Collections.emptyList();
170 public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
171 throws PfModelException {
176 public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
177 return new ArrayList<>();
181 public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
182 Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
184 return new ArrayList<>();
188 public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
189 throws PfModelException {
191 return new ArrayList<>();
195 public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
196 throws PfModelException {
198 return new ArrayList<>();
202 public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {