summaryrefslogtreecommitdiffstats
path: root/auth/cli-editor/src
diff options
context:
space:
mode:
Diffstat (limited to 'auth/cli-editor/src')
-rw-r--r--auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex30
-rw-r--r--auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex19
-rw-r--r--auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java8
3 files changed, 24 insertions, 33 deletions
diff --git a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex
index 9f62eca74..2cd94416f 100644
--- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex
+++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex
@@ -1,6 +1,7 @@
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
# Copyright (C) 2016-2018 Ericsson. All rights reserved.
+# Modifications Copyright (C) 2020 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -52,7 +53,7 @@ LE
schema create name=AvroFloat_type flavour=Avro schema=LS
{
- "type" : "float"
+ "type" : "double"
}
LE
@@ -423,18 +424,16 @@ task contextref create name=Test_Task albumName=CustomSetAlbum
task contextref create name=Test_Task albumName=CustomMapAlbum
task logic create name=Test_Task logicFlavour=JAVASCRIPT logic=LS
-executor.logger.debug(executor.subject.id);
-
-executor.logger.debug(executor.inFields);
-
-executor.getContextAlbum("AvroBooleanAlbum" ).put("AvroBoolean" , executor.inFields.get("AvroBoolean"));
-executor.getContextAlbum("AvroByteAlbum" ).put("AvroByte" , executor.inFields.get("AvroByte" ));
-executor.getContextAlbum("AvroShortAlbum" ).put("AvroShort" , executor.inFields.get("AvroShort" ));
-executor.getContextAlbum("AvroIntegerAlbum" ).put("AvroInteger" , executor.inFields.get("AvroInteger"));
-executor.getContextAlbum("AvroLongAlbum" ).put("AvroLong" , executor.inFields.get("AvroLong" ));
-executor.getContextAlbum("AvroFloatAlbum" ).put("AvroFloat" , executor.inFields.get("AvroFloat" ));
-executor.getContextAlbum("AvroDoubleAlbum" ).put("AvroDouble" , executor.inFields.get("AvroDouble" ));
-executor.getContextAlbum("AvroStringAlbum" ).put("AvroString" , executor.inFields.get("AvroString" ));
+executor.logger.debug(executor.getSubject().getId());
+
+executor.getContextAlbum("AvroBooleanAlbum" ).put("AvroBoolean" , executor.inFields.get("AvroBoolean" ));
+executor.getContextAlbum("AvroByteAlbum" ).put("AvroByte" , executor.inFields.get("AvroByte" ));
+executor.getContextAlbum("AvroShortAlbum" ).put("AvroShort" , executor.inFields.get("AvroShort" ));
+executor.getContextAlbum("AvroIntegerAlbum" ).put("AvroInteger" , executor.inFields.get("AvroInteger" ));
+executor.getContextAlbum("AvroLongAlbum" ).put("AvroLong" , executor.inFields.get("AvroLong" ));
+executor.getContextAlbum("AvroFloatAlbum" ).put("AvroFloat" , executor.inFields.get("AvroFloat" ));
+executor.getContextAlbum("AvroDoubleAlbum" ).put("AvroDouble" , executor.inFields.get("AvroDouble" ));
+executor.getContextAlbum("AvroStringAlbum" ).put("AvroString" , executor.inFields.get("AvroString" ));
executor.getContextAlbum("AvroMapAlbum" ).put("AvroMap" , executor.inFields.get("AvroMap" ));
executor.getContextAlbum("AvroArrayAlbum" ).put("AvroArray" , executor.inFields.get("AvroArray" ));
executor.getContextAlbum("CustomBooleanAlbum").put("CustomBoolean", executor.inFields.get("CustomBoolean"));
@@ -488,11 +487,8 @@ avroString = avroString + " added to end of string";
customBoolean.put("flag", !customBoolean.get("flag"));
customByte .put("byteValue" , customByte .get("byteValue" ) + 1);
customInteger.put("intValue" , customInteger.get("intValue" ) + 1);
-customLong .put("longValue" , new javaLongType (customLong .get("longValue" ) + 1));
-customFloat .put("floatValue" , new javaFloatType(customFloat.get("floatValue") + 1.0));
customDouble .put("doubleValue", customDouble .get("doubleValue") + 1.0);
customString .put("stringValue", customString .get("stringValue") + " added to end of string");
-customALong .put("longValue" , new javaLongType (customALong.get("longValue" ) + 1));
customDate0.put("year", 1922);
customDate0.put("month", 12);
@@ -555,8 +551,6 @@ executor.outFields.put("CustomDate2" , executor.getContextAlbum("CustomDate2Alb
executor.outFields.put("CustomSet" , executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" ));
executor.outFields.put("CustomMap" , executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" ));
-executor.logger.debug(executor.outFields);
-
var returnValueType = Java.type("java.lang.Boolean");
var returnValue = new returnValueType(true);
diff --git a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex
index e978f15bb..2a36c4fa1 100644
--- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex
+++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex
@@ -1,6 +1,7 @@
#-------------------------------------------------------------------------------
# ============LICENSE_START=======================================================
# Copyright (C) 2016-2018 Ericsson. All rights reserved.
+# Modifications Copyright (C) 2020 Nordix Foundation.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -181,9 +182,7 @@ task contextref create name=Test_Task albumName=CustomSetAlbum
task contextref create name=Test_Task albumName=CustomMapAlbum
task logic create name=Test_Task logicFlavour=JAVASCRIPT logic=LS
-executor.logger.debug(executor.subject.id);
-
-executor.logger.debug(executor.inFields);
+executor.logger.debug(executor.getSubject().getId());
executor.getContextAlbum("JavaBooleanAlbum" ).put("JavaBoolean" , executor.inFields.get("JavaBoolean" ));
executor.getContextAlbum("JavaByteAlbum" ).put("JavaByte" , executor.inFields.get("JavaByte" ));
@@ -239,13 +238,13 @@ javaFloat += 0.99;
javaDouble += 0.99;
javaString = javaString + " added to end of string";
customBoolean.setFlag(!customBoolean);
-customByte .setByteValue (customByte .getByteValue() + 1);
-customInteger.setIntValue (customInteger.getIntValue() + 1);
-customLong .setLongValue (customLong .getLongValue() + 1);
-customFloat .setFloatValue (customFloat .getFloatValue() + 1);
-customDouble .setDoubleValue(customDouble .getDoubleValue() + 1);
+customByte .setByteValue (customByte .getIncrementedByteValue());
+customInteger.setIntValue (customInteger.getIncrementedIntValue());
+customLong .setLongValue (customLong .getIncrementedLongValue());
+customFloat .setFloatValue (customFloat .getIncrementedFloatValue());
+customDouble .setDoubleValue(customDouble .getIncrementedDoubleValue());
customString .setStringValue(customString .getStringValue() + " added to end of string");
-customJLong .setLongValue (customJLong .getLongValue() + 1);
+customJLong .setLongValue (customJLong .getIncrementedLongValue());
customDate0Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateItem");
customDate0 = new customDate0Type(1499868391);
@@ -310,8 +309,6 @@ executor.outFields.put("CustomDate2" , executor.getContextAlbum("CustomDate2Alb
executor.outFields.put("CustomSet" , executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" ));
executor.outFields.put("CustomMap" , executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" ));
-executor.logger.debug(executor.outFields);
-
var returnValueType = Java.type("java.lang.Boolean");
var returnValue = new returnValueType(true);
diff --git a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java
index 88d99a27d..9c7143ef1 100644
--- a/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java
+++ b/auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java
@@ -84,8 +84,8 @@ public class CommandLineEditorEventsContextTest {
final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length();
final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length();
- assertEquals(25962, logCharCount);
- assertEquals(46189, modelCharCount);
+ assertEquals(25996, logCharCount);
+ assertEquals(46162, modelCharCount);
}
/**
@@ -114,8 +114,8 @@ public class CommandLineEditorEventsContextTest {
final int logCharCount = logString.replaceAll(SPACES, EMPTY_STRING).length();
final int modelCharCount = modelString.replaceAll(SPACES, EMPTY_STRING).length();
- assertEquals(30407, logCharCount);
- assertEquals(53022, modelCharCount);
+ assertEquals(30154, logCharCount);
+ assertEquals(52690, modelCharCount);
}