aboutsummaryrefslogtreecommitdiffstats
path: root/model/model-api/src/test
diff options
context:
space:
mode:
authorAjith Sreekumar <ajith.sreekumar@bell.ca>2021-07-06 13:33:46 +0000
committerGerrit Code Review <gerrit@onap.org>2021-07-06 13:33:46 +0000
commitd532d7b5e422ce3e4ef9f6992ef159960988be8f (patch)
tree98adda95982e0ff043dfdfa926c05606d54d6efd /model/model-api/src/test
parent6092e934c6f0014ab93304c82272efed5c4b1e30 (diff)
parent5f0ec1c2d95c377fbec428f11464e93fe442b5ef (diff)
Merge "Cleanup input & outputFields from Task definition"
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>