From 001320ed1ecbdf3b2f58d261f008f681da3f4c67 Mon Sep 17 00:00:00 2001 From: "Straubs, Ralph (rs8887)" Date: Tue, 4 Feb 2020 03:26:30 -0600 Subject: Add feature-server-pool to the ONAP drools-pdp repository. Issue-ID: POLICY-2351 Change-Id: I8ddde547a73a51c04c8dd9f1d66232e8281599a9 Signed-off-by: Straubs, Ralph (rs8887) --- .../resources/TestController-controller.properties | 13 ++++++ .../src/test/resources/drools-artifact-1.1/pom.xml | 31 +++++++++++++ .../src/main/resources/META-INF/kmodule.xml | 25 +++++++++++ .../src/main/resources/rules.drl | 51 ++++++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 feature-server-pool/src/test/resources/TestController-controller.properties create mode 100644 feature-server-pool/src/test/resources/drools-artifact-1.1/pom.xml create mode 100644 feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml create mode 100644 feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/rules.drl (limited to 'feature-server-pool/src/test/resources') diff --git a/feature-server-pool/src/test/resources/TestController-controller.properties b/feature-server-pool/src/test/resources/TestController-controller.properties new file mode 100644 index 00000000..89414b5e --- /dev/null +++ b/feature-server-pool/src/test/resources/TestController-controller.properties @@ -0,0 +1,13 @@ +controller.name=TestController + +persistence.type=auto + +rules.artifactId=drools-artifact1 +rules.groupId=org.onap.policy.drools-pdp +rules.version=1.0.0 + +ueb.source.topics=JUNIT-TEST-TOPIC +ueb.source.topics.JUNIT-TEST-TOPIC.servers=127.0.63.250 +ueb.source.topics.JUNIT-TEST-TOPIC.events=org.onap.policy.drools.serverpooltest.TestDroolsObject +ueb.source.topics.JUNIT-TEST-TOPIC.events.org.onap.policy.drools.serverpooltest.TestDroolsObject.filter= +[?($.key =~ /.*/)] \ No newline at end of file diff --git a/feature-server-pool/src/test/resources/drools-artifact-1.1/pom.xml b/feature-server-pool/src/test/resources/drools-artifact-1.1/pom.xml new file mode 100644 index 00000000..e747e42b --- /dev/null +++ b/feature-server-pool/src/test/resources/drools-artifact-1.1/pom.xml @@ -0,0 +1,31 @@ + + + + + 4.0.0 + + org.onap.policy.drools-pdp + drools-artifact1 + 1.0.0 + supports Junit tests in feature-server-pool + + diff --git a/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml b/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml new file mode 100644 index 00000000..1e447eb3 --- /dev/null +++ b/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/META-INF/kmodule.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/rules.drl b/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/rules.drl new file mode 100644 index 00000000..9591dee0 --- /dev/null +++ b/feature-server-pool/src/test/resources/drools-artifact-1.1/src/main/resources/rules.drl @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START======================================================= + * feature-server-pool + * ================================================================================ + * Copyright (C) 2020 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========================================================= + */ +package org.onap.policy.drools.serverpool.test; + +import org.onap.policy.drools.serverpool.AdapterImpl; +import org.onap.policy.drools.serverpooltest.Adapter; +import org.onap.policy.drools.serverpooltest.TestDroolsObject; + +rule "Initialization" + when + then + { + System.out.println("Initialization rule running"); + } +end + +rule "Receive 'TestDroolsObject'" + when + $object : TestDroolsObject() + then + { + Adapter adapter = AdapterImpl.getAdapter(); + String key = $object.getKey(); + System.out.println(adapter.toString() + + ": Received TestDroolsObject - key=" + key); + adapter.notificationQueue().add(key); + if (!key.contains("SAVE")) + { + // 'SAVE' keyword identifies messages that shouldn't be retracted + retract($object); + } + } +end + -- cgit 1.2.3-korg