summaryrefslogtreecommitdiffstats
path: root/policy-core/drools-artifact-1.1/src
diff options
context:
space:
mode:
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.xml6
-rw-r--r--policy-core/drools-artifact-1.1/src/main/resources/rules.drl30
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