summaryrefslogtreecommitdiffstats
path: root/auth/cli-editor
diff options
context:
space:
mode:
Diffstat (limited to 'auth/cli-editor')
-rw-r--r--auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex22
-rw-r--r--auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex15
-rw-r--r--auth/cli-editor/src/test/java/org/onap/policy/apex/auth/clieditor/CommandLineEditorEventsContextTest.java8
3 files changed, 22 insertions, 23 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 2cd94416f..b16ba4acd 100644
--- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex
+++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyAvroEventContext.apex
@@ -6,15 +6,15 @@
# 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=========================================================
#-------------------------------------------------------------------------------
@@ -53,7 +53,7 @@ LE
schema create name=AvroFloat_type flavour=Avro schema=LS
{
- "type" : "double"
+ "type" : "float"
}
LE
@@ -472,11 +472,11 @@ var customDate2 = executor.getContextAlbum("CustomDate2Album" ).get("CustomDa
var customSet = executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" );
var customMap = executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" );
-javaIntegerType = Java.type("java.lang.Integer");
-javaLongType = Java.type("java.lang.Long");
-javaFloatType = Java.type("java.lang.Float");
+javaIntegerType = java.lang.Integer;
+javaLongType = java.lang.Long;
+javaFloatType = java.lang.Float;
-avroBoolean = !avroBoolean;
+avroBoolean = avroBoolean == false;
avroByte = new javaIntegerType(avroByte + 1);
avroShort = new javaIntegerType(avroShort + 1);
avroInteger = new javaIntegerType(avroInteger + 1);
@@ -484,7 +484,7 @@ avroLong = new javaLongType (avroLong + 1);
avroFloat = new javaFloatType (avroFloat + 0.99);
avroDouble += 0.99;
avroString = avroString + " added to end of string";
-customBoolean.put("flag", !customBoolean.get("flag"));
+customBoolean.put("flag", customBoolean.get("flag") == false);
customByte .put("byteValue" , customByte .get("byteValue" ) + 1);
customInteger.put("intValue" , customInteger.get("intValue" ) + 1);
customDouble .put("doubleValue", customDouble .get("doubleValue") + 1.0);
@@ -551,8 +551,8 @@ 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" ));
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
+var returnValue = true;
+returnValue;
LE
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 2a36c4fa1..2cc957efc 100644
--- a/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex
+++ b/auth/cli-editor/src/main/resources/examples/scripts/TestPolicyJavaEventContext.apex
@@ -228,9 +228,9 @@ var customDate2 = executor.getContextAlbum("CustomDate2Album" ).get("CustomDa
var customSet = executor.getContextAlbum("CustomSetAlbum" ).get("CustomSet" );
var customMap = executor.getContextAlbum("CustomMapAlbum" ).get("CustomMap" );
-javaBoolean = !javaBoolean;
+javaBoolean = javaBoolean == false;
javaByte += 1;
-javaShortType = Java.type("java.lang.Short");
+javaShortType = java.lang.Short;
javaShort = new javaShortType(javaShort + 1);
javaInteger += 1;
javaLong += 1;
@@ -246,14 +246,14 @@ customDouble .setDoubleValue(customDouble .getIncrementedDoubleValue());
customString .setStringValue(customString .getStringValue() + " added to end of string");
customJLong .setLongValue (customJLong .getIncrementedLongValue());
-customDate0Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateItem");
+customDate0Type = org.onap.policy.apex.context.test.concepts.TestContextDateItem;
customDate0 = new customDate0Type(1499868391);
-customDate1Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateTzItem");
+customDate1Type = org.onap.policy.apex.context.test.concepts.TestContextDateTzItem;
customDate1 = new customDate1Type();
customDate1.setDateValue(customDate0);
-customDate2Type = Java.type("org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem");
+customDate2Type = org.onap.policy.apex.context.test.concepts.TestContextDateLocaleItem;
customDate2 = new customDate2Type();
customDate2.setDateValue(customDate0);
@@ -309,9 +309,8 @@ 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" ));
-var returnValueType = Java.type("java.lang.Boolean");
-var returnValue = new returnValueType(true);
-
+var returnValue = true;
+returnValue;
LE
policy create name=Test_Policy template=FREEFORM firstState=OnlyState
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 9c7143ef1..8cbc1698f 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(25996, logCharCount);
- assertEquals(46162, modelCharCount);
+ assertEquals(25892, logCharCount);
+ assertEquals(46048, 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(30154, logCharCount);
- assertEquals(52690, modelCharCount);
+ assertEquals(30068, logCharCount);
+ assertEquals(52596, modelCharCount);
}