diff options
author | Straubs, Ralph (rs8887) <rs8887@att.com> | 2020-02-04 03:26:30 -0600 |
---|---|---|
committer | Chou, Joseph (jc2555) <jc2555@att.com> | 2020-03-04 10:33:48 -0500 |
commit | 001320ed1ecbdf3b2f58d261f008f681da3f4c67 (patch) | |
tree | beb71c4577fd6b4f9bc843a5b0a58566a77009f2 /feature-server-pool/src/test/resources | |
parent | bbcf7265e9b74e689bd8974f9684a6cd5c95fd9f (diff) |
Add feature-server-pool to the ONAP drools-pdp repository.
Issue-ID: POLICY-2351
Change-Id: I8ddde547a73a51c04c8dd9f1d66232e8281599a9
Signed-off-by: Straubs, Ralph (rs8887) <rs8887@att.com>
Diffstat (limited to 'feature-server-pool/src/test/resources')
4 files changed, 120 insertions, 0 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============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========================================================= + --> + +<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> + + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>drools-artifact1</artifactId> + <version>1.0.0</version> + <description>supports Junit tests in feature-server-pool</description> + +</project> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + feature-server-pool + ================================================================================ + Copyright (C) 2019 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========================================================= + --> +<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> + <kbase name="rules"> + <ksession name="session1"/> + </kbase> +</kmodule> 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 + |