summaryrefslogtreecommitdiffstats
path: root/model/model-api/src/test
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-06-29 13:57:14 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2021-07-02 16:03:51 +0100
commit5f0ec1c2d95c377fbec428f11464e93fe442b5ef (patch)
tree4aef07097fa4d64550db116a1b1b4acd1aa42590 /model/model-api/src/test
parentba55109db1e5eea013dcffd1be29cf06fe2bbcb1 (diff)
Cleanup input & outputFields from Task definition
1) Remove the usage of inputField and outputField from Task definition. 2) Fix issues around populating events to task in case of State Finalizer Logic. Change-Id: Ief17f400729410b83c6b7c665980d443e0cf6f28 Issue-ID: POLICY-3336 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'model/model-api/src/test')
-rw-r--r--model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java122
-rw-r--r--model/model-api/src/test/resources/models/PolicyModel.xml64
2 files changed, 6 insertions, 180 deletions
diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java
index f2c41318c..026f67c29 100644
--- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java
+++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiTaskTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. 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,7 @@ package org.onap.policy.apex.model.modelapi;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl;
/**
* Test tasks for API tests.
@@ -214,124 +216,12 @@ public class ApexEditorApiTaskTest {
result = apexModel.deleteTaskLogic("MyTask002", "0.0.2");
assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.createTaskInputField("MyTask123", null, "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskInputField("MyTask002", "4.5.6", "NewField00", null, null, true);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskInputField("MyTask002", "0.1.4", "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", null, null, true);
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
-
- result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, true);
- assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult());
- result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1",
- false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskInputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2", true);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.createTaskInputField("MyTask002", null, "NewField02", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskInputField("MyTask002", null, "NewField03", "eventContextItem0", null, true);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
-
- result = apexModel.listTaskInputField("@£$%", null, null);
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", "0.0.1", null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", "0.0.2", null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField01");
+ result = apexModel.createTaskField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false);
assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField02");
+ assertEquals(ApexModelImpl.FIELDS_DEPRECATED_WARN_MSG, result.getMessage().trim());
+ result = apexModel.handleTaskField("MyTask002", "0.0.2", "NewField01");
assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.deleteTaskInputField("@£$%", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = apexModel.deleteTaskInputField("NonExistantTask", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskInputField("MyTask002", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- assertEquals(4, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskInputField("MyTask002", null, "NewField02");
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- assertEquals(3, apexModel.listTaskInputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskInputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskInputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.deleteTaskInputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskOutputField("MyTask123", null, "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskOutputField("MyTask002", "4.5.6", "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskOutputField("MyTask002", "0.1.4", "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", null, null, false);
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
-
- result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField00", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult());
- result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField01", "eventContextItem0", "0.0.1",
- false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskOutputField("MyTask002", "0.0.2", "NewField02", "eventContextItem0", "0.0.2",
- false);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.createTaskOutputField("MyTask002", null, "NewField02", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.createTaskOutputField("MyTask002", null, "NewField03", "eventContextItem0", null, false);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
-
- result = apexModel.listTaskOutputField("@£$%", null, null);
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", "0.0.1", null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", "0.0.2", null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField01");
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField02");
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
-
- result = apexModel.deleteTaskOutputField("@£$%", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.FAILED, result.getResult());
- result = apexModel.deleteTaskOutputField("NonExistantTask", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskOutputField("MyTask002", "0.0.2", "NewField04");
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- assertEquals(4, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskOutputField("MyTask002", null, "NewField02");
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- assertEquals(3, apexModel.listTaskOutputField("MyTask002", null, null).getMessages().size());
- result = apexModel.deleteTaskOutputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.SUCCESS, result.getResult());
- result = apexModel.listTaskOutputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
- result = apexModel.deleteTaskOutputField("MyTask002", null, null);
- assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
+ assertEquals(ApexModelImpl.FIELDS_DEPRECATED_WARN_MSG, result.getMessage().trim());
result = apexModel.createTaskParameter("MyTask123", null, "NewPar00", null);
assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult());
diff --git a/model/model-api/src/test/resources/models/PolicyModel.xml b/model/model-api/src/test/resources/models/PolicyModel.xml
index e3bf59f29..e47e21afc 100644
--- a/model/model-api/src/test/resources/models/PolicyModel.xml
+++ b/model/model-api/src/test/resources/models/PolicyModel.xml
@@ -402,70 +402,6 @@
<name>task</name>
<version>0.0.1</version>
</key>
- <inputFields>
- <entry>
- <key>IEPAR0</key>
- <value>
- <key>IEPAR0</key>
- <fieldSchemaKey>
- <name>eventContextItem0</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- <entry>
- <key>IEPAR1</key>
- <value>
- <key>IEPAR1</key>
- <fieldSchemaKey>
- <name>eventContextItem1</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- </inputFields>
- <outputFields>
- <entry>
- <key>OE0PAR0</key>
- <value>
- <key>OE0PAR0</key>
- <fieldSchemaKey>
- <name>eventContextItem0</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- <entry>
- <key>OE0PAR1</key>
- <value>
- <key>OE0PAR1</key>
- <fieldSchemaKey>
- <name>eventContextItem1</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- <entry>
- <key>OE1PAR0</key>
- <value>
- <key>OE1PAR0</key>
- <fieldSchemaKey>
- <name>eventContextItem0</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- <entry>
- <key>OE1PAR1</key>
- <value>
- <key>OE1PAR1</key>
- <fieldSchemaKey>
- <name>eventContextItem1</name>
- <version>0.0.1</version>
- </fieldSchemaKey>
- </value>
- </entry>
- </outputFields>
<taskParameters>
<entry>
<key>taskParameter0</key>