Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-issues#1596] Adding Business Calendar Example #2036

Merged
merged 26 commits into from
Nov 14, 2024

Conversation

Abhitocode
Copy link

@Abhitocode Abhitocode commented Nov 5, 2024

Closes: apache/incubator-kie-issues#1596

Added an example ensuring business calendar functionality to kogito-quarkus-examples.
The example includes a simple process that uses a business calendar. The example contains a README with clear step by step instructions, and incorporates all supporting resources required. The priority would be having this example for Quarkus.

@Abhitocode Abhitocode marked this pull request as draft November 5, 2024 16:31
@gitgabrio
Copy link
Contributor

Reopened from #2031

@kie-ci3
Copy link
Contributor

kie-ci3 commented Nov 6, 2024

PR job #2 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-examples -u #2036 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-examples-pr/job/PR-2036/2/display/redirect

Test results:

  • PASSED: 123
  • FAILED: 1

Those are the test failures:

org.kie.kogito.calendar.CreditCardProcessIT.testCardPaymentInWorkingDay 1 expectation failed.
Response body doesn't match expectation.
Expected: "[]"
Actual: [{"id":"34985152-e934-422d-befe-0f6ab4333bfd","creditCardNumber":null,"creditCardDetails":{"cardNumber":"434354343","status":"Bill Due"}}]

@kie-ci3
Copy link
Contributor

kie-ci3 commented Nov 6, 2024

PR job #3 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-examples -u #2036 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-examples-pr/job/PR-2036/3/display/redirect

Test results:

  • PASSED: 170
  • FAILED: 1

Those are the test failures:

org.kie.kogito.calendar.CreditCardProcessIT.testCardPaymentInWorkingDay 1 expectation failed.
Response body doesn't match expectation.
Expected: "[]"
Actual: [{"id":"4267f444-8674-4514-9f79-186ed782bc0f","creditCardNumber":null,"creditCardDetails":{"cardNumber":"434354343","status":"Bill Due"}}]

@kie-ci3
Copy link
Contributor

kie-ci3 commented Nov 6, 2024

PR job #4 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-examples -u #2036 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-examples-pr/job/PR-2036/4/display/redirect

Test results:

  • PASSED: 394
  • FAILED: 1

Those are the test failures:

org.kie.kogito.examples.quarkus.GrafanaDockerComposeIT.testGrafanaDashboards 1 expectation failed.
JSON path title doesn't match.
Expected: a collection containing "dmn-drools-quarkus-metrics_999-SNAPSHOT - hello - Operational Dashboard"
Actual: <[dmn-drools-quarkus-metrics_999-SNAPSHOT - Custom - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - Custom - Operational Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - Hello - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - LoanEligibility - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - LoanEligibility - Operational Dashboard]>

@yesamer
Copy link
Contributor

yesamer commented Nov 12, 2024

Hi @Abhitocode, if this is Ready for review, please move its status from Draft to "Ready for review". Thanks

@kie-ci3
Copy link
Contributor

kie-ci3 commented Nov 12, 2024

PR job #11 was: UNSTABLE
Possible explanation: This should be test failures

Reproducer

build-chain build full_downstream -f 'https://raw.githubusercontent.com/${AUTHOR:apache}/incubator-kie-kogito-pipelines/${BRANCH:main}/.ci/buildchain-config-pr-cdb.yaml' -o 'bc' -p apache/incubator-kie-kogito-examples -u #2036 --skipParallelCheckout

NOTE: To install the build-chain tool, please refer to https://github.com/kiegroup/github-action-build-chain#local-execution

Please look here: https://ci-builds.apache.org/job/KIE/job/kogito/job/main/job/pullrequest_jobs/job/kogito-examples-pr/job/PR-2036/11/display/redirect

Test results:

  • PASSED: 400
  • FAILED: 1

Those are the test failures:

org.kie.kogito.examples.quarkus.GrafanaDockerComposeIT.testGrafanaDashboards 1 expectation failed.
JSON path title doesn't match.
Expected: a collection containing "dmn-drools-quarkus-metrics_999-SNAPSHOT - Custom - Operational Dashboard"
Actual: <[dmn-drools-quarkus-metrics_999-SNAPSHOT - Custom - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - Hello - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - hello - Operational Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - LoanEligibility - Domain Dashboard, dmn-drools-quarkus-metrics_999-SNAPSHOT - LoanEligibility - Operational Dashboard]>

@Abhitocode Abhitocode marked this pull request as ready for review November 12, 2024 13:58
Copy link

@martinweiler martinweiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section on running without calendar.properties file needs to be updated.

Copy link
Contributor

@yesamer yesamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reporting a couple of minor points

Copy link

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR. It seems very good feature. I have done some tests locally. I agree with others that maybe we could enhance the documentation a little bit.


```sh
mvn clean package
java -jar target/quarkus-app/quarkus-run.jar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this somehow does not work on my machine:
Screenshot 2024-11-13 110210
Screenshot 2024-11-13 110330

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried again, works for, not sure exactly what might be causing the issue in your case
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabled it in the application.properties, should work now.

Note that this requires GRAALVM_HOME to point to a valid GraalVM installation

```sh
mvn clean package -Pnative
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not able to finish this build:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  05:16 min
[INFO] Finished at: 2024-11-13T11:09:29+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.8.6:build (default) on project process-business-calendar-example: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:468)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:258)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:840)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

business.hours.per.day=24 # Defines the number of hours per working day (e.g., business.hours.per.day=24 for a 24-hour workday)
business.days.per.week =7 # Defines how many days are considered working days (e.g.,7 means all days are working days)
business.holiday.date.format=yyyy-MM-dd # specifies holiday date format used
business.holidays=2024-11-07 # Add custom holidays that are non-working days, specified in the format defined by business.holiday.date.format
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to define multiple days or periods, is that possible? asking because there are usually more holidays during the year

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple holidays: 2024-11-13, 2024-11-14
In a range 2024-11-14:2024-11-14

Thank you for the pointing it, just remebered to add the same in the readme too.

<bpmn2:collaboration id="_DCDB6E8C-F47A-4DBC-B34A-046A81E24F95" name="Default Collaboration">
<bpmn2:participant id="_D18AFD4D-A5A8-4C66-8259-5D9CF9B946FA" name="Pool Participant" processRef="BusinessCalendarCreditBill"/>
</bpmn2:collaboration>
<bpmn2:process id="BusinessCalendarCreditBill" drools:packageName="org.kie.calendar.bill" drools:version="1.0" drools:adHoc="false" name="BusinessCalendar-CreditBill" isExecutable="true" processType="Public">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could unify the packages, in src/main/java we have org.kie.kogito.calendar.bill while in src/main/resources we have org.kie.calendar.bill

Copy link
Contributor

@gitgabrio gitgabrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Abhitocode
Many thanks for the example. And, mostly, for the documentation ❤️
LGTM

Copy link
Contributor

@yesamer yesamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Abhitocode Thank you, well done!

Copy link

@martinweiler martinweiler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @Abhitocode
Thanks for your diligence incorporating all the feedback!

Copy link

@jomarko jomarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updates @Abhitocode

@yesamer yesamer merged commit 21fd453 into apache:main Nov 14, 2024
5 checks passed
rgdoliveira pushed a commit to rgdoliveira/kogito-examples that referenced this pull request Nov 18, 2024
…2036)

* business-calendar-example

* business-calendar-example

* business-calendar-example

* business-calendar-example

* business-calendar-example

* business-calendar-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example

* incubator-kie-issues-1596-bc-example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants