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
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.apex.service.engine.engdep;
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;
38 * A dummy engine service class.
40 public class DummyEngineService implements EngineService {
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;
54 public void registerActionListener(String listenerName, ApexEventListener listener) {
55 throw new NotImplementedException("Not implemented on dummy class");
62 public void deregisterActionListener(String listenerName) {
63 throw new NotImplementedException("Not implemented on dummy class");
70 public EngineServiceEventInterface getEngineServiceEventInterface() {
71 throw new NotImplementedException("Not implemented on dummy class");
78 public AxArtifactKey getKey() {
79 return new AxArtifactKey("DummyEngineService:0.0.1");
86 public Collection<AxArtifactKey> getEngineKeys() {
87 List<AxArtifactKey> keys = new ArrayList<>();
88 keys.add(new AxArtifactKey("DummyEngineService:0.0.1"));
96 public AxArtifactKey getApexModelKey() {
99 return new AxArtifactKey("DummyApexModelKey:0.0.1");
106 public void updateModel(AxArtifactKey engineServiceKey, String apexModelString, boolean forceFlag)
107 throws ApexException {
108 updateModelKey = engineServiceKey;
115 public void updateModel(AxArtifactKey engineServiceKey, AxPolicyModel apexModel, boolean forceFlag)
116 throws ApexException {
117 throw new NotImplementedException("Not implemented on dummy class");
124 public AxEngineState getState() {
125 throw new NotImplementedException("Not implemented on dummy class");
132 public List<AxEngineModel> getEngineStats() {
133 throw new NotImplementedException("Not implemented on dummy class");
140 public void startAll() throws ApexException {
141 throw new NotImplementedException("Not implemented on dummy class");
148 public void start(AxArtifactKey engineKey) throws ApexException {
149 startEngineKey = engineKey;
156 public void stop() throws ApexException {
163 public void stop(AxArtifactKey engineKey) throws ApexException {
164 stopEngineKey = engineKey;
171 public void clear() throws ApexException {
172 throw new NotImplementedException("Not implemented on dummy class");
179 public void clear(AxArtifactKey engineKey) throws ApexException {
180 throw new NotImplementedException("Not implemented on dummy class");
187 public boolean isStarted() {
188 throw new NotImplementedException("Not implemented on dummy class");
195 public boolean isStarted(AxArtifactKey engineKey) {
196 throw new NotImplementedException("Not implemented on dummy class");
203 public boolean isStopped() {
204 throw new NotImplementedException("Not implemented on dummy class");
211 public boolean isStopped(AxArtifactKey engineKey) {
212 throw new NotImplementedException("Not implemented on dummy class");
219 public void startPeriodicEvents(long period) throws ApexException {
220 periodicPeriod = period;
227 public void stopPeriodicEvents() throws ApexException {
235 public String getStatus(AxArtifactKey engineKey) throws ApexException {
236 statusKey = engineKey;
244 public String getRuntimeInfo(AxArtifactKey engineKey) throws ApexException {
245 runtimeInfoKey = engineKey;
246 return "The Runtime Info";
249 public AxArtifactKey getStartEngineKey() {
250 return startEngineKey;
253 public AxArtifactKey getStopEngineKey() {
254 return stopEngineKey;
257 public long getPeriodicPeriod() {
258 return periodicPeriod;
261 public AxArtifactKey getStatusKey() {
265 public AxArtifactKey getRuntimeInfoKey() {
266 return runtimeInfoKey;
269 public int getModelKeyGetCalled() {
270 return modelKeyGetCalled;
273 public AxArtifactKey getUpdateModelKey() {
274 return updateModelKey;