From f5de85e49dd1bf74ae6342344069fa71771288f2 Mon Sep 17 00:00:00 2001 From: Ralph Straubs Date: Mon, 18 Sep 2017 03:37:28 -0500 Subject: Add Junit tests to 'policy-core' These tests focus on the following classes: - PolicyContainer - PolicySession - PolicySessionFeatureAPI 'maven-invoker-plugin' was used to compile and install artifacts for testing during the 'test-compile' phase. These aren't part of the Maven project hierarchy, so they aren't visible to Sonar and SonarQube, and they aren't deployed. Change-Id: I67c122debbe5280f0153e7330248dc5d13c5b2c0 Issue-ID: POLICY-236 Signed-off-by: Ralph Straubs --- .../src/main/resources/META-INF/kmodule.xml | 6 +++++ .../src/main/resources/rules.drl | 29 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 policy-core/drools-artifact-1.2/src/main/resources/META-INF/kmodule.xml create mode 100644 policy-core/drools-artifact-1.2/src/main/resources/rules.drl (limited to 'policy-core/drools-artifact-1.2/src/main/resources') diff --git a/policy-core/drools-artifact-1.2/src/main/resources/META-INF/kmodule.xml b/policy-core/drools-artifact-1.2/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000..22319689 --- /dev/null +++ b/policy-core/drools-artifact-1.2/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/policy-core/drools-artifact-1.2/src/main/resources/rules.drl b/policy-core/drools-artifact-1.2/src/main/resources/rules.drl new file mode 100644 index 00000000..e69b6597 --- /dev/null +++ b/policy-core/drools-artifact-1.2/src/main/resources/rules.drl @@ -0,0 +1,29 @@ +package org.onap.policy.drools.core.test; + +rule "Initialization" + when + then + { + System.out.println("Initialization rule running"); + } +end + +rule "Multiply elements of an int array" + when + $object : Object() + then + { + if ($object instanceof int[]) + { + int[] array = (int[])($object); + + System.out.println("Received array of length " + array.length); + int product = 1; + for (int i = 1 ; i < array.length ; i += 1) + { + product *= array[i]; + } + array[0] = product; + } + } +end -- cgit 1.2.3-korg