Changes for checkstyle 8.32
[policy/apex-pdp.git] / services / services-engine / src / test / java / org / onap / policy / apex / service / engine / engdep / DummyEngineService.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2020 Nordix Foundation.
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
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.apex.service.engine.engdep;
23
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.List;
27 import org.apache.commons.lang3.NotImplementedException;
28 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
29 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
30 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel;
31 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState;
32 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
33 import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
34 import org.onap.policy.apex.service.engine.runtime.EngineService;
35 import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
36
37 /**
38  * A dummy engine service class.
39  */
40 public class DummyEngineService implements EngineService {
41
42     private AxArtifactKey startEngineKey;
43     private AxArtifactKey stopEngineKey;
44     private long periodicPeriod;
45     private AxArtifactKey statusKey;
46     private AxArtifactKey runtimeInfoKey;
47     private int modelKeyGetCalled;
48     private AxArtifactKey updateModelKey;
49
50     /**
51      * {@inheritDoc}.
52      */
53     @Override
54     public void registerActionListener(String listenerName, ApexEventListener listener) {
55         throw new NotImplementedException("Not implemented on dummy class");
56     }
57
58     /**
59      * {@inheritDoc}.
60      */
61     @Override
62     public void deregisterActionListener(String listenerName) {
63         throw new NotImplementedException("Not implemented on dummy class");
64     }
65
66     /**
67      * {@inheritDoc}.
68      */
69     @Override
70     public EngineServiceEventInterface getEngineServiceEventInterface() {
71         throw new NotImplementedException("Not implemented on dummy class");
72     }
73
74     /**
75      * {@inheritDoc}.
76      */
77     @Override
78     public AxArtifactKey getKey() {
79         return new AxArtifactKey("DummyEngineService:0.0.1");
80     }
81
82     /**
83      * {@inheritDoc}.
84      */
85     @Override
86     public Collection<AxArtifactKey> getEngineKeys() {
87         List<AxArtifactKey> keys = new ArrayList<>();
88         keys.add(new AxArtifactKey("DummyEngineService:0.0.1"));
89         return keys;
90     }
91
92     /**
93      * {@inheritDoc}.
94      */
95     @Override
96     public AxArtifactKey getApexModelKey() {
97         modelKeyGetCalled++;
98
99         return new AxArtifactKey("DummyApexModelKey:0.0.1");
100     }
101
102     /**
103      * {@inheritDoc}.
104      */
105     @Override
106     public void updateModel(AxArtifactKey engineServiceKey, String apexModelString, boolean forceFlag)
107                     throws ApexException {
108         updateModelKey = engineServiceKey;
109     }
110
111     /**
112      * {@inheritDoc}.
113      */
114     @Override
115     public void updateModel(AxArtifactKey engineServiceKey, AxPolicyModel apexModel, boolean forceFlag)
116                     throws ApexException {
117         throw new NotImplementedException("Not implemented on dummy class");
118     }
119
120     /**
121      * {@inheritDoc}.
122      */
123     @Override
124     public AxEngineState getState() {
125         throw new NotImplementedException("Not implemented on dummy class");
126     }
127
128     /**
129      * {@inheritDoc}.
130      */
131     @Override
132     public List<AxEngineModel> getEngineStats() {
133         throw new NotImplementedException("Not implemented on dummy class");
134     }
135
136     /**
137      * {@inheritDoc}.
138      */
139     @Override
140     public void startAll() throws ApexException {
141         throw new NotImplementedException("Not implemented on dummy class");
142     }
143
144     /**
145      * {@inheritDoc}.
146      */
147     @Override
148     public void start(AxArtifactKey engineKey) throws ApexException {
149         startEngineKey = engineKey;
150     }
151
152     /**
153      * {@inheritDoc}.
154      */
155     @Override
156     public void stop() throws ApexException {
157     }
158
159     /**
160      * {@inheritDoc}.
161      */
162     @Override
163     public void stop(AxArtifactKey engineKey) throws ApexException {
164         stopEngineKey = engineKey;
165     }
166
167     /**
168      * {@inheritDoc}.
169      */
170     @Override
171     public void clear() throws ApexException {
172         throw new NotImplementedException("Not implemented on dummy class");
173     }
174
175     /**
176      * {@inheritDoc}.
177      */
178     @Override
179     public void clear(AxArtifactKey engineKey) throws ApexException {
180         throw new NotImplementedException("Not implemented on dummy class");
181     }
182
183     /**
184      * {@inheritDoc}.
185      */
186     @Override
187     public boolean isStarted() {
188         throw new NotImplementedException("Not implemented on dummy class");
189     }
190
191     /**
192      * {@inheritDoc}.
193      */
194     @Override
195     public boolean isStarted(AxArtifactKey engineKey) {
196         throw new NotImplementedException("Not implemented on dummy class");
197     }
198
199     /**
200      * {@inheritDoc}.
201      */
202     @Override
203     public boolean isStopped() {
204         throw new NotImplementedException("Not implemented on dummy class");
205     }
206
207     /**
208      * {@inheritDoc}.
209      */
210     @Override
211     public boolean isStopped(AxArtifactKey engineKey) {
212         throw new NotImplementedException("Not implemented on dummy class");
213     }
214
215     /**
216      * {@inheritDoc}.
217      */
218     @Override
219     public void startPeriodicEvents(long period) throws ApexException {
220         periodicPeriod = period;
221     }
222
223     /**
224      * {@inheritDoc}.
225      */
226     @Override
227     public void stopPeriodicEvents() throws ApexException {
228         periodicPeriod = 0;
229     }
230
231     /**
232      * {@inheritDoc}.
233      */
234     @Override
235     public String getStatus(AxArtifactKey engineKey) throws ApexException {
236         statusKey = engineKey;
237         return "The Status";
238     }
239
240     /**
241      * {@inheritDoc}.
242      */
243     @Override
244     public String getRuntimeInfo(AxArtifactKey engineKey) throws ApexException {
245         runtimeInfoKey = engineKey;
246         return "The Runtime Info";
247     }
248
249     public AxArtifactKey getStartEngineKey() {
250         return startEngineKey;
251     }
252
253     public AxArtifactKey getStopEngineKey() {
254         return stopEngineKey;
255     }
256
257     public long getPeriodicPeriod() {
258         return periodicPeriod;
259     }
260
261     public AxArtifactKey getStatusKey() {
262         return statusKey;
263     }
264
265     public AxArtifactKey getRuntimeInfoKey() {
266         return runtimeInfoKey;
267     }
268
269     public int getModelKeyGetCalled() {
270         return modelKeyGetCalled;
271     }
272
273     public AxArtifactKey getUpdateModelKey() {
274         return updateModelKey;
275     }
276 }