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;
28 import org.apache.commons.lang3.NotImplementedException;
29 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
30 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
31 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineModel;
32 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState;
33 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
34 import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
35 import org.onap.policy.apex.service.engine.runtime.EngineService;
36 import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
39 * A dummy engine service class.
41 public class DummyEngineService implements EngineService {
43 private AxArtifactKey startEngineKey;
44 private AxArtifactKey stopEngineKey;
45 private long periodicPeriod;
46 private AxArtifactKey statusKey;
47 private AxArtifactKey runtimeInfoKey;
48 private int modelKeyGetCalled;
49 private AxArtifactKey updateModelKey;
55 public void registerActionListener(String listenerName, ApexEventListener listener) {
56 throw new NotImplementedException("Not implemented on dummy class");
63 public void deregisterActionListener(String listenerName) {
64 throw new NotImplementedException("Not implemented on dummy class");
71 public EngineServiceEventInterface getEngineServiceEventInterface() {
72 throw new NotImplementedException("Not implemented on dummy class");
79 public AxArtifactKey getKey() {
80 return new AxArtifactKey("DummyEngineService:0.0.1");
87 public Collection<AxArtifactKey> getEngineKeys() {
88 List<AxArtifactKey> keys = new ArrayList<>();
89 keys.add(new AxArtifactKey("DummyEngineService:0.0.1"));
97 public AxArtifactKey getApexModelKey() {
100 return new AxArtifactKey("DummyApexModelKey:0.0.1");
107 public void updateModel(AxArtifactKey engineServiceKey, String apexModelString, boolean forceFlag)
108 throws ApexException {
109 updateModelKey = engineServiceKey;
116 public void updateModel(AxArtifactKey engineServiceKey, AxPolicyModel apexModel, boolean forceFlag)
117 throws ApexException {
118 throw new NotImplementedException("Not implemented on dummy class");
125 public AxEngineState getState() {
126 throw new NotImplementedException("Not implemented on dummy class");
133 public List<AxEngineModel> getEngineStats() {
134 throw new NotImplementedException("Not implemented on dummy class");
141 public void startAll() throws ApexException {
142 throw new NotImplementedException("Not implemented on dummy class");
149 public void start(AxArtifactKey engineKey) throws ApexException {
150 startEngineKey = engineKey;
157 public void stop() throws ApexException {
164 public void stop(AxArtifactKey engineKey) throws ApexException {
165 stopEngineKey = engineKey;
172 public void clear() throws ApexException {
173 throw new NotImplementedException("Not implemented on dummy class");
180 public void clear(AxArtifactKey engineKey) throws ApexException {
181 throw new NotImplementedException("Not implemented on dummy class");
188 public boolean isStarted() {
189 throw new NotImplementedException("Not implemented on dummy class");
196 public boolean isStarted(AxArtifactKey engineKey) {
197 throw new NotImplementedException("Not implemented on dummy class");
204 public boolean isStopped() {
205 throw new NotImplementedException("Not implemented on dummy class");
212 public boolean isStopped(AxArtifactKey engineKey) {
213 throw new NotImplementedException("Not implemented on dummy class");
220 public void startPeriodicEvents(long period) throws ApexException {
221 periodicPeriod = period;
228 public void stopPeriodicEvents() throws ApexException {
236 public String getStatus(AxArtifactKey engineKey) throws ApexException {
237 statusKey = engineKey;
245 public String getRuntimeInfo(AxArtifactKey engineKey) throws ApexException {
246 runtimeInfoKey = engineKey;
247 return "The Runtime Info";
250 public AxArtifactKey getStartEngineKey() {
251 return startEngineKey;
254 public AxArtifactKey getStopEngineKey() {
255 return stopEngineKey;
258 public long getPeriodicPeriod() {
259 return periodicPeriod;
262 public AxArtifactKey getStatusKey() {
266 public AxArtifactKey getRuntimeInfoKey() {
267 return runtimeInfoKey;
270 public int getModelKeyGetCalled() {
271 return modelKeyGetCalled;
274 public AxArtifactKey getUpdateModelKey() {
275 return updateModelKey;