diff options
author | liamfallon <liam.fallon@est.tech> | 2019-06-26 15:40:41 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-06-26 15:40:41 +0000 |
commit | ce9d82d2c0e863597d84cc8909955e398405f45a (patch) | |
tree | 8ebb853119bdf673cf6f9516d428d4cc00080aeb /services/services-engine/src/test/java/org | |
parent | 5f029543f1e673655af2d2974113069df0b6def0 (diff) |
Add passthrough properties for APEX engine
APEX event receiver and sender plugins sometimes need to exchange
information with tasks, especially in the case of REST communication.
This change enables passthrough of Properties from the event carrier
technology plugins to APEX task, task selection, and state finalizer
logics.
Apologies for the size of the review but this change involves passinng
the properties through all the APEX components, hence the large number
of small changes.
Issue-ID: POLICY-1742
Change-Id: I219fd69550f06702ef64adbb165fe7baac422e96
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine/src/test/java/org')
4 files changed, 51 insertions, 70 deletions
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java index f7c0876d4..6ce7d4aa0 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyStateFinalizerExecutor.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,6 +21,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.executor.StateFinalizerExecutor; @@ -30,13 +31,12 @@ import org.onap.policy.apex.core.engine.executor.exception.StateMachineException * Dummy state finalizer executor for testing. */ public class DummyStateFinalizerExecutor extends StateFinalizerExecutor { - public DummyStateFinalizerExecutor() { - } - + public DummyStateFinalizerExecutor() {} + @Override - public String execute(final long executionId, final Map<String, Object> newIncomingFields) - throws StateMachineException, ContextException { - + public String execute(final long executionId, final Properties executorProperties, + final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { + return "stateOutput0"; } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java index 421cfb9fc..9a93a1f2e 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskExecutor.java @@ -5,15 +5,15 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ @@ -21,6 +21,7 @@ package org.onap.policy.apex.service.engine.parameters.dummyclasses; import java.util.Map; +import java.util.Properties; import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; @@ -33,21 +34,19 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask; * Dummy task executor for testing. */ public class DummyTaskExecutor extends TaskExecutor { - public DummyTaskExecutor() { - } + public DummyTaskExecutor() {} @Override - public void prepare() throws StateMachineException { - } - + public void prepare() throws StateMachineException {} + @Override - public Map<String, Object> execute(final long executionId, final Map<String, Object> newIncomingFields) - throws StateMachineException, ContextException { + public Map<String, Object> execute(final long executionId, final Properties executorProperties, + final Map<String, Object> newIncomingFields) throws StateMachineException, ContextException { AxArtifactKey event0Key = new AxArtifactKey("Event0:0.0.1"); return new EnEvent(event0Key); } - + @Override public AxTask getSubject() { AxArtifactKey taskKey = new AxArtifactKey("FirstTask:0.0.1"); @@ -55,6 +54,5 @@ public class DummyTaskExecutor extends TaskExecutor { } @Override - public void cleanUp() throws StateMachineException { - } + public void cleanUp() throws StateMachineException {} } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java index 020e69843..cf41d8699 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/DummyTaskSelectExecutor.java @@ -5,21 +5,23 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.parameters.dummyclasses; +import java.util.Properties; + import org.onap.policy.apex.context.ContextException; import org.onap.policy.apex.core.engine.event.EnEvent; import org.onap.policy.apex.core.engine.executor.TaskSelectExecutor; @@ -30,21 +32,18 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey; * Dummy task selection executor for testing. */ public class DummyTaskSelectExecutor extends TaskSelectExecutor { - public DummyTaskSelectExecutor() { - } + public DummyTaskSelectExecutor() {} @Override - public void prepare() throws StateMachineException { - } + public void prepare() throws StateMachineException {} @Override - public AxArtifactKey execute(final long executionId, final EnEvent newIncomingEvent) - throws StateMachineException, ContextException { - + public AxArtifactKey execute(final long executionId, final Properties executorProperties, + final EnEvent newIncomingEvent) throws StateMachineException, ContextException { + return new AxArtifactKey("task:0.0.1"); } @Override - public void cleanUp() throws StateMachineException { - } + public void cleanUp() throws StateMachineException {} } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java index b30ad1846..ff7d90a40 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperDooperEventProducer.java @@ -5,21 +5,23 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.service.engine.parameters.dummyclasses; +import java.util.Properties; + import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventProducer; import org.onap.policy.apex.service.engine.event.PeeredReference; @@ -30,6 +32,7 @@ import org.slf4j.ext.XLoggerFactory; /** * Dummy event producer parameters. + * * @author John Keeney (john.keeney@ericsson.com) */ public class SuperDooperEventProducer implements ApexEventProducer { @@ -40,67 +43,48 @@ public class SuperDooperEventProducer implements ApexEventProducer { public SuperDooperEventProducer() {} - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#init(java.lang.String, - * org.onap.policy.apex.service.parameters.producer.ProducerParameters) + /** + * {@inheritDoc} */ @Override public void init(final String name, final EventHandlerParameters producerParameters) throws ApexEventException { this.name = name; } - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#getName() + /** + * {@inheritDoc} */ @Override public String getName() { return name; } - /* - * (non-Javadoc) - * - * @see - * org.onap.policy.apex.service.engine.event.ApexEventProducer#getPeeredReference(org.onap.policy.apex - * .service.parameters.eventhandler.EventHandlerPeeredMode) + /** + * {@inheritDoc} */ @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { return null; } - /* - * (non-Javadoc) - * - * @see - * org.onap.policy.apex.service.engine.event.ApexEventProducer#setPeeredReference(org.onap.policy.apex - * .service.parameters.eventhandler.EventHandlerPeeredMode, - * org.onap.policy.apex.service.engine.event.PeeredReference) + /** + * {@inheritDoc} */ @Override public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) {} - - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#sendEvent(long, - * java.lang.String, java.lang.Object) + /** + * {@inheritDoc} */ @Override - public void sendEvent(final long executionId, final String eventName, final Object event) { + public void sendEvent(final long executionId, final Properties executionProperties, final String eventName, + final Object event) { LOGGER.info("Sending Event: " + this.getClass().getCanonicalName() + ":" + this.name + " ... event (" + eventName + ") : " + event); } - /* - * (non-Javadoc) - * - * @see org.onap.policy.apex.service.engine.event.ApexEventProducer#stop() + /** + * {@inheritDoc} */ @Override public void stop() {} |