summaryrefslogtreecommitdiffstats
path: root/core/core-engine
diff options
context:
space:
mode:
Diffstat (limited to 'core/core-engine')
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java7
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java13
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java19
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java19
-rw-r--r--core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java20
5 files changed, 32 insertions, 46 deletions
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java
index 5a011b2aa..e4e3ddf0d 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyStateFinalizerExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,21 +24,19 @@ package org.onap.policy.apex.core.engine.executor;
import java.util.Map;
import java.util.Properties;
+import lombok.NoArgsConstructor;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
/**
* Dummy state finalizer executor for testing.
*/
+@NoArgsConstructor
public class DummyStateFinalizerExecutor extends StateFinalizerExecutor {
private boolean override;
private boolean returnBad;
- public DummyStateFinalizerExecutor() {
- this(false);
- }
-
public DummyStateFinalizerExecutor(final boolean override) {
this.override = override;
}
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java
index 75c4c0d7c..8172eefcc 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskExecutor.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,8 @@ package org.onap.policy.apex.core.engine.executor;
import java.util.Map;
import java.util.Properties;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
@@ -34,18 +37,12 @@ import org.onap.policy.apex.model.policymodel.concepts.AxTask;
/**
* Dummy task executor for testing.
*/
+@NoArgsConstructor
+@AllArgsConstructor
public class DummyTaskExecutor extends TaskExecutor {
private static final String EVENT_KEY = "Event1:0.0.1";
private boolean override;
- public DummyTaskExecutor() {
- this(false);
- }
-
- public DummyTaskExecutor(final boolean override) {
- this.override = override;
- }
-
@Override
public void prepare() throws StateMachineException {
if (!override) {
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java
index 02a32d4e7..a5525ac83 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/DummyTaskSelectExecutor.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,9 @@
package org.onap.policy.apex.core.engine.executor;
import java.util.Properties;
+import lombok.AllArgsConstructor;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.onap.policy.apex.context.ContextException;
import org.onap.policy.apex.core.engine.event.EnEvent;
import org.onap.policy.apex.core.engine.executor.exception.StateMachineException;
@@ -30,19 +34,14 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
/**
* Dummy task selection executor for testing.
*/
+@NoArgsConstructor
+@AllArgsConstructor
public class DummyTaskSelectExecutor extends TaskSelectExecutor {
private boolean override;
+ @Setter
private static int taskNo;
- public DummyTaskSelectExecutor() {
- this(false);
- }
-
- public DummyTaskSelectExecutor(final boolean override) {
- this.override = override;
- }
-
@Override
public void prepare() throws StateMachineException {
if (!override) {
@@ -63,10 +62,6 @@ public class DummyTaskSelectExecutor extends TaskSelectExecutor {
return new AxArtifactKey("task" + (taskNo++) + ":0.0.1");
}
- public void setTaskNo(int incomingTaskNo) {
- taskNo = incomingTaskNo;
- }
-
/**
* {@inheritDoc}.
*/
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java
index 2d274bd2e..5d91bd2b3 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/StateMachineExecutorTest.java
@@ -3,6 +3,7 @@
* Copyright (C) 2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -222,26 +223,26 @@ public class StateMachineExecutorTest {
executor.setContext(null, axPolicy, internalContextMock);
executor.execute(0, null, incomingEventMock);
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
executor.execute(0, null, incomingEventMock);
AxReferenceKey badStateKey = new AxReferenceKey("Policy:0.0.1:PName:BadState");
axPolicy.getStateMap().get("State1").getStateOutputs().get("stateOutput1").setNextState(badStateKey);
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock))
.hasMessage("state execution failed, next state \"Policy:0.0.1:PName:BadState\" not found");
axPolicy.getStateMap().get("State1").getStateOutputs().get("stateOutput1")
.setNextState(AxReferenceKey.getNullKey());
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
executor.execute(0, null, incomingEventMock);
axPolicy.getStateMap().get("State1").setTrigger(new AxArtifactKey("BadTrigger:0.0.1"));
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock))
.hasMessage("incoming event \"Event1:0.0.1\" does not match trigger \"BadTrigger:0.0.1\" "
+ "of state \"Policy:0.0.1:NULL:state1\"");
axPolicy.getStateMap().get("State1").setTrigger(new AxArtifactKey("Event1:0.0.1"));
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
executor.execute(0, null, incomingEventMock);
AxStateFinalizerLogic savedSfl = axPolicy.getStateMap().get("State1").getStateFinalizerLogicMap().get("sfl");
@@ -255,7 +256,7 @@ public class StateMachineExecutorTest {
axPolicy.getStateMap().get("State1").getStateFinalizerLogicMap().put("sfl", savedSfl);
executor.setContext(null, axPolicy, internalContextMock);
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
executor.execute(0, null, incomingEventMock);
AxArtifactKey task1Key = new AxArtifactKey("task1:0.0.1");
@@ -271,16 +272,16 @@ public class StateMachineExecutorTest {
.setStateTaskOutputType(AxStateTaskOutputType.LOGIC);
executor.setContext(null, axPolicy, internalContextMock);
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
executor.execute(0, null, incomingEventMock);
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
dummySfle.setReturnBad(true);
assertThatThrownBy(() -> executor.execute(0, null, incomingEventMock))
.hasMessage("State execution of state \"Policy:0.0.1:NULL:state1\" on task \"task1:0.0.1\""
+ " failed: state output definition for state output \"stateOutputBad\" not found for "
+ "state \"Policy:0.0.1:NULL:state1\"");
- dummyTsle.setTaskNo(0);
+ DummyTaskSelectExecutor.setTaskNo(0);
dummySfle.setReturnBad(false);
executor.execute(0, null, incomingEventMock);
diff --git a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java
index 156e64b16..efb53a682 100644
--- a/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java
+++ b/core/core-engine/src/test/java/org/onap/policy/apex/core/engine/executor/context/DummyContextAlbum.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* 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=========================================================
*/
@@ -23,6 +24,7 @@ package org.onap.policy.apex.core.engine.executor.context;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
+import lombok.AllArgsConstructor;
import org.apache.commons.lang3.NotImplementedException;
import org.onap.policy.apex.context.ContextAlbum;
import org.onap.policy.apex.context.ContextException;
@@ -34,26 +36,18 @@ import org.onap.policy.apex.model.contextmodel.concepts.AxContextAlbum;
/**
* Dummy context album for testing.
*/
+@AllArgsConstructor
public class DummyContextAlbum implements ContextAlbum {
private final AxArtifactKey key;
/**
- * Constructor.
- * @param key the key
- */
- public DummyContextAlbum(AxArtifactKey key) {
- super();
- this.key = key;
- }
-
- /**
* {@inheritDoc}.
*/
@Override
public void clear() {
throw new NotImplementedException("Not implemented on dummy class");
}
-
+
/**
* {@inheritDoc}.
*/