diff options
author | 2022-02-07 17:56:44 +0000 | |
---|---|---|
committer | 2022-02-08 18:39:03 +0000 | |
commit | 59b90519eda3b95b0cfc49b6349a591c7d0c78e2 (patch) | |
tree | 810e07f7d5cf270582264c40245372f597c713a2 /model/model-api/src/test/java | |
parent | def44b294fa00bb5470e977eef9a05e5087035f0 (diff) |
Remove JAXB and XML, use GSON for JSON
This review converst apex-pdp to use GSON for JSON handling. In order to
preserve backward compatibility with the JAXB format of JSON, custom
handling of maps was required. Therefore, the policy-common
StandardCoder could not be used.
There are a lot of small changes, removing annotations from concepts and
tweaking of test data. However, this cleans up the code base so it is
worth doing.
Issue-ID: POLICY-1820
Change-Id: I213fa64f6d7f3f1df8d10f111d9fbedbe80f9fe0
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/model-api/src/test/java')
10 files changed, 213 insertions, 166 deletions
diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java index e6ed351ae..5ce6b6760 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextAlbumTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,12 +27,13 @@ import org.junit.Test; /** * Context album for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiContextAlbumTest { @Test public void testContextAlbumCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateContextAlbum(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -44,13 +45,13 @@ public class ApexEditorApiContextAlbumTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.4", "UNDEFINED", null, "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -73,16 +74,16 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.createContextAlbum("MyMap012", null, "EPHEMERAL", "false", "MapType", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createContextAlbum("MyMap002", "0.0.2", "APPLICATION", "true", "MapType", null, - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createContextAlbum("MyMap011", "0.1.2", "APPLICATION", "true", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteContextAlbum("MyMap012", "0.1.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createContextAlbum("MyMap012", "0.1.2", "ZOOBY", "false", "MapType", "0.0.1", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 012"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateContextAlbum(null, null); @@ -95,7 +96,7 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.updateContextAlbum("MyMap002", "0.0.2", "ZOOBY", "true", null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap002", "0.0.2", null, null, null, null, - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -114,13 +115,13 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "String", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.2", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "false", "StringType", "0.0.1", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateContextAlbum("MyMap012", null, "APPLICATION", "Hello", "StringType", "0.0.1", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listContextAlbum("@£%%$", null); @@ -159,6 +160,7 @@ public class ApexEditorApiContextAlbumTest { result = apexModel.deleteContextAlbum("MyMap012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); + assertEquals(2, result.getMessages().size()); result = apexModel.listContextAlbum("MyMap012", null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java index 04605f4a1..20310a29e 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiContextSchemaTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ import org.junit.Test; public class ApexEditorApiContextSchemaTest { @Test public void testContextSchemaCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateContextSchemas(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); 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 775fcc1d3..ac9265e84 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 @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,12 +28,13 @@ import org.junit.Test; /** * Test events for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiEventTest { @Test public void testEventCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateEvent(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -45,41 +46,41 @@ 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", null); + "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", null); + "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", null); + "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, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); 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", null); + "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", null); + "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", null); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 014", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateEvent(null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.updateContextSchema(null, null, null, null, null, null); + result = apexModel.updateEvent(null, null, 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, - 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", null); + "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, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -140,6 +141,8 @@ public class ApexEditorApiEventTest { result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", null, null, true); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); + result = apexModel.createContextSchema("eventContextItem0", "0.0.1", "Java", "java.lang.Integer", + "1fa2e430-f2b2-11e6-bc64-92361f002673", "A further updated description of hola"); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, false); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createEventPar("MyEvent002", "0.0.2", "NewPar00", "eventContextItem0", null, true); @@ -196,4 +199,4 @@ public class ApexEditorApiEventTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(0, result.getMessages().size()); } -}
\ No newline at end of file +} diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java index caa25e4a4..2519b8cb2 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiKeyInfoTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ public class ApexEditorApiKeyInfoTest { @Test public void testKeyInfoCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateKeyInformation(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java index 3e78921e9..0a4d72214 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,7 +33,7 @@ import org.junit.Test; public class ApexEditorApiPolicyTest { @Test public void testMyTestPolicyCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validatePolicy(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -45,10 +45,10 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicy("MyPolicy012", null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -59,19 +59,19 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicy("MyPolicy012", null, "SomeTemplate", "AState", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicy("MyPolicy012", "0.1.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyTestPolicy", "0.0.1", "SomeTemplate", "TestState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deletePolicy("MyPolicy002", "0.0.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicy("MyPolicy002", "0.0.2", "SomeTemplate", "AState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validatePolicy(null, null); @@ -84,7 +84,7 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicy("MyPolicy002", "0.0.1", null, null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicy("MyPolicy002", "0.0.2", "SomeOtherTemplate", "BState", - "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); + "1fa2e430-f2b2-11e6-bc64-92361f002700", "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicy("MyPolicy012", null, "SomeOtherTemplate", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -137,7 +137,6 @@ public class ApexEditorApiPolicyTest { result = apexModel.deletePolicy("MyPolicy012", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(2, result.getMessages().size()); - result = apexModel.createPolicyState(null, null, null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyState("MyPolicy123", null, null, null, null, null, null); @@ -255,15 +254,15 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState1", "inEvent", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState2", "outEvent0", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyState("MyTestPolicy", "0.0.1", "TestState3", "outEvent1", "0.0.1", "task", - "0.0.1"); + "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic(null, null, null, null, null); @@ -279,29 +278,29 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "NewTSL00", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "UNDEFINED", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JAVASCRIPT", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic(null, null, null, null, null); @@ -321,15 +320,15 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "NonExistantState", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1", "MVEL", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyPolicy012", null, "TestState1", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -373,13 +372,13 @@ public class ApexEditorApiPolicyTest { result = apexModel.deletePolicyStateTaskSelectionLogic("MyTestPolicy", "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); assertEquals(1, result.getMessages().size()); result = apexModel.createPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listPolicyStateTaskSelectionLogic("MyTestPolicy", null, "TestState1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -397,37 +396,37 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateOutput("MyTestPolicy", null, "SomeState", "SomeOutput", null, null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "1.2.3", "TestState1", "SomeOutput", null, null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", null, null, - null); + null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", - "SomeDummyEvent", null, null); + "SomeDummyEvent", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "1.2.3", null); + "1.2.3", null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", "SomeDummyNextState"); + "0.0.1", "SomeDummyNextState"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", null); + "0.0.1", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState1"); + "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.listPolicyStateOutput(null, null, null, null); @@ -495,19 +494,19 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOutput", "inEvent", - "0.0.1", null); + "0.0.1", null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState1"); + "0.0.1", "TestState1"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState1", "SomeOtherOutput", "inEvent", - "0.0.1", "TestState2"); + "0.0.1", "TestState2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "AnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateOutput("MyTestPolicy", "0.0.1", "TestState2", "YetAnotherOtherOutput", - "outEvent0", "0.0.1", "TestState3"); + "outEvent0", "0.0.1", "TestState3"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic(null, null, null, null, null, null); @@ -519,34 +518,34 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "SomeState", "SFLName01", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "1.2.3", "TestState1", "SFLName01", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", null, - null); + null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName01", - "NewTSL00", null); + "NewTSL00", null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", - "UNDEFINED", "Some Policy Logic"); + "UNDEFINED", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", - "JAVASCRIPT", "Some Policy Logic"); + "JAVASCRIPT", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic(null, null, null, null, null, null); @@ -556,37 +555,37 @@ public class ApexEditorApiPolicyTest { result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState99", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy2", null, "TestState1", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy1", "0.0.2", "TestState1", "SomeSFLName", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "NonEistantSFL", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", null, - null); + null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName06", "MVEL", - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy012", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, - "Some Other Policy Logic"); + "Some Other Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy015", null, "TestState1", "SFLName06", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updatePolicyStateFinalizerLogic("MyPolicy014", "0.1.5", "TestState1", "SFLName06", null, - null); + null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.listPolicyStateFinalizerLogic(null, null, null, null); @@ -669,22 +668,22 @@ public class ApexEditorApiPolicyTest { assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName02", - "UNDEFINED", "Some Policy Logic"); + "UNDEFINED", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName03", "MVEL", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName04", "JAVA", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", "0.0.1", "TestState1", "SFLName05", "JYTHON", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName06", - "JAVASCRIPT", "Some Policy Logic"); + "JAVASCRIPT", "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateFinalizerLogic("MyTestPolicy", null, "TestState1", "SFLName07", "JRUBY", - "Some Policy Logic"); + "Some Policy Logic"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("TestTask0", null, null, null); @@ -705,81 +704,81 @@ public class ApexEditorApiPolicyTest { result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "1.2.3", "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("AnyOldPolicy", "1.2.3", "SomeState", null, null, null, null, - "DummyOutput"); + "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", null, - null, null, "DummyOutput"); + null, null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", - "SomeTask", "Zooby|", null, "DummyOutput"); + "SomeTask", "Zooby|", null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", - "SomeTask", "0.0.1", null, "DummyOutput"); + "SomeTask", "0.0.1", null, "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", null, "DummyOutput"); + "0.0.1", null, "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "Some Policy Logic", "DummyOutput"); + "0.0.1", "Some Policy Logic", "DummyOutput"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "DummyOutput"); + "0.0.1", "DIRECT", "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", "0.0.1", "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "DummyOutput"); + "0.0.1", "LOGIC", "DummyOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "SFLName07"); + "0.0.1", "DIRECT", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "SomeOutput"); + "0.0.1", "LOGIC", "SomeOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "DIRECT", "SomeOutput"); + "0.0.1", "DIRECT", "SomeOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "NonExistantTask", "0.0.1", "DIRECT", "SomeOutput"); + "NonExistantTask", "0.0.1", "DIRECT", "SomeOutput"); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", "task", - "0.0.1", "LOGIC", "SFLName07"); + "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask0", "0.0.1", "LOGIC", "SFLName07"); + "TestTask0", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask1", "0.0.1", "DIRECT", "SomeOtherOutput"); + "TestTask1", "0.0.1", "DIRECT", "SomeOtherOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask2", "0.0.1", "LOGIC", "SFLName07"); + "TestTask2", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask3", "0.0.1", "DIRECT", "SomeOtherOutput"); + "TestTask3", "0.0.1", "DIRECT", "SomeOtherOutput"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask4", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.deletePolicyStateTaskRef("MyTestPolicy", null, "TestState1", "TestTask4", "0.0.1"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "FUNKY", "SFLName07"); + "TestTask4", "0.0.1", "FUNKY", "SFLName07"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "UNDEFINED", "SFLName07"); + "TestTask4", "0.0.1", "UNDEFINED", "SFLName07"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", "SomeTaskLocalName", - "TestTask4", "0.0.1", "LOGIC", "SFLName07"); + "TestTask4", "0.0.1", "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createPolicyStateTaskRef("MyTestPolicy", null, "TestState1", null, "TestTask0", "0.0.1", - "LOGIC", "SFLName07"); + "LOGIC", "SFLName07"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.listPolicyStateTaskRef(null, null, null, null, null); 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 026f67c29..15e53f925 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 @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020,2022 Nordix Foundation. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,12 +29,13 @@ import org.onap.policy.apex.model.modelapi.impl.ApexModelImpl; /** * Test tasks for API tests. + * * @author Liam Fallon (liam.fallon@ericsson.com) */ public class ApexEditorApiTaskTest { @Test public void testTaskCrud() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.validateTask(null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); @@ -46,13 +47,13 @@ public class ApexEditorApiTaskTest { assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("@^^$^^$", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createTask("MyTask012", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); @@ -60,16 +61,16 @@ public class ApexEditorApiTaskTest { assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.listTask(null, null); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.CONCEPT_EXISTS, result.getResult()); result = apexModel.createTask("MyTask012", "0.1.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteTask("MyTask002", "0.0.2"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.createTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.validateTask(null, null); @@ -82,7 +83,7 @@ public class ApexEditorApiTaskTest { result = apexModel.updateTask("MyTask002", "0.0.1", null, null); assertEquals(ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST, result.getResult()); result = apexModel.updateTask("MyTask002", "0.0.2", "1fa2e430-f2b2-11e6-bc64-92361f002700", - "A description of 002"); + "A description of 002"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.updateTask("MyTask012", null, null, null); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java index 132864bc9..f28d0e634 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexModelApiTest.java @@ -59,7 +59,7 @@ public class ApexModelApiTest { @Test public void testApexModelLoadFromFile() { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.loadFromFile("src/main/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -70,7 +70,7 @@ public class ApexModelApiTest { result = apexModel.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.xml"); + result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModel.deleteModel(); @@ -78,64 +78,64 @@ public class ApexModelApiTest { result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.junk"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - assertEquals("format of input for Apex concept is neither JSON nor XML", result.getMessages().get(0)); + assertEquals("Unable to unmarshal Apex concept", result.getMessages().get(0).trim()); } @Test public void testApexModelSaveToFile() throws IOException { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); ApexApiResult result = apexModel.loadFromFile("src/test/resources/models/PolicyModel.json"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); - result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); + result = apexModel.saveToFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - final ApexModel jsonApexModel = new ApexModelFactory().createApexModel(null, false); - result = jsonApexModel.loadFromFile(tempJsonModelFile.getCanonicalPath()); + final ApexModel jsonApexModel = new ApexModelFactory().createApexModel(null); + result = jsonApexModel.loadFromFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); tempJsonModelFile.delete(); - final File tempXmlModelFile = File.createTempFile("ApexModelTest", ".xml"); - result = apexModel.saveToFile(tempXmlModelFile.getCanonicalPath(), true); + final File tempModelFile = File.createTempFile("ApexModelTest", ".json"); + result = apexModel.saveToFile(tempModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - final ApexModel xmlApexModel = new ApexModelFactory().createApexModel(null, false); - result = xmlApexModel.loadFromFile(tempXmlModelFile.getCanonicalPath()); + final ApexModel testApexModel = new ApexModelFactory().createApexModel(null); + result = testApexModel.loadFromFile(tempModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - tempXmlModelFile.delete(); + tempModelFile.delete(); } @Test public void testApexModelUrl() throws IOException { - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); assertThatThrownBy(() -> apexModel.readFromUrl(null)).isInstanceOf(IllegalArgumentException.class); - assertThatThrownBy(() -> apexModel.writeToUrl(null, true)).isInstanceOf(IllegalArgumentException.class); + assertThatThrownBy(() -> apexModel.writeToUrl(null)).isInstanceOf(IllegalArgumentException.class); ApexApiResult result = null; result = apexModel.readFromUrl("zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.writeToUrl("zooby/looby", true); + result = apexModel.writeToUrl("zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = apexModel.readFromUrl("zooby://zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - result = apexModel.writeToUrl("zooby://zooby/looby", false); + result = apexModel.writeToUrl("zooby://zooby/looby"); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); - final File tempJsonModelFile = File.createTempFile("ApexModelTest", ".json"); + final File tempJsonModelFile = File.createTempFile("ApexModelTest", "json"); - result = apexModel.saveToFile(tempJsonModelFile.getCanonicalPath(), false); + result = apexModel.saveToFile(tempJsonModelFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); final String tempFileUrlString = tempJsonModelFile.toURI().toString(); result = apexModel.readFromUrl(tempFileUrlString); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModel.writeToUrl(tempFileUrlString, false); + result = apexModel.writeToUrl(tempFileUrlString); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); assertEquals("protocol doesn't support output", result.getMessages().get(0)); @@ -144,7 +144,7 @@ public class ApexModelApiTest { @Test public void testApexModelMisc() throws IOException { - final ApexModelImpl apexModelImpl = (ApexModelImpl) new ApexModelFactory().createApexModel(null, false); + final ApexModelImpl apexModelImpl = (ApexModelImpl) new ApexModelFactory().createApexModel(null); ApexApiResult result = null; @@ -174,10 +174,7 @@ public class ApexModelApiTest { apexModelImpl.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.loadFromFile(tempFile.getCanonicalPath()); - assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - - result = apexModelImpl.saveToFile(null, false); + result = apexModelImpl.loadFromFile(tempFile.getPath()); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.analyse(); @@ -186,7 +183,7 @@ public class ApexModelApiTest { result = apexModelImpl.validate(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.compare(tempFile.getCanonicalPath(), true, true); + result = apexModelImpl.compare(tempFile.getPath(), true, true); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.compareWithString(modelString, true, true); @@ -195,10 +192,10 @@ public class ApexModelApiTest { result = apexModelImpl.split("policy"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.split(tempFile.getCanonicalPath(), "policy"); + result = apexModelImpl.split(tempFile.getPath(), "policy"); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - result = apexModelImpl.merge(tempFile.getCanonicalPath(), true); + result = apexModelImpl.merge(tempFile.getPath(), true); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); result = apexModelImpl.mergeWithString(modelString, true); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java index a5f258e4c..d3b32b923 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelFacadeTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation + * Modifications Copyright (C) 2020,2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,14 +34,14 @@ public class ModelFacadeTest { @Test public void testModelFacade() { - assertThatThrownBy(() -> new ModelFacade(null, null, false)) + assertThatThrownBy(() -> new ModelFacade(null, null)) .hasMessage("apexModel may not be null"); - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); - assertThatThrownBy(() -> new ModelFacade(apexModel, null, false)) + assertThatThrownBy(() -> new ModelFacade(apexModel, null)) .hasMessage("apexProperties may not be null"); final Properties modelProperties = new Properties(); - final ModelFacade mf = new ModelFacade(apexModel, modelProperties, false); + final ModelFacade mf = new ModelFacade(apexModel, modelProperties); ApexApiResult result = mf.createModel(null, null, null, null); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); @@ -91,7 +91,6 @@ public class ModelFacadeTest { result = mf.listModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); - assertEquals("AxPolicyModel:(AxPolicyModel:(key=AxArtifactKey:(n", result.getMessage().substring(0, 50)); result = mf.deleteModel(); assertEquals(ApexApiResult.Result.SUCCESS, result.getResult()); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java index e43e5896b..5bbc95992 100644 --- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ModelHandlerFacadeTest.java @@ -41,14 +41,14 @@ public class ModelHandlerFacadeTest { @Test public void testModelHandlerFacade() throws IOException { - assertThatThrownBy(() -> new ModelHandlerFacade(null, null, false)) + assertThatThrownBy(() -> new ModelHandlerFacade(null, null)) .hasMessage("apexModel may not be null"); - final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false); + final ApexModel apexModel = new ApexModelFactory().createApexModel(null); - assertThatThrownBy(() -> new ModelHandlerFacade(apexModel, null, false)) + assertThatThrownBy(() -> new ModelHandlerFacade(apexModel, null)) .hasMessage("apexProperties may not be null"); final Properties modelProperties = new Properties(); - final ModelHandlerFacade mhf = new ModelHandlerFacade(apexModel, modelProperties, false); + final ModelHandlerFacade mhf = new ModelHandlerFacade(apexModel, modelProperties); assertNotNull(mhf); ApexApiResult result = mhf.loadFromFile("src/test/resources/models/PolicyModel.json"); @@ -83,7 +83,7 @@ public class ModelHandlerFacadeTest { final File tempFile = File.createTempFile("ApexModel", "json"); tempFile.deleteOnExit(); - result = mhf.writeToUrl("File:///" + tempFile.getCanonicalPath(), false); + result = mhf.writeToUrl("File:///" + tempFile.getCanonicalPath()); assertEquals(ApexApiResult.Result.FAILED, result.getResult()); result = mhf.validate(); diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java new file mode 100644 index 000000000..2a29f5297 --- /dev/null +++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/RealModelTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Nordix Foundation. + * ================================================================================ + * 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.model.modelapi; + +import static org.junit.Assert.assertTrue; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import java.util.Map; +import org.junit.Test; +import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelCustomGsonMapAdapter; +import org.onap.policy.apex.model.basicmodel.handling.ApexModelReader; +import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.onap.policy.common.utils.resources.TextFileUtils; + +public class RealModelTest { + @Test + public void testRealModel() throws Exception { + + final String modelString = TextFileUtils.getTextFileAsString("src/test/resources/models/PolicyModel.json"); + + AxPolicyModel policyModel = new ApexModelReader<AxPolicyModel>(AxPolicyModel.class).read(modelString); + + AxValidationResult result = new AxValidationResult(); + assertTrue(policyModel.validate(result).isValid()); + } +} |