Skip to content

Commit

Permalink
MIGENG-45 Business Rules Implementation - Process and standards (#4)
Browse files Browse the repository at this point in the history
* MIGENG-45 Added new data models and first agenda groups

* Batch mode

* Batch mode

* {/project.repositories}

* Batch mode

* {/project.repositories}

* MIGENG-45 Changed pom.xml spacing

* MIGENG-45 Removed lombok from PricingDataModel

* MIGENG-45 Removed lombok from package-names-white-list and pom.xml

* MIGENG-45 New package,beans and rules

* MIGENG-45 Updated GAV coordinates

* delete {/src/test/resources/com/myspace/sample_analytics/test/LegacySpreadsheetTest.scenario}

* MIGENG-45 Created tests folder

* delete {/src/test/resources/org/jboss/xavier/analytics/test/PricingTestTMP.scesim}

* New package [test]

* {/src/test/resources/org/jboss/xavier/analytics/test/EnvironmentTest.scenario}

* MIGENG-45 Renamed input bean coming from upload form

* MIGENG-45 Removed sample_analytics resources

* MIGENG-45 Added Environment (legacy) test

* New package [scenario]

* {/src/test/resources/EnvironmentTestScenario.scesim}

* {/src/test/resources/EnvironmentTestScenario.scesim}

* {/src/test/resources/EnvironmentTestScenario.scesim}

* MIGENG-45 Added runnable test scenario {/src/test/resources/EnvironmentTestScenario.scesim}

* delete {/src/test/resources/EnvironmentTestScenario.scesim}

* MIGENG-45 Removed agenda group from Environment rules {/src/main/resources/org/jboss/xavier/analytics/rules/Environment.drl}

* MIGENG-45 Added no-args constructor to PricingDataModel

* MIGENG-45 Added EnvironmentTest WIP

* {/src/main/resources/PricingRule.xlsx}

* Uploaded 24-Jun-2019 13:16:22 {/src/main/resources/PricingRule.xlsx}

* delete {/src/main/resources/PricingRule.xlsx}

* {/src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.xlsx}

* Uploaded 24-Jun-2019 14:36:36 {/src/main/resources/org/jboss/xavier/analytics/rules/PricingRule.xlsx}

* MIGENG-45 First rule sets and tests workflow

* MIGENG-45 Fixed the SourceCosts.drl URL

* MIGENG-45 Restored the 'com.myspace.sample_analytics' code of the prototype

* MIGENG-45 Refactored InitialSavingsEstimationReportModel bean and hence updated rules and tests
  • Loading branch information
mrizzi authored Jun 26, 2019
1 parent 5ee3054 commit a8d2137
Show file tree
Hide file tree
Showing 38 changed files with 2,801 additions and 99 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
# xavier-analytics
# xavier-analytics

## How to create a new rule set for an agenda group with test
The procedure describes how to create a rule set for the agenda group `FooAgendaGroup`
1. create a copy of [SourceCosts.drl](src/main/resources/org/jboss/xavier/analytics/rules/SourceCosts.drl) with name `FooAgendaGroup.drl` within the `org.jboss.xavier.analytics.rules` package
1. in the `FooAgendaGroup.drl` file:
1. change the `agenda-group` value to become `FooAgendaGroup`
1. change the `rule` ID value to something like `FooAgendaGroupRules` (i.e. `rule "FooAgendaGroupRules"`)
1. create a copy of [SourceCostsTest.java](src/test/java/org/jboss/xavier/analytics/test/SourceCostsTest.java) with name `FooAgendaGroupTest.java` within the `org.jboss.xavier.analytics.test` package
1. change the constructor to reference the `FooAgendaGroup.drl` file instead of `SourceCosts.drl` (i.e. `super("/org/jboss/xavier/analytics/rules/FooAgendaGroup.drl", ResourceType.DRL);`)
1. change the `agendaGroup` to reference the `FooAgendaGroup` agenda group (i.e. `facts.put("agendaGroup", "FooAgendaGroup");`)
1. run the `mvn -gs ./configuration/settings.xml test -Dtest=FooAgendaGroupTest` to check that everything works fine

Now you have a working rule set with a test and you can start developing the rules keeping updated the test.

## How to interact locally with OKD
1. Follow the "[Installation](https://github.com/project-xavier/xavier-integration#installation)" procedure from [xavier-integration](https://github.com/project-xavier/xavier-integration) project with one difference, use your own fork URL (e.g. `https://github.com/mrizzi/xavier-analytics.git`) instead of using `https://github.com/project-xavier/xavier-analytics.git` in the [Decision Manager](https://github.com/project-xavier/xavier-integration#decision-manager) section
1. go to `Settings` page in Business Central project
1. copy the `ssh` URL (e.g. `ssh://analytics-rhdmcentr-2-9ws6w:8001/MySpace/xavier-analytics`)
1. from your local terminal, login to the local OKD instance as `developer` and switch to use the migration analytics project
1. `oc port-forward ` `oc get pod | grep "^analytics-rhdmcentr" | awk '{print $1}'`` 8001:8001`
1. from your `xavier-analytics` project root folder, execute `git remote add remote-dm ssh://adminUser@localhost:8001/MySpace/xavier-analytics` replacing the remote host's name (e.g. `analytics-rhdmcentr-2-9ws6w`) with `localhost`
1. retrieve the code from Decision Manager Business Central using `git pull remote-dm MIGENG-45`
123 changes: 123 additions & 0 deletions configuration/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2005-2016 Red Hat, Inc.
Red Hat 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.
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

<profiles>
<profile>
<id>fuse.repos</id>

<repositories>

<repository>
<id>maven.central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>


<repository>
<id>redhat.ga</id>
<name>Red Hat General Availability Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>


<repository>
<id>redhat.ea</id>
<name>Red Hat Early Access Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</repository>

</repositories>

<pluginRepositories>

<pluginRepository>
<id>maven.central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>


<pluginRepository>
<id>redhat.ga</id>
<name>Red Hat General Availability Repository</name>
<url>https://maven.repository.redhat.com/ga</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>


<pluginRepository>
<id>redhat.ea</id>
<name>Red Hat Early Access Repository</name>
<url>https://maven.repository.redhat.com/earlyaccess/all</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>

</pluginRepositories>
</profile>
</profiles>

<activeProfiles>
<activeProfile>fuse.repos</activeProfile>
</activeProfiles>

</settings>
224 changes: 132 additions & 92 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,95 +1,135 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myspace</groupId>
<artifactId>sample-analytics</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>kjar</packaging>
<name>sample-analytics</name>
<description></description>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-jaxb</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-wb-scenario-simulation-editor-api</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-wb-scenario-simulation-editor-backend</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-feel</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-api</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-core</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>7.18.0.Final-redhat-00002</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.xavier</groupId>
<artifactId>xavier-analytics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>kjar</packaging>
<name>Xavier Analytics</name>
<description></description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<rhdm.version>7.18.0.Final-redhat-00002</rhdm.version>
</properties>
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-internal</artifactId>
<version>${rhdm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>${rhdm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-jaxb</artifactId>
<version>${rhdm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>${rhdm.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-wb-scenario-simulation-editor-api</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-wb-scenario-simulation-editor-backend</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-feel</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-api</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-dmn-core</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-canonical-model</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-model-compiler</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>${rhdm.version}</version>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.kie</groupId>
<artifactId>kie-maven-plugin</artifactId>
<version>${rhdm.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit a8d2137

Please sign in to comment.