453f86633a102f01df2bbf727ee7264310df8e2b
[policy/models.git] / models-provider / src / test / java / org / onap / policy / models / provider / impl / DummyBadProviderImpl.java
1 /*-
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
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.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;
44
45 /**
46  * Dummy implementation of {@link PolicyModelsProvider} with bad constructor.
47  *
48  * @author Liam Fallon (liam.fallon@est.tech)
49  */
50 public class DummyBadProviderImpl implements PolicyModelsProvider {
51     public DummyBadProviderImpl() {
52         throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, "Bad Request");
53     }
54
55     @Override
56     public void close() throws PfModelException {
57         // do nothing
58     }
59
60     @Override
61     public void init() throws PfModelException {
62         // do nothing
63     }
64
65     @Override
66     public ToscaServiceTemplate getPolicyTypes(final String name, final String version) throws PfModelException {
67         return null;
68     }
69
70     @Override
71     public ToscaServiceTemplate createPolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
72             throws PfModelException {
73         return null;
74     }
75
76     @Override
77     public ToscaServiceTemplate updatePolicyTypes(@NonNull ToscaServiceTemplate serviceTemplate)
78             throws PfModelException {
79         return null;
80     }
81
82     @Override
83     public ToscaServiceTemplate deletePolicyType(final String name, final String version) throws PfModelException {
84         return null;
85     }
86
87     @Override
88     public ToscaServiceTemplate getPolicies(final String name, final String version) throws PfModelException {
89         return null;
90     }
91
92     @Override
93     public ToscaServiceTemplate createPolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
94         return null;
95     }
96
97     @Override
98     public ToscaServiceTemplate updatePolicies(@NonNull ToscaServiceTemplate serviceTemplate) throws PfModelException {
99         return null;
100     }
101
102     @Override
103     public ToscaServiceTemplate deletePolicy(final String name, final String version) throws PfModelException {
104         return null;
105     }
106
107     @Override
108     public List<PdpGroup> getPdpGroups(String name) throws PfModelException {
109         return Collections.emptyList();
110     }
111
112     @Override
113     public List<PdpGroup> createPdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
114         return Collections.emptyList();
115     }
116
117     @Override
118     public List<PdpGroup> updatePdpGroups(@NonNull List<PdpGroup> pdpGroups) throws PfModelException {
119         return Collections.emptyList();
120     }
121
122     @Override
123     public void updatePdp(@NonNull String pdpGroupName, @NonNull String pdpSubGroup, @NonNull Pdp pdp)
124             throws PfModelException {
125         // do nothing
126     }
127
128     @Override
129     public PdpGroup deletePdpGroup(@NonNull String name) throws PfModelException {
130         return null;
131     }
132
133     @Override
134     public List<ToscaPolicyType> getPolicyTypeList(String name, String version) throws PfModelException {
135         return Collections.emptyList();
136     }
137
138     @Override
139     public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException {
140         return null;
141     }
142
143     @Override
144     public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter)
145             throws PfModelException {
146         return Collections.emptyList();
147     }
148
149     @Override
150     public List<ToscaPolicy> getPolicyList(String name, String version) throws PfModelException {
151         return Collections.emptyList();
152     }
153
154     @Override
155     public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException {
156         return null;
157     }
158
159     @Override
160     public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException {
161         return Collections.emptyList();
162     }
163
164     @Override
165     public List<PdpGroup> getFilteredPdpGroups(@NonNull PdpGroupFilter filter) throws PfModelException {
166         return Collections.emptyList();
167     }
168
169     @Override
170     public void updatePdpSubGroup(@NonNull String pdpGroupName, @NonNull PdpSubGroup pdpSubGroup)
171             throws PfModelException {
172         // do nothing
173     }
174
175     @Override
176     public List<PdpStatistics> getPdpStatistics(final String name, final Date timestamp) throws PfModelException {
177         return new ArrayList<>();
178     }
179
180     @Override
181     public List<PdpStatistics> getFilteredPdpStatistics(String name, String pdpGroupName, String pdpSubGroup,
182             Date startTimeStamp, Date endTimeStamp, String sortOrder, int getRecordNum) {
183         // Not implemented
184         return new ArrayList<>();
185     }
186
187     @Override
188     public List<PdpStatistics> createPdpStatistics(final List<PdpStatistics> pdpStatisticsList)
189             throws PfModelException {
190         // Not implemented
191         return new ArrayList<>();
192     }
193
194     @Override
195     public List<PdpStatistics> updatePdpStatistics(final List<PdpStatistics> pdpStatisticsList)
196             throws PfModelException {
197         // Not implemented
198         return new ArrayList<>();
199     }
200
201     @Override
202     public List<PdpStatistics> deletePdpStatistics(final String name, final Date timestamp) {
203         // Not implemented
204         return null;
205     }
206 }