eac2ec3bac1e11e7cf5e339c4b8728eca55bf701
[policy/apex-pdp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2019 Nordix Foundation.
5  *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
6  *  Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * SPDX-License-Identifier: Apache-2.0
21  * ============LICENSE_END=========================================================
22  */
23
24 package org.onap.policy.apex.services.onappf.parameters.dummyclasses;
25
26 import java.util.Map;
27 import java.util.Properties;
28 import org.onap.policy.apex.context.ContextException;
29 import org.onap.policy.apex.core.engine.event.EnEvent;
30 import org.onap.policy.apex.core.engine.executor.TaskExecutor;
31 import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
32 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
33 import org.onap.policy.apex.model.policymodel.concepts.AxTask;
34
35 /**
36  * Dummy task executor for testing.
37  */
38 public class DummyTaskExecutor extends TaskExecutor {
39
40     @Override
41     public void prepare() throws StateMachineException {
42         // Not used
43     }
44
45     @Override
46     public Map<String, Map<String, Object>> execute(final long executionId, final Properties executorProperties,
47             final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException {
48
49         AxArtifactKey event0Key = new AxArtifactKey("Event0:0.0.1");
50         return Map.of(event0Key.getName(), new EnEvent(event0Key));
51     }
52
53     @Override
54     public AxTask getSubject() {
55         AxArtifactKey taskKey = new AxArtifactKey("FirstTask:0.0.1");
56         return new AxTask(taskKey);
57     }
58
59     @Override
60     public void cleanUp() throws StateMachineException {
61         // Not used
62     }
63 }