From 1ebc0b40d5e2d62488862e0745d02d0dfd259e40 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Sun, 10 May 2020 11:31:51 +0200 Subject: [PATCH] Move RuleDefinitionReader + related classes to a dedicated package --- .../src/main/java/org/jeasy/rules/mvel/MVELRuleFactory.java | 6 +++++- .../java/org/jeasy/rules/mvel/MVELJsonRuleFactoryTest.java | 2 +- .../java/org/jeasy/rules/mvel/MVELYamlRuleFactoryTest.java | 2 +- .../src/main/java/org/jeasy/rules/spel/SpELRuleFactory.java | 6 +++++- .../java/org/jeasy/rules/spel/SpELJsonRuleFactoryTest.java | 2 +- .../java/org/jeasy/rules/spel/SpELYamlRuleFactoryTest.java | 2 +- .../main/java/org/jeasy/rules/support/RuleDefinition.java | 2 +- .../support/{ => reader}/AbstractRuleDefinitionReader.java | 3 ++- .../support/{ => reader}/JsonRuleDefinitionReader.java | 2 +- .../rules/support/{ => reader}/RuleDefinitionReader.java | 4 +++- .../support/{ => reader}/YamlRuleDefinitionReader.java | 2 +- .../support/{ => reader}/JsonRuleDefinitionReaderTest.java | 3 ++- .../support/{ => reader}/YamlRuleDefinitionReaderTest.java | 3 ++- .../main/java/org/jeasy/rules/tutorials/shop/Launcher.java | 2 +- 14 files changed, 27 insertions(+), 14 deletions(-) rename easy-rules-support/src/main/java/org/jeasy/rules/support/{ => reader}/AbstractRuleDefinitionReader.java (98%) rename easy-rules-support/src/main/java/org/jeasy/rules/support/{ => reader}/JsonRuleDefinitionReader.java (98%) rename easy-rules-support/src/main/java/org/jeasy/rules/support/{ => reader}/RuleDefinitionReader.java (95%) rename easy-rules-support/src/main/java/org/jeasy/rules/support/{ => reader}/YamlRuleDefinitionReader.java (98%) rename easy-rules-support/src/test/java/org/jeasy/rules/support/{ => reader}/JsonRuleDefinitionReaderTest.java (99%) rename easy-rules-support/src/test/java/org/jeasy/rules/support/{ => reader}/YamlRuleDefinitionReaderTest.java (99%) diff --git a/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRuleFactory.java b/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRuleFactory.java index 5ec2dc9..944693f 100644 --- a/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRuleFactory.java +++ b/easy-rules-mvel/src/main/java/org/jeasy/rules/mvel/MVELRuleFactory.java @@ -25,7 +25,11 @@ package org.jeasy.rules.mvel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; -import org.jeasy.rules.support.*; +import org.jeasy.rules.support.AbstractRuleFactory; +import org.jeasy.rules.support.RuleDefinition; +import org.jeasy.rules.support.reader.JsonRuleDefinitionReader; +import org.jeasy.rules.support.reader.RuleDefinitionReader; +import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import org.mvel2.ParserContext; import java.io.Reader; diff --git a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELJsonRuleFactoryTest.java b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELJsonRuleFactoryTest.java index 9d93c95..fc85c2b 100644 --- a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELJsonRuleFactoryTest.java +++ b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELJsonRuleFactoryTest.java @@ -25,7 +25,7 @@ package org.jeasy.rules.mvel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; -import org.jeasy.rules.support.JsonRuleDefinitionReader; +import org.jeasy.rules.support.reader.JsonRuleDefinitionReader; import org.jeasy.rules.support.UnitRuleGroup; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELYamlRuleFactoryTest.java b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELYamlRuleFactoryTest.java index 7c24347..a863e4d 100644 --- a/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELYamlRuleFactoryTest.java +++ b/easy-rules-mvel/src/test/java/org/jeasy/rules/mvel/MVELYamlRuleFactoryTest.java @@ -25,7 +25,7 @@ package org.jeasy.rules.mvel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; -import org.jeasy.rules.support.YamlRuleDefinitionReader; +import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import org.jeasy.rules.support.UnitRuleGroup; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/easy-rules-spel/src/main/java/org/jeasy/rules/spel/SpELRuleFactory.java b/easy-rules-spel/src/main/java/org/jeasy/rules/spel/SpELRuleFactory.java index b3ba524..eb7dff3 100644 --- a/easy-rules-spel/src/main/java/org/jeasy/rules/spel/SpELRuleFactory.java +++ b/easy-rules-spel/src/main/java/org/jeasy/rules/spel/SpELRuleFactory.java @@ -25,7 +25,11 @@ package org.jeasy.rules.spel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; -import org.jeasy.rules.support.*; +import org.jeasy.rules.support.AbstractRuleFactory; +import org.jeasy.rules.support.RuleDefinition; +import org.jeasy.rules.support.reader.JsonRuleDefinitionReader; +import org.jeasy.rules.support.reader.RuleDefinitionReader; +import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import org.springframework.expression.BeanResolver; import org.springframework.expression.ParserContext; diff --git a/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELJsonRuleFactoryTest.java b/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELJsonRuleFactoryTest.java index 8546c1e..51162c1 100644 --- a/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELJsonRuleFactoryTest.java +++ b/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELJsonRuleFactoryTest.java @@ -25,7 +25,7 @@ package org.jeasy.rules.spel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; -import org.jeasy.rules.support.JsonRuleDefinitionReader; +import org.jeasy.rules.support.reader.JsonRuleDefinitionReader; import org.jeasy.rules.support.UnitRuleGroup; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELYamlRuleFactoryTest.java b/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELYamlRuleFactoryTest.java index c8c0f8c..77f1588 100644 --- a/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELYamlRuleFactoryTest.java +++ b/easy-rules-spel/src/test/java/org/jeasy/rules/spel/SpELYamlRuleFactoryTest.java @@ -26,7 +26,7 @@ package org.jeasy.rules.spel; import org.jeasy.rules.api.Rule; import org.jeasy.rules.api.Rules; import org.jeasy.rules.support.UnitRuleGroup; -import org.jeasy.rules.support.YamlRuleDefinitionReader; +import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import org.junit.Test; import org.junit.rules.ExpectedException; diff --git a/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinition.java b/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinition.java index ca8fdb1..89a1ece 100644 --- a/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinition.java +++ b/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinition.java @@ -32,7 +32,7 @@ import java.util.List; * Rule definition as defined in a rule descriptor. * This class encapsulates the static definition of a {@link Rule}. * - * A rule definition is produced by a {@link RuleDefinitionReader} + * A rule definition is produced by a {@code RuleDefinitionReader} * and consumed by rule factories to create rules. * * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com) diff --git a/easy-rules-support/src/main/java/org/jeasy/rules/support/AbstractRuleDefinitionReader.java b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/AbstractRuleDefinitionReader.java similarity index 98% rename from easy-rules-support/src/main/java/org/jeasy/rules/support/AbstractRuleDefinitionReader.java rename to easy-rules-support/src/main/java/org/jeasy/rules/support/reader/AbstractRuleDefinitionReader.java index eb0183f..820fd76 100644 --- a/easy-rules-support/src/main/java/org/jeasy/rules/support/AbstractRuleDefinitionReader.java +++ b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/AbstractRuleDefinitionReader.java @@ -21,9 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import org.jeasy.rules.api.Rule; +import org.jeasy.rules.support.RuleDefinition; import java.io.Reader; import java.util.ArrayList; diff --git a/easy-rules-support/src/main/java/org/jeasy/rules/support/JsonRuleDefinitionReader.java b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReader.java similarity index 98% rename from easy-rules-support/src/main/java/org/jeasy/rules/support/JsonRuleDefinitionReader.java rename to easy-rules-support/src/main/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReader.java index cf36457..886c578 100644 --- a/easy-rules-support/src/main/java/org/jeasy/rules/support/JsonRuleDefinitionReader.java +++ b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReader.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinitionReader.java b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/RuleDefinitionReader.java similarity index 95% rename from easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinitionReader.java rename to easy-rules-support/src/main/java/org/jeasy/rules/support/reader/RuleDefinitionReader.java index 68d660b..a550d57 100644 --- a/easy-rules-support/src/main/java/org/jeasy/rules/support/RuleDefinitionReader.java +++ b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/RuleDefinitionReader.java @@ -21,11 +21,13 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import java.io.Reader; import java.util.List; +import org.jeasy.rules.support.RuleDefinition; + /** * Strategy interface for {@link RuleDefinition} readers. * diff --git a/easy-rules-support/src/main/java/org/jeasy/rules/support/YamlRuleDefinitionReader.java b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReader.java similarity index 98% rename from easy-rules-support/src/main/java/org/jeasy/rules/support/YamlRuleDefinitionReader.java rename to easy-rules-support/src/main/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReader.java index 8296d18..dbc5ee3 100644 --- a/easy-rules-support/src/main/java/org/jeasy/rules/support/YamlRuleDefinitionReader.java +++ b/easy-rules-support/src/main/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReader.java @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import org.yaml.snakeyaml.Yaml; diff --git a/easy-rules-support/src/test/java/org/jeasy/rules/support/JsonRuleDefinitionReaderTest.java b/easy-rules-support/src/test/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReaderTest.java similarity index 99% rename from easy-rules-support/src/test/java/org/jeasy/rules/support/JsonRuleDefinitionReaderTest.java rename to easy-rules-support/src/test/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReaderTest.java index 0e10563..85739a6 100644 --- a/easy-rules-support/src/test/java/org/jeasy/rules/support/JsonRuleDefinitionReaderTest.java +++ b/easy-rules-support/src/test/java/org/jeasy/rules/support/reader/JsonRuleDefinitionReaderTest.java @@ -21,9 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import org.jeasy.rules.api.Rule; +import org.jeasy.rules.support.RuleDefinition; import org.junit.Test; import java.io.File; diff --git a/easy-rules-support/src/test/java/org/jeasy/rules/support/YamlRuleDefinitionReaderTest.java b/easy-rules-support/src/test/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReaderTest.java similarity index 99% rename from easy-rules-support/src/test/java/org/jeasy/rules/support/YamlRuleDefinitionReaderTest.java rename to easy-rules-support/src/test/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReaderTest.java index d560eb4..09134d2 100644 --- a/easy-rules-support/src/test/java/org/jeasy/rules/support/YamlRuleDefinitionReaderTest.java +++ b/easy-rules-support/src/test/java/org/jeasy/rules/support/reader/YamlRuleDefinitionReaderTest.java @@ -21,9 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -package org.jeasy.rules.support; +package org.jeasy.rules.support.reader; import org.jeasy.rules.api.Rule; +import org.jeasy.rules.support.RuleDefinition; import org.junit.Test; import java.io.File; diff --git a/easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/Launcher.java b/easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/Launcher.java index 06d3bda..1f1d95d 100644 --- a/easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/Launcher.java +++ b/easy-rules-tutorials/src/main/java/org/jeasy/rules/tutorials/shop/Launcher.java @@ -30,7 +30,7 @@ import org.jeasy.rules.api.RulesEngine; import org.jeasy.rules.core.DefaultRulesEngine; import org.jeasy.rules.mvel.MVELRule; import org.jeasy.rules.mvel.MVELRuleFactory; -import org.jeasy.rules.support.YamlRuleDefinitionReader; +import org.jeasy.rules.support.reader.YamlRuleDefinitionReader; import java.io.FileReader;