Skip to content

Commit

Permalink
Updating to dm78 and adding a simple dmn (#11)
Browse files Browse the repository at this point in the history
* updating rhdm7 niogit folder + updating init properties files

* bumping to dm78

* updating project in the niogit folder

* updating readme to match the new version of the demo project

* adding more images to the readme

Authored-by: kmacedovarela@gmail.com <kvarela@redhat.com>
  • Loading branch information
kmacedovarela authored Oct 23, 2020
1 parent 8f5a1d5 commit 827b740
Show file tree
Hide file tree
Showing 315 changed files with 180 additions and 151 deletions.
186 changes: 113 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ using it from an application through the REST API that is exposed by the server.

There are three options for you to install this project: local, OpenShift and Docker

Software
--------
## Software

The following software is required to run this demo:
- [JBoss EAP 7.2 zip](https://developers.redhat.com/download-manager/file/jboss-eap-7.2.0.zip)
- [Red Hat Decision Manager 7.7.0.GA Decision Central deployable for EAP 7](https://developers.redhat.com/download-manager/file/rhdm-7.7.0-decision-central-eap7-deployable.zip)
- [Red Hat Decision Manager: KIE-Server 7.7.0.GA deployable for EE8](https://developers.redhat.com/download-manager/file/rhdm-7.7.0-kie-server-ee8.zip)
- [JBoss EAP 7.3 zip](https://developers.redhat.com/download-manager/file/jboss-eap-7.3.0.zip)
- [Red Hat Decision Manager 7.8.0.GA Decision Central deployable for EAP 7](https://developers.redhat.com/download-manager/file/rhdm-7.7.0-decision-central-eap7-deployable.zip)
- [Red Hat Decision Manager: KIE-Server 7.8.0.GA deployable for EE8](https://developers.redhat.com/download-manager/file/rhdm-7.8.0-kie-server-ee8.zip)
- [7-Zip](http://www.7-zip.org/download.html) (Windows only): to overcome the Windows 260 character path length limit, we need 7-Zip to unzip the Decision Manager deployable.

Option 1 - Install on your machine
----------------------------------
1. [Download and unzip.](https://github.com/jbossdemocentral/rhdm7-loan-demo/archive/master.zip) or [clone this repo](https://github.com/jbossdemocentral/rhdm7-loan-demo.git).
## Install and run on your machine

1. [Download and unzip](https://github.com/jbossdemocentral/rhdm7-loan-demo/archive/master.zip) or [clone this repo](https://github.com/jbossdemocentral/rhdm7-loan-demo.git).

2. Add the product ZIP files to the installs directory.

Expand All @@ -29,81 +29,118 @@ Option 1 - Install on your machine
```
- login for admin and analyst roles (u:dmAdmin / p:redhatdm1!)
```
6. Import the loan-application project located at https://github.com/jbossdemocentral/rhdm7-loan-demo-repo. Then, click on the "loan-application" project to open the Loan Application Demo project.
7. The project has simple data model (Loan & Applicant) and single decision table (loan-application) which contains the loan approval rule set.
## Running the demo
1. You should already see the loan-application. If not, you can import it from https://github.com/jbossdemocentral/rhdm7-loan-demo-repo.
8. Build and deploy version 1.1.0 of the project. Click on the "Build and Deploy" in the upper right corner.
7. Click on the "loan-application" project to open the Loan Application Demo project.
9. Go to "Menu -> Deploy -> Execution Servers" repository to see the loan-application_1.1.0 KIE Container deployed on the Decision Server.
8. The project has simple some data model (Loan, Applicant, Reservation), a single decision table (loan-application) which contains the loan approval rule set and a DMN model (reservation) that provides a recomendation based on the credit score.
10. The Decision Server provides a Swagger UI that documents the full RESTful interface exposed by the server at: http://localhost:8080/kie-server/docs
9. Build and deploy version 1.2.0 of the project. Click on the "Build and Deploy" in the upper right corner.
11. In the Swagger UI:
10. Go to "Menu -> Deploy -> Execution Servers" repository to see the loan-application_1.2.0 KIE Container deployed on the Decision Server.
11. The Decision Server provides a Swagger UI that documents the full RESTful interface exposed by the server at: http://localhost:8080/kie-server/docs
12. In the Swagger UI:
- navigate to "KIE Server and KIE containers"
- expand the "GET" operation for resource "/server/containers"
- click on "Try it out"
- leave the parameters blank and click on "Execute"
- when asked for credentials use: Username: kieserver, Password: kieserver1!
- observe the response, which lists the KIE Containers deployed on the server and their status (STARTED, STOPPED).
12. We can use the Swagger UI to test our Loan Approval Decision Service. In the Swagger UI:
- navigate to "KIE session assets"
- expand the "POST" operation for resource "/server/containers/instances/{id}"
- click on "Try it out"
- set the "id" parameter to the name of the KIE Container that hosts our rules, in this case `loan-application_1.1.0`.
- set "Parameter content type" to `application/json`.
- set "Response content type" to `application/json`
- use the following request as the "body" parameter. Note that the `Loan` object has its `approved` attribute set to `false`:
{
"lookup": "default-stateless-ksession",
"commands": [
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Applicant": {
"creditScore": 230,
"name": "Jim Whitehurst"
}
},
"out-identifier": "applicant"
}
},
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Loan": {
"amount": 2500,
"approved": false,
"duration": 24,
"interestRate": 1.5
}
},
"out-identifier": "loan"
}
},
{
"fire-all-rules": {}
},
{
"get-objects": {
"out-identifier": "objects"
}
},
{
"dispose": {}
}
]
}
- observe the result. The Loan Application rules have fired and determined that, based on the credit score of the application, and the amount of the loan, the loan can be approved. The `approved` attribute of the `Loan` has been set to `true`.
13. You can change the decision table as desired, change the version of the project, and redeploy a new version to a new KIE Container (allowing you to serve multiple versions of the same rule set at the same time on the same Decision Server). You can also build a new version of the project and use the Version Configuration tab of the container definition (in the Execution Servers screen) to manage the container using the UPGRADE button to pull the new version.
Option 2 - Run on OpenShift
12. We can use the Swagger UI to test our Loan Approval Decision Service. In the Swagger UI.
### Consuming the decision services via REST:
#### **Testing the decisions implemented with DMN:**
To test the rule execution on the kieserver:
1. Open the Swagger UI : `http://localhost:8080/kie-server/docs`
2. In the KIE Server Swagger UI, navigate to the "DMN Assets" section and locate the POST "/server/containers/{containerId}/dmn" item.
1. ContainerID: loan-application_1.2.0
2. Change the "Parameter content type" and the "response content type" to "application/json"
3. Body:
```
{
"model-namespace" : "https://kiegroup.org/dmn/_C159F266-40FF-49CB-B4D9-447DFACDDC16",
"model-name" : "recommendation",
"decision-name" : [ ],
"decision-id" : [ ],
"dmn-context" : {"Credit Score": 250}
}
```
#### **Testing the business rules implemented with the guided decision table:**
To test the rule execution on the kieserver:
1. Open Swagger : `http://localhost:8080/kie-server/docs`
2. To send a request to the Decision Service, navigate to "KIE session assets", and search for POST "/server/containers/instances/{containerId}".
3. Insert for container **id**: `loan-application_1.2.0`
2. Change the "Parameter content-type" and "Response content type" to "application/json";
3. And use the following payload for **body**:
```
{
"lookup": "default-stateless-ksession",
"commands": [
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Applicant": {
"creditScore": 120,
"name": "Jim Whitehurst"
}
},
"out-identifier": "applicant"
}
},
{
"insert": {
"object": {
"com.redhat.demos.dm.loan.model.Loan": {
"amount": 2500,
"approved": false,
"duration": 24,
"interestRate": 1.5
}
},
"out-identifier": "loan"
}
},
{
"fire-all-rules": {}
},
{
"get-objects": {
"out-identifier": "objects"
}
},
{
"dispose": {}
}
]
}
```
--------
### Expanding:
In both cases observe the results. The Loan Application rules have fired and determined that, based on the credit score of the application, and the amount of the loan, the loan can be approved. The `approved` attribute of the `Loan` has been set to `true`.
Exercise by changing the decision table as desired, change the version of the project, and redeploy a new version to a new KIE Container (allowing you to serve multiple versions of the same rule set at the same time on the same Decision Server). You can also build a new version of the project and use the Version Configuration tab of the container definition (in the Execution Servers screen) to manage the container using the UPGRADE button to pull the new version.
----------
# Extra installation **options**
**NOTE**: The installation options below are currently set to install Red Hat DM 7.7.
Option 2 - Run on OpenShift
-----------------------------------------
This demo can be installed on Red Hat OpenShift in various ways. We'll explain the different options provided.
Expand Down Expand Up @@ -177,8 +214,6 @@ the user a bit more control how to provision to OpenShift.
7. After provisioning, follow the instructions from above "Option 2 - Automated installation, manual project import", starting at step 2.
Option 3 - Run in Docker
-----------------------------------------
The following steps can be used to configure and run the demo in a container
Expand Down Expand Up @@ -207,6 +242,7 @@ Released versions
-----------------
See the tagged releases for the following versions of the product:
- v1.3 Red Hat Decision Manager 7.8.0 GA
- v1.2 Red Hat Decision Manager 7.7.0 GA
- v1.1 Red Hat Decision Manager 7.5.0.GA
- v1.0 Red Hat Decision Manager 7.0.0.GA
Expand All @@ -226,3 +262,7 @@ See the tagged releases for the following versions of the product:
![Swagger UI Rules Request](./docs/demo-images/kie-server-swagger-ui-rules-request.png)
![Swagger UI Rules Response](./docs/demo-images/kie-server-swagger-ui-rules-response.png)
![Swagger UI DMN Request](./docs/demo-images/kie-server-swagger-ui-dmn-request.png)
![Swagger UI DMN Response](./docs/demo-images/kie-server-swagger-ui-dmn-response.png)
Binary file modified docs/demo-images/decision-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/demo-images/execution-server-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/demo-images/kie-server-swagger-ui-rules-request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/demo-images/kie-server-swagger-ui-rules-response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/demo-images/kie-server-swagger-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/demo-images/loan-prj-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions init-properties.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ $AUTHORS="Red Hat"
$PROJECT="git@github.com:jbossdemocentral/rhdm7-loan-demo.git"
$PRODUCT="Red Hat Decision Manager"
$TARGET="$PROJECT_HOME\target"
$JBOSS_EAP="jboss-eap-7.2"
$JBOSS_EAP="jboss-eap-7.3"
$JBOSS_HOME="$TARGET\$JBOSS_EAP"
$SERVER_DIR="$JBOSS_HOME\standalone\deployments\"
$SERVER_CONF="$JBOSS_HOME\standalone\configuration\"
$SERVER_BIN="$JBOSS_HOME\bin"
$SRC_DIR="$PROJECT_HOME\installs"
$SUPPORT_DIR="$PROJECT_HOME\support"
$PRJ_DIR="$PROJECT_HOME\projects"
$DM_VERSION="7.7.0"
$DM_VERSION="7.8.0"
$DM_DECISION_CENTRAL="rhdm-$DM_VERSION-decision-central-eap7-deployable.zip"
$DM_KIE_SERVER="rhdm-$DM_VERSION-kie-server-ee8.zip"
$EAP="jboss-eap-7.2.0.zip"
$EAP="jboss-eap-7.3.0.zip"
#$EAP_PATCH="jboss-eap-6.4.7-patch.zip"
$VERSION="7.7"
$VERSION="7.8"
$PROJECT_GIT_REPO="https://github.com/jbossdemocentral/rhdm7-loan-demo-repo"
$PROJECT_GIT_REPO_NAME=rhdm7-loan-demo-repo.git
$NIOGIT_PROJECT_GIT_REPO="MySpace/$PROJECT_GIT_REPO_NAME"
8 changes: 4 additions & 4 deletions init-properties.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ AUTHORS="Red Hat"
PROJECT="git@github.com:jbossdemocentral/rhdm7-loan-demo.git"
PRODUCT="Red Hat Decision Manager"
TARGET=./target
JBOSS_EAP="jboss-eap-7.2"
JBOSS_EAP="jboss-eap-7.3"
JBOSS_HOME=$TARGET/$JBOSS_EAP
SERVER_DIR=$JBOSS_HOME/standalone/deployments
SERVER_CONF=$JBOSS_HOME/standalone/configuration/
SERVER_BIN=$JBOSS_HOME/bin
SRC_DIR=./installs
SUPPORT_DIR=./support
DM_VERSION=7.7.0
DM_VERSION=7.8.0
DM_DECISION_CENTRAL=rhdm-$DM_VERSION-decision-central-eap7-deployable.zip
DM_KIE_SERVER=rhdm-$DM_VERSION-kie-server-ee8.zip
EAP=jboss-eap-7.2.0.zip
EAP=jboss-eap-7.3.0.zip
#EAP_PATCH=jboss-eap-6.4.7-patch.zip
VERSION=7.7
VERSION=7.8
PROJECT_GIT_REPO=https://github.com/jbossdemocentral/rhdm7-loan-demo-repo
PROJECT_GIT_REPO_NAME=rhdm7-loan-demo-repo.git
NIOGIT_PROJECT_GIT_REPO="MySpace/$PROJECT_GIT_REPO_NAME"
Expand Down
6 changes: 3 additions & 3 deletions installs/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Download the following from http://developers.redhat.com

* EAP zip (jboss-eap-7.2.0.zip)
* Decision Manager: Decision Central deployable (rhdm-7.7.0-decision-central-eap7-deployable.zip)
* Decision Manager: Decision Server (KIE Server) deployable (rhdm-7.7.0-kie-server-ee8.zip)
* EAP zip (jboss-eap-7.3.0.zip)
* Decision Manager: Decision Central deployable (rhdm-7.8.0-decision-central-eap7-deployable.zip)
* Decision Manager: Decision Server (KIE Server) deployable (rhdm-7.8.0-kie-server-ee8.zip)

and copy to this directory for the init.sh and init.ps1 scripts to work.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x��]o�0��S*_�� ��ܵ��2Q�],��$��Ա# ъ���@��ډ��|�>'~��$�2:��k�O/�)b�@��@D��M�@H�j�ll��T�gj��[��K�c�{��Z�'I�<��>Ħ�e| ����rбby�B�r^�z�rs���[ Ύe�fC=�W1�E�H�I�d�t@]kwϔ��+��BA1��9���;��{1,(Wql5�I�4ɘ��)��[���RH���"�T@��o�2U6ZJm��$;�'�\�o����]�]�t?��� ob��v��v����k6�7 ~<5��2�8@�(�PzU��c�o.��9����81`J� ���C�B��5�Nf� a��{"���=���4fU�S���f(5y$��b��6Ң�W����=.\�1����2~�rgSV,�vL���84B�[E��Ӏ*�4�r%�`$�&=z)�Nw��
=z�1����I ����p^��#��4w�n5�"&B�L����*̦hD�Gw8O Y�)�Ή��2T&�w��m^�:�6�Rc �?����?(��������Ƈ������rE��)��¡y�Y\ʔ-����Ҷ����f���p�Fǥ�8&ߘ��S��S���T�� u�G�:ݕ�HQ�vZ��~�H"�) h��)��HxId� ���+o�A�6"��#2��ψ V�DZ+��� 2��"O6�����\���F?���
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
x��V]O�0�OA~n��
}V�J@'(���Mr\;�G����:-j�`b� ��������{�T�t���l�c�]�����B�aJa��R��X�2�4����J�p��0Srȋ� {r�X�]��f���`bK(=�餞D�M�y�QXG:!|hN�c�\��iv�ʰ���
��j�:��a�?Ȏ` ��\�Z����Gӏ�g���y�.�-�[4v�<K�K.)dk��T�ixW^PP� X��Y��M�������J^��d��g������S��6��JN�8�W��/���>�g3yD���X��Q�E����Z���4���96G+����4F9�Z����!~ss
����#�c�<"@�R�hl-�l��;���+ j~$T`����N:�o��j��\c���kM�� �����oNr,�:l�v��Z�$��4
H�J�ZE�y$Q�֒�cA�&�H��e;��B9�*���K�Q�� ����(�2�B��N/���oD�'u��e%�t�`��$2��6=��鷓�A7�16a����9i+��o����~�]���w:}v�k�a�Z��P �*��{�z���������73�g����ffX ��oģگ�Q{ȣ����^�A�����_��X Ƣf��4��%<�H�Y��R�߂�x������1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x���A� ]s
.�}
�ĸw� �~�&��Ņ1��F/��%���:Mc�
j�f Mf�!���3���Ӗ6f�1��K��Y��@J+��d�'��S�4�32E��nu��sm<��oO�,�^Cr��=��U��TK��e��%��}����|?<
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pack-refs with: peeled
635d56adb60f7a7a18931d9794308cbcc08524a0 refs/heads/master
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bfc28c5f1f90aaf98012f29f7c6c82c2b4541fd3
88feb860b2a0885c21570b49b65ae4c71c26c2cd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
09d4def2710e3f010e4ea072ec07ee81e9be07b2 not-for-merge branch 'master' of /Users/kvarela/projetos/contrib/demo/rhdm7-loan-demo-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
locked
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[http]
sslVerify = true
[remote "origin"]
url = https://github.com/jbossdemocentral/rhdm7-loan-demo-repo.git
url = /Users/kvarela/projetos/contrib/demo/rhdm7-loan-demo-repo
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/tags/*:refs/tags/*
fetch = +refs/notes/*:refs/notes/*
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x�}��N�0E���Ґd��#�@T $�`֞�Fql9N�V��D�P�末kc�0 �d"6s���4�9i��9i�ʼn��\�n����Œ�A϶?(�F<�Q#�a0Ɓ���+��9f�“ ~e��k�
��k@T��K����9�~�w,痐�˞�T;�q_�]�܎�����%��`J��G׆w)�/��͔��K̞����~�7 4�XJަ��ڶ��Rb�
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
x�Ք�j�@�{ݧ����+K�������l�$v��G��7� Q1xQ��rOf��3�DR2��x�a��
h���t�&� ر�/mvB-JH�bl�C���Z��)��� i,IpY�{��2�O���ךk��2�Α�6�K0��x6�<�4�����R(��'ark+3��|�*�9��3�B����1�N�ף��Z���OE\�������p4�Ea
RA�*%�UL�i�m��~�]�:�p�
*!�}d��r������*!c��%�ݯ� 2M�:3��/�U�3 Hٺ��Khj�������_�����\'��2g��
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# pack-refs with: peeled
9de76fc59de20e8ab486ae6fa0799d0d204052a1 refs/heads/master
09d4def2710e3f010e4ea072ec07ee81e9be07b2 refs/remotes/origin/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00021cc4f2cfcf5841cbb83a8db93406825e40b6

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pack-refs with: peeled
b4c98685c5ad195e3805fa2a49a3c33c159c7876 refs/heads/master

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 827b740

Please sign in to comment.