diff options
author | Rashmi Pujar <rashmi.pujar1@bell.ca> | 2022-01-22 00:37:28 -0500 |
---|---|---|
committer | Rashmi Pujar <rashmi.pujar1@bell.ca> | 2022-01-24 14:06:57 -0500 |
commit | 632899642b6a1d1489a0b96932c9c38863a53a26 (patch) | |
tree | ab9665853aa637ab1d76d7c25523c77835d3ca3e /model/model-api/src/test | |
parent | c719ee941bd4202b617544e351a11a35b20b8a6a (diff) |
Add TOSCA policy status header field to APEX event create CLI
In order to expose the processing status of a TOSCA policy
to APEX-PDP, a new header field for APEX concept "event"
has been introduced to track this within an APEX policy
implementation. This field will be leveraged to extract
the TOSCA policy execution metrics. Note, that the field is
marked as optional for backward compatibility.
Unit tests have been augmented to test for the field wherever
applicable and the default empty value is retained for the others.
"example-grpc" module has been updated to include this field.
Exposing the TOSCA policy execution metrics is outside the
scope of this patch since the current changes are already
very large owing to the atomic nature of the change introduced.
Issue-ID: POLICY-3845
Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
Change-Id: Ief6d70f9abcfc8414e10aa51a27815ee9028e4c8
Diffstat (limited to 'model/model-api/src/test')
-rw-r--r-- | model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java index bc46ee3d3..775fcc1d3 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiEventTest.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2022 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. @@ -44,29 +45,29 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.createEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createEvent("@£$%^", "0.2.5", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.deleteEvent("MyEvent012", "0.1.4"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEvent("MyEvent012", "0.1.4", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateEvent(null, null); @@ -74,18 +75,19 @@ public class ApexEditorApiEventTest { result = apexModel.updateContextSchema(null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null); + result = apexModel.updateEvent("MyEvent012", "0.1.2", "Another Namespace", null, "Another target", null, null, + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateEvent("MyEvent002", "0.0.2", "My Namespace", "My Source", "my target", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null); + result = apexModel.updateEvent("MyEvent012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateEvent("MyEvent015", null, null, null, null, null, null); + result = apexModel.updateEvent("MyEvent015", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.updateEvent("MyEvent014", "0.1.5", null, null, null, null, null); + result = apexModel.updateEvent("MyEvent014", "0.1.5", null, null, null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); - result = apexModel.updateEvent("@£$%^^", "0.6.9", null, null, null, null, null); + result = apexModel.updateEvent("@£$%^^", "0.6.9", null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.listEvent("@£$%", null); @@ -194,4 +196,4 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(0, result.getMessages().size()); } -} +}
\ No newline at end of file |