mirror of https://github.com/apache/nifi.git
NIFI-12070 Removed nifi-easyrules-bundle
This closes #7738 Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
parent
bd2276260e
commit
c042a48c86
|
@ -1120,12 +1120,6 @@ language governing permissions and limitations under the License. -->
|
|||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-easyrules-nar</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-rules-action-handler-nar</artifactId>
|
||||
|
@ -1150,12 +1144,6 @@ language governing permissions and limitations under the License. -->
|
|||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-easyrules-nar</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-rules-action-handler-nar</artifactId>
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<parent>
|
||||
<artifactId>nifi-easyrules-bundle</artifactId>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nifi-easyrules-nar</artifactId>
|
||||
<packaging>nar</packaging>
|
||||
<properties>
|
||||
<maven.javadoc.skip>true</maven.javadoc.skip>
|
||||
<source.skip>true</source.skip>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-easyrules-service</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-standard-services-api-nar</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<type>nar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,258 +0,0 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
|
||||
|
||||
nifi-easyrules-nar includes subcomponents with separate copyright notices and
|
||||
license terms. Your use of these subcomponents is subject to the terms
|
||||
and conditions of the following licenses:
|
||||
|
||||
The binary distribution of this product bundles 'Easy Rules' under an MIT style license.
|
||||
|
||||
Copyright (c) 2019 Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
The binary distribution of this product bundles the 'ASM' library which is available under a BSD style license.
|
||||
|
||||
Copyright (c) 2000-2005 INRIA, France Telecom
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -1,46 +0,0 @@
|
|||
nifi-easyrules-nar
|
||||
Copyright 2014-2023 The Apache Software Foundation
|
||||
|
||||
This product includes software developed at
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
******************
|
||||
Apache Software License v2
|
||||
******************
|
||||
|
||||
The following binary components are provided under the Apache Software License v2
|
||||
|
||||
(ASLv2) MVEL (MVFLEX Expression Language)
|
||||
|
||||
(ASLv2) SnakeYAML
|
||||
|
||||
(ASLv2) Jackson JSON processor
|
||||
The following NOTICE information applies:
|
||||
# Jackson JSON processor
|
||||
|
||||
Jackson is a high-performance, Free/Open Source JSON processing library.
|
||||
It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
|
||||
been in development since 2007.
|
||||
It is currently developed by a community of developers, as well as supported
|
||||
commercially by FasterXML.com.
|
||||
|
||||
## Licensing
|
||||
|
||||
Jackson core and extension components may licensed under different licenses.
|
||||
To find the details that apply to this artifact see the accompanying LICENSE file.
|
||||
For more information, including possible other licensing options, contact
|
||||
FasterXML.com (http://fasterxml.com).
|
||||
|
||||
## Credits
|
||||
|
||||
A list of contributors may be found from CREDITS file, which is included
|
||||
in some artifacts (usually source distributions); but is always available
|
||||
from the source code management (SCM) system project uses.
|
||||
|
||||
************************
|
||||
The MIT License
|
||||
************************
|
||||
|
||||
The following binary components are provided under the MIT License.
|
||||
|
||||
(MIT License) Easy Rules
|
|
@ -1,106 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<parent>
|
||||
<artifactId>nifi-easyrules-bundle</artifactId>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nifi-easyrules-service</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<easy.rules.version>4.1.0</easy.rules.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-rules-engine-service-api</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-utils</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeasy</groupId>
|
||||
<artifactId>easy-rules-core</artifactId>
|
||||
<version>${easy.rules.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeasy</groupId>
|
||||
<artifactId>easy-rules-mvel</artifactId>
|
||||
<version>${easy.rules.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeasy</groupId>
|
||||
<artifactId>easy-rules-spel</artifactId>
|
||||
<version>${easy.rules.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-jexl3</artifactId>
|
||||
<version>3.3</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-mock</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
<artifactId>apache-rat-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes combine.children="append">
|
||||
<exclude>src/test/resources/test_nifi_rules.json</exclude>
|
||||
<exclude>src/test/resources/test_nifi_rules.yml</exclude>
|
||||
<exclude>src/test/resources/test_nifi_rules_filter.json</exclude>
|
||||
<exclude>src/test/resources/test_mvel_rules.json</exclude>
|
||||
<exclude>src/test/resources/test_mvel_rules.yml</exclude>
|
||||
<exclude>src/test/resources/test_spel_rules.json</exclude>
|
||||
<exclude>src/test/resources/test_bad_spel_rules.json</exclude>
|
||||
<exclude>src/test/resources/test_spel_rules.yml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -1,137 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.jeasy.rules.support.reader.JsonRuleDefinitionReader;
|
||||
import org.jeasy.rules.support.RuleDefinition;
|
||||
import org.jeasy.rules.support.reader.RuleDefinitionReader;
|
||||
import org.jeasy.rules.support.reader.YamlRuleDefinitionReader;
|
||||
import org.yaml.snakeyaml.LoaderOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.constructor.Constructor;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Factory which transform file based rules into NiFi Rules API. Rules formats supported are NiFi Rules format and
|
||||
* Easy Rules MVEL and SPEL formats. JSON and YaML file types are support for both formats
|
||||
*/
|
||||
public class RulesFactory {
|
||||
|
||||
enum FileType {
|
||||
YAML, JSON;
|
||||
}
|
||||
|
||||
enum FileFormat {
|
||||
NIFI, MVEL, SPEL;
|
||||
}
|
||||
|
||||
public static List<Rule> createRulesFromFile(String ruleFile, String ruleFileType, String rulesFileFormat) throws Exception {
|
||||
try (final InputStream rulesInputStream = new FileInputStream(ruleFile)) {
|
||||
return createRules(rulesInputStream, ruleFileType, rulesFileFormat);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Rule> createRulesFromString(String rulesBody, String ruleFileType, String rulesFileFormat) throws Exception {
|
||||
try (final InputStream rulesInputStream = new ByteArrayInputStream(rulesBody.getBytes())) {
|
||||
return createRules(rulesInputStream, ruleFileType, rulesFileFormat);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Rule> createRules(InputStream rulesInputStream, String ruleFileType, String rulesFileFormat) throws Exception {
|
||||
FileFormat fileFormat = FileFormat.valueOf(rulesFileFormat);
|
||||
switch (fileFormat) {
|
||||
case NIFI:
|
||||
return createRulesFromNiFiFormat(rulesInputStream, ruleFileType);
|
||||
case MVEL:
|
||||
case SPEL:
|
||||
return createRulesFromEasyRulesFormat(rulesInputStream, ruleFileType, rulesFileFormat);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Rule> createRulesFromEasyRulesFormat(InputStream rulesInputStream, String ruleFileType, String ruleFileFormat) throws Exception {
|
||||
RuleDefinitionReader reader = FileType.valueOf(ruleFileType).equals(FileType.YAML)
|
||||
? new YamlRuleDefinitionReader() : new JsonRuleDefinitionReader();
|
||||
|
||||
List<RuleDefinition> ruleDefinitions = reader.read(new InputStreamReader(rulesInputStream));
|
||||
|
||||
return ruleDefinitions.stream().map(ruleDefinition -> {
|
||||
|
||||
Rule rule = new Rule();
|
||||
rule.setName(ruleDefinition.getName());
|
||||
rule.setDescription(ruleDefinition.getDescription());
|
||||
rule.setPriority(ruleDefinition.getPriority());
|
||||
rule.setCondition(ruleDefinition.getCondition());
|
||||
List<Action> actions = ruleDefinition.getActions().stream().map(ruleAction -> {
|
||||
Action action = new Action();
|
||||
action.setType("EXPRESSION");
|
||||
Map<String, String> attributes = new HashMap<>();
|
||||
attributes.put("command", ruleAction);
|
||||
attributes.put("type", ruleFileFormat);
|
||||
action.setAttributes(attributes);
|
||||
return action;
|
||||
}).collect(Collectors.toList());
|
||||
rule.setActions(actions);
|
||||
return rule;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static List<Rule> createRulesFromNiFiFormat(InputStream rulesInputStream, String ruleFileType) throws Exception {
|
||||
FileType type = FileType.valueOf(ruleFileType.toUpperCase());
|
||||
if (type.equals(FileType.YAML)) {
|
||||
return yamlToRules(rulesInputStream);
|
||||
} else if (type.equals(FileType.JSON)) {
|
||||
return jsonToRules(rulesInputStream);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Rule> yamlToRules(InputStream rulesInputStream) throws FileNotFoundException {
|
||||
List<Rule> rules = new ArrayList<>();
|
||||
Yaml yaml = new Yaml(new Constructor(Rule.class, new LoaderOptions()));
|
||||
for (Object object : yaml.loadAll(rulesInputStream)) {
|
||||
if (object instanceof Rule) {
|
||||
rules.add((Rule) object);
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
private static List<Rule> jsonToRules(InputStream rulesInputStream) throws Exception {
|
||||
List<Rule> rules;
|
||||
InputStreamReader isr = new InputStreamReader(rulesInputStream);
|
||||
final ObjectMapper objectMapper = new ObjectMapper();
|
||||
rules = objectMapper.readValue(isr, new TypeReference<List<Rule>>() {
|
||||
});
|
||||
return rules;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
|
||||
package org.apache.nifi.rules;
|
||||
|
||||
import org.jeasy.rules.api.Condition;
|
||||
import org.jeasy.rules.api.Facts;
|
||||
import org.mvel2.MVEL;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class RulesMVELCondition implements Condition {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RulesMVELCondition.class);
|
||||
private String expression;
|
||||
private Serializable compiledExpression;
|
||||
private boolean ignoreConditionErrors;
|
||||
|
||||
public RulesMVELCondition(String expression, boolean ignoreConditionErrors) {
|
||||
this.expression = expression;
|
||||
this.compiledExpression = MVEL.compileExpression(expression);
|
||||
this.ignoreConditionErrors = ignoreConditionErrors;
|
||||
}
|
||||
|
||||
public boolean evaluate(Facts facts) {
|
||||
try {
|
||||
return (Boolean)MVEL.executeExpression(this.compiledExpression, facts.asMap());
|
||||
} catch (Exception ex) {
|
||||
if(ignoreConditionErrors) {
|
||||
LOGGER.debug("Unable to evaluate expression: '" + this.expression + "' on facts: " + facts, ex);
|
||||
return false;
|
||||
} else{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules;
|
||||
|
||||
import org.jeasy.rules.api.Condition;
|
||||
import org.jeasy.rules.api.Facts;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.expression.ExpressionParser;
|
||||
import org.springframework.expression.ParserContext;
|
||||
import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||
|
||||
public class RulesSPELCondition implements Condition {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RulesSPELCondition.class);
|
||||
private final ExpressionParser parser = new SpelExpressionParser();
|
||||
private String expression;
|
||||
private Expression compiledExpression;
|
||||
private boolean ignoreConditionErrors;
|
||||
|
||||
|
||||
public RulesSPELCondition(String expression) {
|
||||
this.expression = expression;
|
||||
this.compiledExpression = this.parser.parseExpression(expression);
|
||||
}
|
||||
|
||||
public RulesSPELCondition(String expression, ParserContext parserContext) {
|
||||
this.expression = expression;
|
||||
this.compiledExpression = this.parser.parseExpression(expression, parserContext);
|
||||
}
|
||||
|
||||
public RulesSPELCondition(String expression, boolean ignoreConditionErrors) {
|
||||
this.expression = expression;
|
||||
this.compiledExpression = this.parser.parseExpression(expression);
|
||||
this.ignoreConditionErrors = ignoreConditionErrors;
|
||||
}
|
||||
|
||||
public RulesSPELCondition(String expression, ParserContext parserContext, boolean ignoreConditionErrors) {
|
||||
this.expression = expression;
|
||||
this.compiledExpression = this.parser.parseExpression(expression, parserContext);
|
||||
this.ignoreConditionErrors = ignoreConditionErrors;
|
||||
}
|
||||
|
||||
public boolean evaluate(Facts facts) {
|
||||
try {
|
||||
StandardEvaluationContext context = new StandardEvaluationContext();
|
||||
context.setRootObject(facts.asMap());
|
||||
context.setVariables(facts.asMap());
|
||||
return this.compiledExpression.getValue(context, Boolean.class);
|
||||
} catch (Exception ex) {
|
||||
if(ignoreConditionErrors) {
|
||||
LOGGER.debug("Unable to evaluate expression: '" + this.expression + "' on facts: " + facts, ex);
|
||||
return false;
|
||||
} else{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.annotation.lifecycle.OnEnabled;
|
||||
import org.apache.nifi.components.AllowableValue;
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.components.ValidationContext;
|
||||
import org.apache.nifi.components.ValidationResult;
|
||||
import org.apache.nifi.components.Validator;
|
||||
import org.apache.nifi.components.resource.ResourceCardinality;
|
||||
import org.apache.nifi.components.resource.ResourceType;
|
||||
import org.apache.nifi.controller.AbstractControllerService;
|
||||
import org.apache.nifi.controller.ConfigurationContext;
|
||||
import org.apache.nifi.controller.ControllerServiceInitializationContext;
|
||||
import org.apache.nifi.expression.ExpressionLanguageScope;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.apache.nifi.rules.Rule;
|
||||
import org.apache.nifi.rules.RulesFactory;
|
||||
import org.apache.nifi.util.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AbstractEasyRulesEngineController extends AbstractControllerService {
|
||||
|
||||
static final AllowableValue YAML = new AllowableValue("YAML", "YAML", "YAML file configuration type.");
|
||||
static final AllowableValue JSON = new AllowableValue("JSON", "JSON", "JSON file configuration type.");
|
||||
static final AllowableValue NIFI = new AllowableValue("NIFI", "NIFI", "NiFi rules formatted file.");
|
||||
static final AllowableValue MVEL = new AllowableValue("MVEL", "Easy Rules MVEL", "Easy Rules File format using MVFLEX Expression Language");
|
||||
static final AllowableValue SPEL = new AllowableValue("SPEL", "Easy Rules SpEL", "Easy Rules File format using Spring Expression Language");
|
||||
|
||||
static final PropertyDescriptor RULES_FILE_PATH = new PropertyDescriptor.Builder()
|
||||
.name("rules-file-path")
|
||||
.displayName("Rules File Path")
|
||||
.description("Path to location of rules file. Only one of Rules File or Rules Body may be used")
|
||||
.required(false)
|
||||
.identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor RULES_BODY = new PropertyDescriptor.Builder()
|
||||
.name("rules-body")
|
||||
.displayName("Rules Body")
|
||||
.description("Body of rules file to execute. Only one of Rules File or Rules Body may be used")
|
||||
.required(false)
|
||||
.addValidator(Validator.VALID)
|
||||
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor RULES_FILE_TYPE = new PropertyDescriptor.Builder()
|
||||
.name("rules-file-type")
|
||||
.displayName("Rules File Type")
|
||||
.description("File or Body type for rules definition. Supported types are YAML and JSON")
|
||||
.required(true)
|
||||
.allowableValues(JSON,YAML)
|
||||
.defaultValue(JSON.getValue())
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor RULES_FILE_FORMAT = new PropertyDescriptor.Builder()
|
||||
.name("rules-file-format")
|
||||
.displayName("Rules File Format")
|
||||
.description("Format for rules. Supported formats are NiFi Rules, Easy Rules files with MVEL Expression Language" +
|
||||
" and Easy Rules files with Spring Expression Language.")
|
||||
.required(true)
|
||||
.allowableValues(NIFI,MVEL,SPEL)
|
||||
.defaultValue(NIFI.getValue())
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor IGNORE_CONDITION_ERRORS = new PropertyDescriptor.Builder()
|
||||
.name("rules-ignore-condition-errors")
|
||||
.displayName("Ignore Condition Errors")
|
||||
.description("When set to true, rules engine will ignore errors for any rule that encounters issues " +
|
||||
"when compiling rule conditions (including syntax errors and/or missing facts). Rule will simply return as false " +
|
||||
"and engine will continue with execution.")
|
||||
.required(true)
|
||||
.defaultValue("false")
|
||||
.allowableValues("true", "false")
|
||||
.build();
|
||||
|
||||
static final PropertyDescriptor FILTER_RULES_MISSING_FACTS = new PropertyDescriptor.Builder()
|
||||
.name("rules-filter-missing-facts")
|
||||
.displayName("Filter Rules With Missing Facts")
|
||||
.description("When set to true, the rules engine will first filter out any rule where fact are not available before " +
|
||||
"executing a check or firing that rule. When running a check rules this will return only rules " +
|
||||
"that were evaluated after filtering. NOTE: This is only applicable for the NIFI Rules Format (which allows" +
|
||||
" specification of fact variables) and will be ignored for other formats.")
|
||||
.required(true)
|
||||
.defaultValue("false")
|
||||
.allowableValues("true", "false")
|
||||
.build();
|
||||
|
||||
protected List<PropertyDescriptor> properties;
|
||||
protected List<Rule> rules;
|
||||
protected volatile String rulesFileFormat;
|
||||
protected boolean ignoreConditionErrors;
|
||||
protected boolean filterRules;
|
||||
|
||||
@Override
|
||||
protected void init(ControllerServiceInitializationContext config) throws InitializationException {
|
||||
super.init(config);
|
||||
final List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(RULES_FILE_TYPE);
|
||||
properties.add(RULES_FILE_PATH);
|
||||
properties.add(RULES_BODY);
|
||||
properties.add(RULES_FILE_FORMAT);
|
||||
properties.add(IGNORE_CONDITION_ERRORS);
|
||||
properties.add(FILTER_RULES_MISSING_FACTS);
|
||||
this.properties = Collections.unmodifiableList(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@OnEnabled
|
||||
public void onEnabled(final ConfigurationContext context) throws InitializationException {
|
||||
final String rulesFile = context.getProperty(RULES_FILE_PATH).getValue();
|
||||
final String rulesBody = context.getProperty(RULES_BODY).getValue();
|
||||
final String rulesFileType = context.getProperty(RULES_FILE_TYPE).getValue();
|
||||
rulesFileFormat = context.getProperty(RULES_FILE_FORMAT).getValue();
|
||||
ignoreConditionErrors = context.getProperty(IGNORE_CONDITION_ERRORS).asBoolean();
|
||||
filterRules = context.getProperty(FILTER_RULES_MISSING_FACTS).asBoolean();
|
||||
|
||||
try{
|
||||
if(StringUtils.isEmpty(rulesFile)){
|
||||
rules = RulesFactory.createRulesFromString(rulesBody, rulesFileType, rulesFileFormat);
|
||||
}else{
|
||||
rules = RulesFactory.createRulesFromFile(rulesFile, rulesFileType, rulesFileFormat);
|
||||
}
|
||||
} catch (Exception fex){
|
||||
throw new InitializationException(fex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom validation for ensuring exactly one of Script File or Script Body is populated
|
||||
*
|
||||
* @param validationContext provides a mechanism for obtaining externally
|
||||
* managed values, such as property values and supplies convenience methods
|
||||
* for operating on those values
|
||||
* @return A collection of validation results
|
||||
*/
|
||||
@Override
|
||||
public Collection<ValidationResult> customValidate(ValidationContext validationContext) {
|
||||
Set<ValidationResult> results = new HashSet<>();
|
||||
|
||||
// Verify that exactly one of "script file" or "script body" is set
|
||||
Map<PropertyDescriptor, String> propertyMap = validationContext.getProperties();
|
||||
if (StringUtils.isEmpty(propertyMap.get(RULES_FILE_PATH)) == StringUtils.isEmpty(propertyMap.get(RULES_BODY))) {
|
||||
results.add(new ValidationResult.Builder().subject("Rules Body or Rules File").valid(false).explanation(
|
||||
"exactly one of Rules File or Rules Body must be set").build());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
protected RulesEngine getRulesEngine() {
|
||||
List<Rule> rulesCopy = new ArrayList<>();
|
||||
rules.forEach(rule -> {
|
||||
rulesCopy.add(rule.clone());
|
||||
});
|
||||
return new EasyRulesEngine(rulesFileFormat, ignoreConditionErrors, filterRules, Collections.unmodifiableList(rulesCopy));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.rules.Action;
|
||||
import org.apache.nifi.rules.Rule;
|
||||
import org.apache.nifi.rules.RulesMVELCondition;
|
||||
import org.apache.nifi.rules.RulesSPELCondition;
|
||||
import org.jeasy.rules.api.Condition;
|
||||
import org.jeasy.rules.api.Fact;
|
||||
import org.jeasy.rules.api.Facts;
|
||||
import org.jeasy.rules.api.RuleListener;
|
||||
import org.jeasy.rules.api.Rules;
|
||||
import org.jeasy.rules.core.BasicRule;
|
||||
import org.jeasy.rules.core.DefaultRulesEngine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
|
||||
public class EasyRulesEngine implements RulesEngine {
|
||||
|
||||
protected String rulesFileFormat;
|
||||
protected boolean ignoreConditionErrors;
|
||||
protected boolean filterRulesMissingFacts;
|
||||
protected Rules easyRules;
|
||||
protected List<RuleListener> ruleListeners;
|
||||
protected DefaultRulesEngine rulesEngine;
|
||||
|
||||
|
||||
public EasyRulesEngine(String rulesFileFormat, boolean ignoreConditionErrors, boolean filterRulesMissingFacts, List<Rule> rules) {
|
||||
this.rulesFileFormat = rulesFileFormat;
|
||||
this.ignoreConditionErrors = ignoreConditionErrors;
|
||||
this.filterRulesMissingFacts = filterRulesMissingFacts;
|
||||
this.easyRules = convertToEasyRules(rules, rulesFileFormat, ignoreConditionErrors);
|
||||
this.rulesEngine = new DefaultRulesEngine();
|
||||
if (getRuleListeners() != null) {
|
||||
rulesEngine.registerRuleListeners(getRuleListeners());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of actions what should be executed for a given set of facts
|
||||
*
|
||||
* @param facts a Map of key and facts values, as objects, that should be evaluated by the rules engine
|
||||
* @return List of Actions
|
||||
*/
|
||||
@Override
|
||||
public List<Action> fireRules(Map<String, Object> facts) {
|
||||
final List<Action> actions = new ArrayList<>();
|
||||
Map<Rule, Boolean> checkedRules = checkRules(facts);
|
||||
checkedRules.forEach((checkedRule, executeRule) -> {
|
||||
if (executeRule) {
|
||||
actions.addAll(checkedRule.getActions());
|
||||
}
|
||||
});
|
||||
return actions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Map with Rule as a key and Boolean as a value indicating that the rule's conditions were met
|
||||
*
|
||||
* @param facts Map of keys and values contains facts to evaluate against rules
|
||||
* @return Map of Rules
|
||||
*/
|
||||
@Override
|
||||
public Map<Rule, Boolean> checkRules(Map<String, Object> facts) {
|
||||
Map<Rule, Boolean> checkedRules = new HashMap<>();
|
||||
if (easyRules == null || facts == null || facts.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
Facts easyFacts = new Facts();
|
||||
facts.forEach(easyFacts::put);
|
||||
|
||||
Map<org.jeasy.rules.api.Rule, Boolean> checkedEasyRules = rulesEngine.check(filterRulesMissingFacts ? filterByAvailableFacts(facts) : easyRules, easyFacts);
|
||||
checkedEasyRules.forEach((checkedRuled, executeAction) -> {
|
||||
checkedRules.put(((NiFiEasyRule) checkedRuled).getNifiRule(), executeAction);
|
||||
});
|
||||
|
||||
}
|
||||
return checkedRules;
|
||||
}
|
||||
|
||||
public List<Rule> getRules() {
|
||||
return StreamSupport.stream(easyRules.spliterator(), false)
|
||||
.map(easyRule -> ((NiFiEasyRule) easyRule)
|
||||
.getNifiRule()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<RuleListener> getRuleListeners() {
|
||||
return ruleListeners;
|
||||
}
|
||||
|
||||
void setRuleListeners(List<RuleListener> ruleListeners) {
|
||||
this.ruleListeners = ruleListeners;
|
||||
}
|
||||
|
||||
private org.jeasy.rules.api.Rules convertToEasyRules(List<Rule> rules, String rulesFileFormat, Boolean ignoreConditionErrors) {
|
||||
final Rules easyRules = new Rules();
|
||||
for (Rule rule : rules) {
|
||||
easyRules.register(new NiFiEasyRule(rule, rulesFileFormat, ignoreConditionErrors));
|
||||
}
|
||||
return easyRules;
|
||||
}
|
||||
|
||||
private Rules filterByAvailableFacts(Map<String, Object> facts) {
|
||||
Set<String> factVariables = facts.keySet();
|
||||
List<org.jeasy.rules.api.Rule> filteredEasyRules = StreamSupport.stream(easyRules.spliterator(), false)
|
||||
.filter(easyRule -> ((NiFiEasyRule) easyRule).getNifiRule().getFacts() == null || factVariables.containsAll(((NiFiEasyRule) easyRule)
|
||||
.getNifiRule().getFacts())).collect(Collectors.toList());
|
||||
|
||||
return new Rules(new HashSet(filteredEasyRules));
|
||||
}
|
||||
|
||||
private static class NiFiEasyRule extends BasicRule {
|
||||
|
||||
private Condition condition;
|
||||
private Rule nifiRule;
|
||||
|
||||
NiFiEasyRule(Rule nifiRule, String rulesFileFormat, Boolean ignoreConditionErrors) {
|
||||
super(nifiRule.getName(), nifiRule.getDescription(), nifiRule.getPriority());
|
||||
this.condition = rulesFileFormat.equalsIgnoreCase("spel")
|
||||
? new RulesSPELCondition(nifiRule.getCondition(), ignoreConditionErrors) : new RulesMVELCondition(nifiRule.getCondition(), ignoreConditionErrors);
|
||||
this.nifiRule = nifiRule;
|
||||
}
|
||||
|
||||
public boolean evaluate(Facts facts) {
|
||||
|
||||
final Facts evaluateFacts;
|
||||
|
||||
if (nifiRule.getFacts() != null) {
|
||||
|
||||
List<Fact<?>> filteredFacts = StreamSupport.stream(facts.spliterator(), false)
|
||||
.filter(fact -> nifiRule.getFacts().contains(fact.getName())).collect(Collectors.toList());
|
||||
|
||||
if (filteredFacts.size() > 0) {
|
||||
evaluateFacts = new Facts();
|
||||
filteredFacts.forEach(filteredFact -> {
|
||||
evaluateFacts.put(filteredFact.getName(), filteredFact.getValue());
|
||||
});
|
||||
} else {
|
||||
evaluateFacts = facts;
|
||||
}
|
||||
|
||||
} else {
|
||||
evaluateFacts = facts;
|
||||
}
|
||||
|
||||
return this.condition.evaluate(evaluateFacts);
|
||||
|
||||
}
|
||||
|
||||
Rule getNifiRule() {
|
||||
return nifiRule;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
|
||||
|
||||
@CapabilityDescription("Provides an instance of a rules engine to the caller. Supports " +
|
||||
"rules stored as JSON or YAML file types.")
|
||||
@Tags({ "rules","rules-engine","engine","actions","facts" })
|
||||
public class EasyRulesEngineProvider extends AbstractEasyRulesEngineController implements RulesEngineProvider {
|
||||
|
||||
/**
|
||||
* Returns a rules engine instance
|
||||
* @return Rules Engine
|
||||
*/
|
||||
@Override
|
||||
public RulesEngine getRulesEngine() {
|
||||
return super.getRulesEngine();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.annotation.documentation.CapabilityDescription;
|
||||
import org.apache.nifi.annotation.documentation.Tags;
|
||||
import org.apache.nifi.annotation.lifecycle.OnEnabled;
|
||||
import org.apache.nifi.controller.ConfigurationContext;
|
||||
import org.apache.nifi.logging.ComponentLog;
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.apache.nifi.rules.Action;
|
||||
import org.jeasy.rules.api.Facts;
|
||||
import org.jeasy.rules.api.RuleListener;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Implementation of RulesEngineService interface
|
||||
*
|
||||
* @see RulesEngineService
|
||||
*/
|
||||
@CapabilityDescription("Defines and execute the rules stored in NiFi or EasyRules file formats for a given set of facts. Supports " +
|
||||
"rules stored as JSON or YAML file types.")
|
||||
@Tags({ "rules","rules-engine","engine","actions","facts" })
|
||||
public class EasyRulesEngineService extends EasyRulesEngineProvider implements RulesEngineService {
|
||||
|
||||
private volatile RulesEngine rulesEngine;
|
||||
|
||||
@Override
|
||||
@OnEnabled
|
||||
public void onEnabled(final ConfigurationContext context) throws InitializationException {
|
||||
super.onEnabled(context);
|
||||
EasyRulesEngine easyRulesEngine = (EasyRulesEngine) getRulesEngine();
|
||||
List<RuleListener> ruleListeners = new ArrayList<>();
|
||||
ruleListeners.add(new EasyRulesListener(getLogger()));
|
||||
easyRulesEngine.setRuleListeners(ruleListeners);
|
||||
rulesEngine = easyRulesEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of actions what should be executed for a given set of facts
|
||||
* @param facts a Map of key and facts values, as objects, that should be evaluated by the rules engine
|
||||
* @return List of Actions
|
||||
*/
|
||||
@Override
|
||||
public List<Action> fireRules(Map<String, Object> facts) {
|
||||
return rulesEngine.fireRules(facts);
|
||||
}
|
||||
|
||||
private static class EasyRulesListener implements RuleListener {
|
||||
|
||||
private ComponentLog logger;
|
||||
|
||||
EasyRulesListener(ComponentLog logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean beforeEvaluate(org.jeasy.rules.api.Rule rule, Facts facts) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterEvaluate(org.jeasy.rules.api.Rule rule, Facts facts, boolean b) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void beforeExecute(org.jeasy.rules.api.Rule rule, Facts facts) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(org.jeasy.rules.api.Rule rule, Facts facts) {
|
||||
logger.debug("Rules was successfully processed for: {}",new Object[]{rule.getName()});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(org.jeasy.rules.api.Rule rule, Facts facts, Exception e) {
|
||||
logger.warn("Rule execution failed for: {}", new Object[]{rule.getName()}, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You 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.
|
||||
org.apache.nifi.rules.engine.EasyRulesEngineService
|
||||
org.apache.nifi.rules.engine.EasyRulesEngineProvider
|
|
@ -1,114 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>EasyRulesEngineService</title>
|
||||
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<h2>General</h2>
|
||||
<p>The Easy Rules Engine Service supports execution of a centralized set of rules (stored as files or provided within the service configuration) against a provided set of data called facts. It supports both the RulesEngineProvider
|
||||
and RulesEngineService interfaces, allowing callers to send facts to the service to process against a centralized rules engine, or allowing them to retrieve an instance of a rules engine to process facts locally.
|
||||
Upon execution, the rules engine will determine what rules have been met and return a list of actions that should be executed based on the conditions defined within the rules.
|
||||
</p>
|
||||
<p>
|
||||
Rules can be implemented in any of the following formats:
|
||||
</p>
|
||||
<ul>
|
||||
<li> NiFi Rules Format - This is a rules file which follows the NiFi style for rules definition, which supports MVEL (MVFLEX) Expression language for conditions (default format).
|
||||
</li>
|
||||
<li> Easy Rules Format with MVEL Support - This is a rules file which follows the Easy Rules style for rules definition that supports MVEL (MVFLEX) Expression language for conditions and actions
|
||||
</li>
|
||||
<li> Easy Rules Format with SPEL Support - This is a rules file which follows the Easy Rules style for rules definition that supports Spring Expression language for conditions and actions
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
All rules formats can be structured as JSON or YAML (with JSON serving as default type). Rules can be stored as a file or provided in the Rules Body setting in the service's configuration settings.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
NiFi Rules Format consist of the following elements:
|
||||
</p>
|
||||
<table>
|
||||
<tr><td>Name</td><td>The name of the rule.</td></tr>
|
||||
<tr><td>Description</td><td>A description of the rule.</td></tr>
|
||||
<tr><td>Priority</td><td>Unique number for order in which rule should be executed in the rules engine.</td></tr>
|
||||
<tr><td>Condition</td><td>The condition that will be checked given a set of fact data. For NiFi Format the MVEL expression language is supported.</td></tr>
|
||||
<tr><td>Action(s)</td><td>The required actions that should be performed if the condition checked returns true. This includes the type of action and any attributes required to execute that action. Action types and attributes are string values that can be defined as needed.
|
||||
The expectation is the types and attributes are understood by the caller/action executor.</td></tr>
|
||||
<tr><td>Fact(s)</td><td>The name of fact item(s) that is required to execute the rule.</td></tr>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
NiFi rules format is very similar to Easy Rules file format except the Action includes details for the type of action that should be performed along with attributes for performing the action.
|
||||
This provides a more flexible way to configure external handlers that will execute returned actions. When Easy Rules formats are provided, easy rule actions are translated into an "EXPRESSION" NiFi action type where the attributes contains
|
||||
the command that should be executed directly along with the supported expression language type (via a "command" and "type" attributes respectively).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The following are examples of NiFi Rules Format as YAML and JSON file types. In both cases a single rule is shown however multiple rule entries can be provided (following the appropriate multiple entry syntax for the given file type):
|
||||
</p>
|
||||
<p>
|
||||
<b>NiFi Rules YAML File</b>: This file shows an example of a single rule which checks if predictedQueuedCount value (provided in facts) is greater than 50. If the condition is met an action with the type of "LOG" is defined,
|
||||
which denotes the action that should be taken by the caller. Attributes for the "LOG" action type can be provided as demonstrated below with the "logLevel and "message" attributes. The caller can use these or other provided attributes in order
|
||||
to configure and execute the "LOG" action.<br>
|
||||
<pre>
|
||||
name: "Queue Size"
|
||||
description: "Queue size check greater than 50"
|
||||
priority: 1
|
||||
condition: "predictedQueuedCount > 50"
|
||||
actions:
|
||||
- type: "LOG"
|
||||
attributes:
|
||||
logLevel: "DEBUG"
|
||||
message: "Queue Size Over 50 is detected!"
|
||||
facts:
|
||||
- "predictedQueuedCount"
|
||||
</pre>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>NiFi Rules JSON File</b>: This file shows an example of a single rule which checks the size of a flowFile (with a flowFile being available via facts).
|
||||
If the condition is met two actions are defined for execution (with types that should be recognized by the caller).<br>
|
||||
<pre>
|
||||
[
|
||||
{
|
||||
"name": "Large Flow File",
|
||||
"description": "Flow File Size Larger Than Expected",
|
||||
"priority": 1,
|
||||
"condition": "flowFile.size > 500",
|
||||
"actions": [
|
||||
{
|
||||
"type": "LOG",
|
||||
"attributes": {
|
||||
"logLevel": "WARN",
|
||||
"message": "Unexpected file size!"
|
||||
},
|
||||
{
|
||||
"type": "SEND",
|
||||
"attributes": {
|
||||
"sendZeroResults": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"facts": ["flowFile"]
|
||||
}
|
||||
]
|
||||
</pre>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -1,90 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules;
|
||||
|
||||
import org.jeasy.rules.api.Condition;
|
||||
import org.jeasy.rules.api.Facts;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TestRulesCondition {
|
||||
|
||||
@Test
|
||||
public void testRulesMVELConditionPassed(){
|
||||
String expression = "predictedTimeToBytesBackpressureMillis <= 14400000";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",13300000);
|
||||
Condition condition = new RulesMVELCondition(expression, false);
|
||||
long start = System.currentTimeMillis();
|
||||
boolean passed = condition.evaluate(facts);
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("Total Time: " + (end - start));
|
||||
assertTrue(passed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRulesMVELConditionFailed(){
|
||||
String expression = "predictedQueuedCount > 50";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedQueuedCount",49);
|
||||
Condition condition = new RulesMVELCondition(expression, false);
|
||||
assertFalse(condition.evaluate(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRulesMVELConditionError(){
|
||||
String expression = "predictedQueuedCount > 50";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedQueued",100);
|
||||
Condition condition = new RulesMVELCondition(expression, false);
|
||||
assertThrows(Exception.class, () -> condition.evaluate(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRulesSPELConditionPassed(){
|
||||
String expression = "#predictedQueuedCount > 50";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedQueuedCount",100);
|
||||
Condition condition = new RulesSPELCondition(expression, false);
|
||||
long start = System.currentTimeMillis();
|
||||
boolean passed = condition.evaluate(facts);
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("Total Time: " + (end - start));
|
||||
assertTrue(passed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRulesSPELConditionFailed(){
|
||||
String expression = "#predictedQueuedCount > 50";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedQueuedCount",49);
|
||||
Condition condition = new RulesSPELCondition(expression, false);
|
||||
assertFalse(condition.evaluate(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRulesSPELConditionError(){
|
||||
String expression = "predictedQueuedCount > 50";
|
||||
Facts facts = new Facts();
|
||||
facts.put("predictedQueuedCount",100);
|
||||
Condition condition = new RulesSPELCondition(expression, false);
|
||||
assertThrows(Exception.class, () -> condition.evaluate(facts));
|
||||
}
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
public class TestRulesFactory {
|
||||
@Test
|
||||
public void testCreateRulesFromNiFiYaml(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testYamlFile = "src/test/resources/test_nifi_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI");
|
||||
assertEquals(2, rules.size());
|
||||
assertTrue(confirmEntries(rules));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromMvelYaml(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testYamlFile = "src/test/resources/test_mvel_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "MVEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertTrue(confirmEntries(rules));
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromSpelYaml(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testYamlFile = "src/test/resources/test_spel_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "SPEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromNiFiJson(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testJsonFile = "src/test/resources/test_nifi_rules.json";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "NIFI");
|
||||
assertEquals(2, rules.size());
|
||||
assertTrue(confirmEntries(rules));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromMvelJson(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testJsonFile = "src/test/resources/test_mvel_rules.json";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "MVEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
assertTrue(confirmEntries(rules));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromSpelJson(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testJsonFile = "src/test/resources/test_spel_rules.json";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testJsonFile, "JSON", "SPEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromStringSpelJson(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testJson = "[\n" +
|
||||
" {\n" +
|
||||
" \"name\": \"Queue Size\",\n" +
|
||||
" \"description\": \"Queue size check greater than 50\",\n" +
|
||||
" \"priority\": 1,\n" +
|
||||
" \"condition\": \"#predictedQueuedCount > 50\",\n" +
|
||||
" \"actions\": [\"#predictedQueuedCount + 'is large'\"]\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"name\": \"Time To Back Pressure\",\n" +
|
||||
" \"description\": \"Back pressure time less than 5 minutes\",\n" +
|
||||
" \"priority\": 2,\n" +
|
||||
" \"condition\": \"#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0\",\n" +
|
||||
" \"actions\": [\"'System is approaching backpressure! Predicted time left: ' + #predictedTimeToBytesBackpressureMillis\"]\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
List<Rule> rules = RulesFactory.createRulesFromString(testJson, "JSON", "SPEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateRulesFromStringSpelYaml(){
|
||||
assertDoesNotThrow(() -> {
|
||||
String testYaml = "---\n" +
|
||||
"name: \"Queue Size\"\n" +
|
||||
"description: \"Queue size check greater than 50\"\n" +
|
||||
"priority: 1\n" +
|
||||
"condition: \"#predictedQueuedCount > 50\"\n" +
|
||||
"actions:\n" +
|
||||
" - \"System.out.println(\\\"Queue Size Over 50 is detected!\\\")\"\n" +
|
||||
"---\n" +
|
||||
"name: \"Time To Back Pressure\"\n" +
|
||||
"description: \"Back pressure time less than 5 minutes\"\n" +
|
||||
"priority: 2\n" +
|
||||
"condition: \"#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0\"\n" +
|
||||
"actions:\n" +
|
||||
" - \"System.out.println(\\\"Back Pressure prediction less than 5 minutes!\\\")\"";
|
||||
List<Rule> rules = RulesFactory.createRulesFromString(testYaml, "YAML", "SPEL");
|
||||
assertEquals(2, rules.size());
|
||||
assertSame("EXPRESSION", rules.get(0).getActions().get(0).getType());
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFakeTypeNotSupported(){
|
||||
assertThrows(Exception.class,
|
||||
() -> RulesFactory.createRulesFromFile("FAKEFILE", "FAKE", "NIFI"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFakeFormatNotSupported(){
|
||||
assertThrows(Exception.class,
|
||||
() -> RulesFactory.createRulesFromFile("FAKEFILE", "JSON", "FAKE"));
|
||||
}
|
||||
|
||||
|
||||
private boolean confirmEntries(List<Rule> rules){
|
||||
Rule rule1= rules.get(0);
|
||||
Rule rule2 = rules.get(1);
|
||||
|
||||
boolean checkDiagnostic = rule1.getName().equals("Queue Size") && rule1.getDescription().equals("Queue size check greater than 50")
|
||||
&& rule1.getPriority() == 1 && rule1.getCondition().equals("predictedQueuedCount > 50");
|
||||
|
||||
checkDiagnostic = rule2.getName().equals("Time To Back Pressure") && rule2.getDescription().equals("Back pressure time less than 5 minutes")
|
||||
&& rule2.getPriority() == 2 && rule2.getCondition().equals("predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0") && checkDiagnostic;
|
||||
|
||||
return checkDiagnostic;
|
||||
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.rules.Action;
|
||||
import org.apache.nifi.rules.Rule;
|
||||
import org.apache.nifi.rules.RulesFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestEasyRulesEngine {
|
||||
|
||||
@Test
|
||||
public void testCheckRules() throws Exception {
|
||||
String testYamlFile = "src/test/resources/test_nifi_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI");
|
||||
final EasyRulesEngine service = new EasyRulesEngine("NIFI",true,false, rules);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",311111);
|
||||
Map<Rule, Boolean> checkedRules = service.checkRules(facts);
|
||||
assertNotNull(checkedRules);
|
||||
assertEquals(2,checkedRules.values().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFireRules() throws Exception {
|
||||
String testYamlFile = "src/test/resources/test_nifi_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI");
|
||||
final EasyRulesEngine service = new EasyRulesEngine("NIFI",true,false, rules);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(3,actions.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreErrorConditions() throws Exception {
|
||||
String testYamlFile = "src/test/resources/test_nifi_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI");
|
||||
final EasyRulesEngine service = new EasyRulesEngine("NIFI",false, false, rules);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressure",311111);
|
||||
assertThrows(Exception.class, () -> service.fireRules(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterRulesMissingFacts() throws Exception {
|
||||
String testYamlFile = "src/test/resources/test_nifi_rules.yml";
|
||||
List<Rule> rules = RulesFactory.createRulesFromFile(testYamlFile, "YAML", "NIFI");
|
||||
final EasyRulesEngine service = new EasyRulesEngine("NIFI",false, true, rules);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
Map<Rule, Boolean> checkedRules = service.checkRules(facts);
|
||||
assertEquals(1, checkedRules.size());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.apache.nifi.rules.Action;
|
||||
import org.apache.nifi.util.TestRunner;
|
||||
import org.apache.nifi.util.TestRunners;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
public class TestEasyRulesEngineProvider {
|
||||
|
||||
@Test
|
||||
public void testGetRulesEngine() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineProvider service = new MockEasyRulesEngineProvider();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules.yml");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "YAML");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
RulesEngine engine = service.getRulesEngine();
|
||||
assertNotNull(engine);
|
||||
List<Action> actions = engine.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 3);
|
||||
|
||||
}
|
||||
|
||||
private static class MockEasyRulesEngineProvider extends EasyRulesEngineProvider {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,351 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.reporting.InitializationException;
|
||||
import org.apache.nifi.rules.Action;
|
||||
import org.apache.nifi.util.TestRunner;
|
||||
import org.apache.nifi.util.TestRunners;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class TestEasyRulesEngineService {
|
||||
|
||||
@Test
|
||||
public void testYamlNiFiRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules.yml");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "YAML");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYamlMvelRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_mvel_rules.yml");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "YAML");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "MVEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYamlSpelRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_spel_rules.yml");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "YAML");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "SPEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonNiFiRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonMvelRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_mvel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "MVEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonSpelRules() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_spel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "SPEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJsonSpelRulesAsString() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
String testRules = "[\n" +
|
||||
" {\n" +
|
||||
" \"name\": \"Queue Size\",\n" +
|
||||
" \"description\": \"Queue size check greater than 50\",\n" +
|
||||
" \"priority\": 1,\n" +
|
||||
" \"condition\": \"#predictedQueuedCount > 50\",\n" +
|
||||
" \"actions\": [\"#predictedQueuedCount + 'is large'\"]\n" +
|
||||
" },\n" +
|
||||
" {\n" +
|
||||
" \"name\": \"Time To Back Pressure\",\n" +
|
||||
" \"description\": \"Back pressure time less than 5 minutes\",\n" +
|
||||
" \"priority\": 2,\n" +
|
||||
" \"condition\": \"#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0\",\n" +
|
||||
" \"actions\": [\"'System is approaching backpressure! Predicted time left: ' + #predictedTimeToBytesBackpressureMillis\"]\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_BODY, testRules);
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "SPEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testYamlMvelRulesAsString() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
String testYaml = "---\n" +
|
||||
"name: \"Queue Size\"\n" +
|
||||
"description: \"Queue size check greater than 50\"\n" +
|
||||
"priority: 1\n" +
|
||||
"condition: \"predictedQueuedCount > 50\"\n" +
|
||||
"actions:\n" +
|
||||
" - \"System.out.println(\\\"Queue Size Over 50 is detected!\\\")\"\n" +
|
||||
"---\n" +
|
||||
"name: \"Time To Back Pressure\"\n" +
|
||||
"description: \"Back pressure time less than 5 minutes\"\n" +
|
||||
"priority: 2\n" +
|
||||
"condition: \"predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0\"\n" +
|
||||
"actions:\n" +
|
||||
" - \"System.out.println(\\\"Back Pressure prediction less than 5 minutes!\\\")\"";
|
||||
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_BODY, testYaml);
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "YAML");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "MVEL");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsFalseNIFI() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"false");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("fakeMetric",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
assertThrows(Exception.class, () -> service.fireRules(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsTrueNIFI() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"true");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("fakeMetric",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
assertDoesNotThrow(() -> {
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsFalseMVEL() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_mvel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "MVEL");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"false");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("fakeMetric",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
assertThrows(Exception.class, () -> service.fireRules(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsTrueMVEL() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_mvel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "MVEL");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"true");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("fakeMetric",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
assertDoesNotThrow(() -> {
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsFalseSPEL() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_bad_spel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "SPEL");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"false");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("fakeMetric",60);
|
||||
facts.put("fakeMetric2",299999);
|
||||
assertThrows(Exception.class, () -> service.fireRules(facts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIgnoreConditionErrorsTrueSPEL() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_bad_spel_rules.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "SPEL");
|
||||
runner.setProperty(service,EasyRulesEngineService.IGNORE_CONDITION_ERRORS,"true");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
facts.put("predictedTimeToBytesBackpressureMillis",299999);
|
||||
|
||||
assertDoesNotThrow(() -> {
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 1);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFilterRulesMissingFactsTrue() throws InitializationException, IOException {
|
||||
final TestRunner runner = TestRunners.newTestRunner(TestProcessor.class);
|
||||
final RulesEngineService service = new MockEasyRulesEngineService();
|
||||
runner.addControllerService("easy-rules-engine-service-test",service);
|
||||
runner.setProperty(service, EasyRulesEngineService.RULES_FILE_PATH, "src/test/resources/test_nifi_rules_filter.json");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_TYPE, "JSON");
|
||||
runner.setProperty(service,EasyRulesEngineService.RULES_FILE_FORMAT, "NIFI");
|
||||
runner.setProperty(service,EasyRulesEngineService.FILTER_RULES_MISSING_FACTS, "true");
|
||||
runner.enableControllerService(service);
|
||||
runner.assertValid(service);
|
||||
Map<String, Object> facts = new HashMap<>();
|
||||
facts.put("predictedQueuedCount",60);
|
||||
List<Action> actions = service.fireRules(facts);
|
||||
assertNotNull(actions);
|
||||
assertEquals(actions.size(), 1);
|
||||
}
|
||||
|
||||
private static class MockEasyRulesEngineService extends EasyRulesEngineService {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You 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.
|
||||
*/
|
||||
package org.apache.nifi.rules.engine;
|
||||
|
||||
import org.apache.nifi.components.PropertyDescriptor;
|
||||
import org.apache.nifi.processor.AbstractProcessor;
|
||||
import org.apache.nifi.processor.ProcessContext;
|
||||
import org.apache.nifi.processor.ProcessSession;
|
||||
import org.apache.nifi.processor.exception.ProcessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestProcessor extends AbstractProcessor {
|
||||
|
||||
@Override
|
||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<PropertyDescriptor> getSupportedPropertyDescriptors() {
|
||||
List<PropertyDescriptor> properties = new ArrayList<>();
|
||||
properties.add(new PropertyDescriptor.Builder()
|
||||
.name("easy-rules-engine-service-test")
|
||||
.description("Easy Rules Engine Service")
|
||||
.identifiesControllerService(EasyRulesEngineService.class)
|
||||
.required(true)
|
||||
.build());
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "Queue Size",
|
||||
"description": "Queue size check greater than 50",
|
||||
"priority": 1,
|
||||
"condition": "#predictedQueuedCount > 50",
|
||||
"actions": ["#predictedQueuedCount + 'is large'"]
|
||||
},
|
||||
{
|
||||
"name": "Time To Back Pressure",
|
||||
"description": "Back pressure time less than 5 minutes",
|
||||
"priority": 2,
|
||||
"condition": "predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0",
|
||||
"actions": ["'System is approaching backpressure! Predicted time left: ' + #predictedTimeToBytesBackpressureMillis"]
|
||||
}
|
||||
]
|
|
@ -1,16 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "Queue Size",
|
||||
"description": "Queue size check greater than 50",
|
||||
"priority": 1,
|
||||
"condition": "predictedQueuedCount > 50",
|
||||
"actions": ["System.out.println(\"Queue Size Over 50 is detected!\")"]
|
||||
},
|
||||
{
|
||||
"name": "Time To Back Pressure",
|
||||
"description": "Back pressure time less than 5 minutes",
|
||||
"priority": 2,
|
||||
"condition": "predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0",
|
||||
"actions": ["System.out.println(\"Back Pressure prediction less than 5 minutes!\")"]
|
||||
}
|
||||
]
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
name: "Queue Size"
|
||||
description: "Queue size check greater than 50"
|
||||
priority: 1
|
||||
condition: "predictedQueuedCount > 50"
|
||||
actions:
|
||||
- "System.out.println(\"Queue Size Over 50 is detected!\")"
|
||||
---
|
||||
name: "Time To Back Pressure"
|
||||
description: "Back pressure time less than 5 minutes"
|
||||
priority: 2
|
||||
condition: "predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0"
|
||||
actions:
|
||||
- "System.out.println(\"Back Pressure prediction less than 5 minutes!\")"
|
|
@ -1,34 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "Queue Size",
|
||||
"description": "Queue size check greater than 50",
|
||||
"priority": 1,
|
||||
"condition": "predictedQueuedCount > 50",
|
||||
"actions": [
|
||||
{
|
||||
"type": "LOG",
|
||||
"attributes": {
|
||||
"logLevel": "debug",
|
||||
"message": "Queue Size Over 50 is detected!"
|
||||
}
|
||||
}
|
||||
],
|
||||
"facts": ["predictedQueuedCount"]
|
||||
},
|
||||
{
|
||||
"name": "Time To Back Pressure",
|
||||
"description": "Back pressure time less than 5 minutes",
|
||||
"priority": 2,
|
||||
"condition": "predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0",
|
||||
"actions": [
|
||||
{
|
||||
"type": "LOG",
|
||||
"attributes": {
|
||||
"logLevel": "warn",
|
||||
"message": "Back Pressure prediction less than 5 minutes!"
|
||||
}
|
||||
}
|
||||
],
|
||||
"facts":["predictedTimeToBytesBackpressureMillis"]
|
||||
}
|
||||
]
|
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
name: "Queue Size"
|
||||
description: "Queue size check greater than 50"
|
||||
priority: 1
|
||||
condition: "predictedQueuedCount > 50"
|
||||
actions:
|
||||
- type: "LOG"
|
||||
attributes:
|
||||
logLevel: "DEBUG"
|
||||
message: "Queue Size Over 50 is detected!"
|
||||
facts:
|
||||
- "predictedQueuedCount"
|
||||
---
|
||||
name: "Time To Back Pressure"
|
||||
description: "Back pressure time less than 5 minutes"
|
||||
priority: 2
|
||||
condition: "predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0"
|
||||
actions:
|
||||
- type: "LOG"
|
||||
attributes:
|
||||
logLevel: "INFO"
|
||||
message: "Back Pressure prediction less than 5 minutes!"
|
||||
- type: "ALERT"
|
||||
attributes:
|
||||
severity: "INFO"
|
||||
message: "Back Pressure prediction less than 5 minutes!"
|
||||
facts:
|
||||
- "predictedTimeToBytesBackpressureMillis"
|
|
@ -1,34 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "Queue Size",
|
||||
"description": "Queue size check greater than 50",
|
||||
"priority": 1,
|
||||
"condition": "predictedQueuedCount > 50",
|
||||
"actions": [
|
||||
{
|
||||
"type": "LOG",
|
||||
"attributes": {
|
||||
"logLevel": "debug",
|
||||
"message": "Queue Size Over 50 is detected!"
|
||||
}
|
||||
}
|
||||
],
|
||||
"facts": ["predictedQueuedCount"]
|
||||
},
|
||||
{
|
||||
"name": "Time To Back Pressure",
|
||||
"description": "Back pressure time less than 5 minutes",
|
||||
"priority": 2,
|
||||
"condition": "predictedTimeToBytesBackpressureMillis < 300000 && predictedTimeToBytesBackpressureMillis >= 0",
|
||||
"actions": [
|
||||
{
|
||||
"type": "LOG",
|
||||
"attributes": {
|
||||
"logLevel": "warn",
|
||||
"message": "Back Pressure prediction less than 5 minutes!"
|
||||
}
|
||||
}
|
||||
],
|
||||
"facts":["predictedTimeToBytesBackpressureMillis"]
|
||||
}
|
||||
]
|
|
@ -1,16 +0,0 @@
|
|||
[
|
||||
{
|
||||
"name": "Queue Size",
|
||||
"description": "Queue size check greater than 50",
|
||||
"priority": 1,
|
||||
"condition": "#predictedQueuedCount > 50",
|
||||
"actions": ["#predictedQueuedCount + 'is large'"]
|
||||
},
|
||||
{
|
||||
"name": "Time To Back Pressure",
|
||||
"description": "Back pressure time less than 5 minutes",
|
||||
"priority": 2,
|
||||
"condition": "#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0",
|
||||
"actions": ["'System is approaching backpressure! Predicted time left: ' + #predictedTimeToBytesBackpressureMillis"]
|
||||
}
|
||||
]
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
name: "Queue Size"
|
||||
description: "Queue size check greater than 50"
|
||||
priority: 1
|
||||
condition: "#predictedQueuedCount > 50"
|
||||
actions:
|
||||
- "System.out.println(\"Queue Size Over 50 is detected!\")"
|
||||
---
|
||||
name: "Time To Back Pressure"
|
||||
description: "Back pressure time less than 5 minutes"
|
||||
priority: 2
|
||||
condition: "#predictedTimeToBytesBackpressureMillis < 300000 && #predictedTimeToBytesBackpressureMillis >= 0"
|
||||
actions:
|
||||
- "System.out.println(\"Back Pressure prediction less than 5 minutes!\")"
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<parent>
|
||||
<artifactId>nifi-nar-bundles</artifactId>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>nifi-easyrules-bundle</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>nifi-easyrules-service</module>
|
||||
<module>nifi-easyrules-nar</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
<artifactId>nifi-easyrules-service</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
|
@ -95,7 +95,6 @@
|
|||
<module>nifi-jolt-record-bundle</module>
|
||||
<module>nifi-network-bundle</module>
|
||||
<module>nifi-prometheus-bundle</module>
|
||||
<module>nifi-easyrules-bundle</module>
|
||||
<module>nifi-sql-reporting-bundle</module>
|
||||
<module>nifi-rules-action-handler-bundle</module>
|
||||
<module>nifi-hazelcast-bundle</module>
|
||||
|
|
Loading…
Reference in New Issue