Fix sonar in policy/models
[policy/models.git] / models-provider / src / test / java / org / onap / policy / models / provider / impl / DummyBadProviderImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019-2021 Nordix Foundation.
4  *  Modifications Copyright (C) 2019, 2021 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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  *
19  * SPDX-License-Identifier: Apache-2.0
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.policy.models.provider.impl;
24
25 import java.time.Instant;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.Collections;
29 import java.util.List;
30 import javax.ws.rs.core.Response;
31 import lombok.NonNull;
32 import org.onap.policy.models.base.PfModelException;
33 import org.onap.policy.models.base.PfModelRuntimeException;
34 import org.onap.policy.models.pap.concepts.PolicyAudit;
35 import org.onap.policy.models.pap.persistence.provider.PolicyAuditProvider.AuditFilter;
36 import org.onap.policy.models.pdp.concepts.Pdp;
37 import org.onap.policy.models.pdp.concepts.PdpGroup;
38 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
39 import org.onap.policy.models.pdp.concepts.PdpPolicyStatus;
40 import org.onap.policy.models.pdp.concepts.PdpStatistics;
41 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
42 import org.onap.policy.models.provider.PolicyModelsProvider;
43 import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
44 import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter;
45 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
48 import org.onap.policy.models.tosca.authorative.concepts.ToscaTypedEntityFilter;
49
50 /**
51  * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
52  *
53  * @author Liam Fallon (liam.fallon@est.tech)
54  */
55 public class DummyBadProviderImpl implements PolicyModelsProvider {
56     public DummyBadProviderImpl() {
57         throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
58     }
59
60     @Override
61     public void close() throws PfModelException {
62         // do nothing
63     }
64
65     @Override
66     public void init() throws PfModelException {
67         // do nothing
68     }
69
70     @Override
71     public List<ToscaServiceTemplate> getFilteredServiceTemplateList(
72             @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException {
73         return null;
74     }
75
76     @Override
77     public ToscaServiceTemplate createServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
78             throws PfModelException {
79         return null;
80     }
81
82     @Override
83     public ToscaServiceTemplate updateServiceTemplate(@NonNull ToscaServiceTemplate serviceTemplate)
84             throws PfModelException {
85         return null;
86     }
87
88     @Override
89     public ToscaServiceTemplate deleteServiceTemplate(@NonNull String name, @NonNull String version)
90             throws PfModelException {
91         return null;
92     }
93
94     @Override
95     public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
96         return null;
97     }
98
99     @Override
100     public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
101             throws PfModelException {
102         return null;
103     }
104
105     @Override
106     public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
107             throws PfModelException {
108         return null;
109     }
110
111     @Override
112     public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
113         return null;
114     }
115
116     @Override
117     public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
118         return null;
119     }
120
121     @Override
122     public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
123         return null;
124     }
125
126     @Override
127     public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
128         return null;
129     }
130
131     @Override
132     public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
133         return null;
134     }
135
136     @Override
137     public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
138         return Collections.emptyList();
139     }
140
141     @Override
142     public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
143         return Collections.emptyList();
144     }
145
146     @Override
147     public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
148         return Collections.emptyList();
149     }
150
151     @Override
152     public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
153             throws PfModelException {
154         // do nothing
155     }
156
157     @Override
158     public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
159         return null;
160     }
161
162     @Override
163     public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
164         return Collections.emptyList();
165     }
166
167     @Override
168     public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
169             throws PfModelException {
170         return null;
171     }
172
173     @Override
174     public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter)
175             throws PfModelException {
176         return Collections.emptyList();
177     }
178
179     @Override
180     public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
181         return Collections.emptyList();
182     }
183
184     @Override
185     public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
186             throws PfModelException {
187         return null;
188     }
189
190     @Override
191     public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter)
192             throws PfModelException {
193         return Collections.emptyList();
194     }
195
196     @Override
197     public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
198         return Collections.emptyList();
199     }
200
201     @Override
202     public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
203             throws PfModelException {
204         // do nothing
205     }
206
207     @Override
208     public List<PdpStatistics> getPdpStatistics(final String name, final Instant timestamp) throws PfModelException {
209         return new ArrayList<>();
210     }
211
212     @Override
213     public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
214             Instant startTimeStamp, Instant endTimeStamp, String sortOrder, int getRecordNum) {
215         // Not implemented
216         return new ArrayList<>();
217     }
218
219     @Override
220     public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
221             throws PfModelException {
222         // Not implemented
223         return new ArrayList<>();
224     }
225
226     @Override
227     public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
228             throws PfModelException {
229         // Not implemented
230         return new ArrayList<>();
231     }
232
233     @Override
234     public List<PdpStatistics> deletePdpStatistics(final String name, final Instant timestamp) {
235         // Not implemented
236         return null;
237     }
238
239     @Override
240     public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException {
241         // Not implemented
242         return null;
243     }
244
245     @Override
246     public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy)
247             throws PfModelException {
248         // Not implemented
249         return null;
250     }
251
252     @Override
253     public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException {
254         // Not implemented
255         return null;
256     }
257
258     @Override
259     public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs,
260             Collection<PdpPolicyStatus> deleteObjs) {
261         // Not implemented
262     }
263
264     @Override
265     public List<ToscaServiceTemplate> getServiceTemplateList(String name, String version) throws PfModelException {
266         // Not implemented
267         return null;
268     }
269
270     @Override
271     public void createAuditRecords(List<PolicyAudit> auditRecords) {
272         // Not implemented
273     }
274
275     @Override
276     public List<PolicyAudit> getAuditRecords(AuditFilter auditFilter, @NonNull Integer numRecords) {
277         // Not implemented
278         return null;
279     }
280 }