8e1dfce1b593ac4ace141f498c5b7c62966de882
[policy/apex-pdp.git] / services / services-engine / src / test / java / org / onap / policy / apex / service / engine / parameters / dummyclasses / SuperDooperEventProducer.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2019 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.parameters.dummyclasses;
23
24 import java.util.Properties;
25
26 import org.onap.policy.apex.service.engine.event.ApexEventException;
27 import org.onap.policy.apex.service.engine.event.ApexEventProducer;
28 import org.onap.policy.apex.service.engine.event.PeeredReference;
29 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
30 import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
31 import org.slf4j.ext.XLogger;
32 import org.slf4j.ext.XLoggerFactory;
33
34 /**
35  * Dummy event producer parameters.
36  *
37  * @author John Keeney (john.keeney@ericsson.com)
38  */
39 public class SuperDooperEventProducer implements ApexEventProducer {
40
41     private static final XLogger LOGGER = XLoggerFactory.getXLogger(SuperDooperEventProducer.class);
42
43     private String name;
44
45     public SuperDooperEventProducer() {
46         // Default constructor
47     }
48
49     /**
50      * {@inheritDoc}.
51      */
52     @Override
53     public void init(final String name, final EventHandlerParameters producerParameters) throws ApexEventException {
54         this.name = name;
55     }
56
57     /**
58      * {@inheritDoc}.
59      */
60     @Override
61     public String getName() {
62         return name;
63     }
64
65     /**
66      * {@inheritDoc}.
67      */
68     @Override
69     public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) {
70         return null;
71     }
72
73     /**
74      * {@inheritDoc}.
75      */
76     @Override
77     public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {
78         // Not used
79     }
80
81     /**
82      * {@inheritDoc}.
83      */
84     @Override
85     public void sendEvent(final long executionId, final Properties executionProperties, final String eventName,
86             final Object event) {
87         LOGGER.info("Sending Event: " + this.getClass().getName() + ":" + this.name + " ... event (" + eventName
88                 + ") : " + event);
89     }
90
91     /**
92      * {@inheritDoc}.
93      */
94     @Override
95     public void stop() {
96         // Not used
97     }
98 }