diff options
author | Ralph Straubs <rs8887@att.com> | 2017-09-18 03:37:28 -0500 |
---|---|---|
committer | Ralph Straubs <rs8887@att.com> | 2017-09-18 07:16:10 -0500 |
commit | f5de85e49dd1bf74ae6342344069fa71771288f2 (patch) | |
tree | 857d2956b14e7b2744ace1ff8e7a80586789a23f /policy-core/drools-artifact-1.1/src | |
parent | fbed3c9c7b816b9fa4dd96dc218a0603b1d1c544 (diff) |
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 <rs8887@att.com>
Diffstat (limited to 'policy-core/drools-artifact-1.1/src')
-rw-r--r-- | policy-core/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml | 6 | ||||
-rw-r--r-- | policy-core/drools-artifact-1.1/src/main/resources/rules.drl | 30 |
2 files changed, 36 insertions, 0 deletions
diff --git a/policy-core/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml b/policy-core/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000..22319689 --- /dev/null +++ b/policy-core/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> + <kbase name="rules"> + <ksession name="session1"/> + </kbase> +</kmodule> diff --git a/policy-core/drools-artifact-1.1/src/main/resources/rules.drl b/policy-core/drools-artifact-1.1/src/main/resources/rules.drl new file mode 100644 index 00000000..9dac208b --- /dev/null +++ b/policy-core/drools-artifact-1.1/src/main/resources/rules.drl @@ -0,0 +1,30 @@ +package org.onap.policy.drools.core.test; + +rule "Initialization" + when + then + { + System.out.println("Initialization rule running"); + } +end + +rule "Add 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 sum = 0; + for (int i = 1 ; i < array.length ; i += 1) + { + sum += array[i]; + } + array[0] = sum; + retract($object); + } + } +end |