2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.service.engine.engdep;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 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.AxEngineState;
31 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
32 import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
33 import org.onap.policy.apex.service.engine.runtime.EngineService;
34 import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
37 * A dummy engine service class.
39 public class DummyEngineService implements EngineService {
41 private AxArtifactKey startEngineKey;
42 private AxArtifactKey stopEngineKey;
43 private long periodicPeriod;
44 private AxArtifactKey statusKey;
45 private AxArtifactKey runtimeInfoKey;
46 private int modelKeyGetCalled;
47 private AxArtifactKey updateModelKey;
53 public void registerActionListener(String listenerName, ApexEventListener listener) {
54 throw new NotImplementedException("Not implemented on dummy class");
61 public void deregisterActionListener(String listenerName) {
62 throw new NotImplementedException("Not implemented on dummy class");
69 public EngineServiceEventInterface getEngineServiceEventInterface() {
70 throw new NotImplementedException("Not implemented on dummy class");
77 public AxArtifactKey getKey() {
78 return new AxArtifactKey("DummyEngineService:0.0.1");
85 public Collection<AxArtifactKey> getEngineKeys() {
86 List<AxArtifactKey> keys = new ArrayList<>();
87 keys.add(new AxArtifactKey("DummyEngineService:0.0.1"));
95 public AxArtifactKey getApexModelKey() {
98 return new AxArtifactKey("DummyApexModelKey:0.0.1");
105 public void updateModel(AxArtifactKey engineServiceKey, String apexModelString, boolean forceFlag)
106 throws ApexException {
107 updateModelKey = engineServiceKey;
114 public void updateModel(AxArtifactKey engineServiceKey, AxPolicyModel apexModel, boolean forceFlag)
115 throws ApexException {
116 throw new NotImplementedException("Not implemented on dummy class");
123 public AxEngineState getState() {
124 throw new NotImplementedException("Not implemented on dummy class");
131 public void startAll() throws ApexException {
132 throw new NotImplementedException("Not implemented on dummy class");
139 public void start(AxArtifactKey engineKey) throws ApexException {
140 startEngineKey = engineKey;
147 public void stop() throws ApexException {
154 public void stop(AxArtifactKey engineKey) throws ApexException {
155 stopEngineKey = engineKey;
162 public void clear() throws ApexException {
163 throw new NotImplementedException("Not implemented on dummy class");
170 public void clear(AxArtifactKey engineKey) throws ApexException {
171 throw new NotImplementedException("Not implemented on dummy class");
178 public boolean isStarted() {
179 throw new NotImplementedException("Not implemented on dummy class");
186 public boolean isStarted(AxArtifactKey engineKey) {
187 throw new NotImplementedException("Not implemented on dummy class");
194 public boolean isStopped() {
195 throw new NotImplementedException("Not implemented on dummy class");
202 public boolean isStopped(AxArtifactKey engineKey) {
203 throw new NotImplementedException("Not implemented on dummy class");
210 public void startPeriodicEvents(long period) throws ApexException {
211 periodicPeriod = period;
218 public void stopPeriodicEvents() throws ApexException {
226 public String getStatus(AxArtifactKey engineKey) throws ApexException {
227 statusKey = engineKey;
235 public String getRuntimeInfo(AxArtifactKey engineKey) throws ApexException {
236 runtimeInfoKey = engineKey;
237 return "The Runtime Info";
240 public AxArtifactKey getStartEngineKey() {
241 return startEngineKey;
244 public AxArtifactKey getStopEngineKey() {
245 return stopEngineKey;
248 public long getPeriodicPeriod() {
249 return periodicPeriod;
252 public AxArtifactKey getStatusKey() {
256 public AxArtifactKey getRuntimeInfoKey() {
257 return runtimeInfoKey;
260 public int getModelKeyGetCalled() {
261 return modelKeyGetCalled;
264 public AxArtifactKey getUpdateModelKey() {
265 return updateModelKey;