aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/drools-artifact-1.1
diff options
context:
space:
mode:
Diffstat (limited to 'policy-core/drools-artifact-1.1')
-rw-r--r--policy-core/drools-artifact-1.1/pom.xml35
-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
3 files changed, 71 insertions, 0 deletions
diff --git a/policy-core/drools-artifact-1.1/pom.xml b/policy-core/drools-artifact-1.1/pom.xml
new file mode 100644
index 00000000..24a6d37d
--- /dev/null
+++ b/policy-core/drools-artifact-1.1/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP Policy Engine - Drools PDP
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ 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.
+ ============LICENSE_END=========================================================
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>drools-artifact1</artifactId>
+ <version>17.1.0-SNAPSHOT</version>
+ <description>supports Junit tests in policy-core</description>
+
+ <parent>
+ <groupId>org.onap.policy.drools-pdp</groupId>
+ <artifactId>drools-pdp</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+</project>
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