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
[JBPM-8380] #1477
[JBPM-8380] #1477
Conversation
set proper default values in jBPM.properties
Can one of the admins verify this PR? Comment with 'ok to test' to start the build. |
@MarianMacik @mswiderski this is based on my previous commit. @karlnicholas plz keep in mind that there are other places where this is used Also claim the Jira when you are working on it. otherwise will cause a misscordination among contributors. Thanks for the contribution ! |
this is ok to test |
Hi, Should a new Jira be opened for the droolsjbpm-tools? Should be easy to change? |
@karlnicholas use the same naming convention as this one (same branch name) |
@elguardian Okay, I looked at the droolsjbpm-tools and created PR kiegroup/droolsjbpm-tools#93. ProcessMain (and the plugin snippet) is not currently functioning properly without the changes to https://github.com/kiegroup/jbpm/blob/master/jbpm-test/src/test/filtered-resources/META-INF/persistence.xml made by this PR. This is because the schema for persistence unit "org.jbpm.services.task" has changed. I copied an updated version from somewhere else that works. This means that the ProcessMain code was allowed to fall into disrepair since it is not tested during the build processes. I would recommend a new Jira be opened to convert ProcessMain to a properly functioning JUnit test case. So, I did not completely remove JBPMHelper but I took away all dependencies from it except for the two places mentioned above and changed it to use PersistenceUtil for database requirements. |
@MarianMacik ^^ |
ok to test |
Also please issue ok to test on Remove JBPMHelper #93 droolsjbpm-tools changes. |
@MarianMacik @elguardian guys, could you please review and approve so it can be merged? |
@karlnicholas So if I understood correctly you didn't remove JBPMHelper because it manages 2 datasources? Is this what you mean by JPA installations? I can see that JBPMHelper is instantiating the jdbc/jbpm-ds datasource here: https://github.com/kiegroup/jbpm/pull/1477/files#diff-2ac0d6e56076eabf2e312f84f53a4663R54 But I cannot see where it is instantiating the second one for task service which is later used in this method: https://github.com/kiegroup/jbpm/pull/1477/files#diff-2ac0d6e56076eabf2e312f84f53a4663R62 I don't understand why we cannot simply get rid of this class and move the relevant code to the let's say AbstractMain class or just create a new ExamplesUtil method or whatever. And I am wondering how it works with that second datasource since it is not created anywhere :) Then |
user=sa | ||
password= | ||
url=jdbc:h2:tcp://localhost/~/jbpm-db | ||
datasourceName=jdbc/jbpm-ds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave only these properties here, others should not be used by PersistenceUtil class. They are only used by current jBPMHelper class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two, task service are used by ProcessMain which uses JBPMHelper. See additional comments below.
taskservice.enabled=true
taskservice.datasource.name=org.jbpm.services.task
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we definitely don't need these properties.
@MarianMacik @elguardian -- Horribly long but sufficient explanation follows: ProcessMain is the issue. It's in src/test/java/org/jbpm/test. This code is an exact copy of the code in the EclipsePlugin in the droolsjbpm-tools (somewhere, see other PR 93 above). This is the "two" places that JBPMHelper is used. This project and the other droolsjbpm-tools project. In the droolsjbpm-tools project the code seems to be part of a template for an eclipse plugin. So, I assume after looking at it briefly that a user in eclipse can ask for the template and the class will be injected a project somewhere. Sort of a quickstart. I don't know why the class (ProcessMain and also ProcessKModuleMain) are here in this project as well. I assume so that it can be run and tested. However the two classes are not tested as part of the build. They are both included as template code in the droolsjbpm-tools project but only ProcessMain is complicated enough to use JBPMHelper. ProcessKModuleMain is simple enough to just use PersistenceUtil only. So, if you remove JBPMHelper the eclipse plugin will have template code that fails. Having template code that fails is probably no big deal since it's not working at the moment anyway. This PR will fix it so that ProcessMain here in jbpm project will work, but at the cost of leaving JBPMHelper in the project. Even with the PR I'm not sure that the eclipse plugin template version of ProcessMain will work or even ever worked. The reason is that the code depends on being run from the test directory. See next paragraph. Regards the second datasource mentioned. The persistence.xml file used by JBPMHelper contains several datasources. Once JPA reads it all the datasources are available to the running application. ProcessMain demonstrates using a TaskService so it not only connects to If you remove the The Problem with moving all the code to ProcessMain is that it requires the datasource.properties file and the persistence.xml file to function properly and that is too complicated for an Eclipse plugin. I guess the Eclipse plugin just injects a single thing. To get around this whoever did the eclipse plugin put most of the functionality in JBPMHelper and made jbpm-test.jar a dependency. Personally I would just remove ProcessMain from the project and the eclipse plugin and then you could also remove JBPMHelper but that is not my call. I seriously doubt, even with this PR, that the eclipse plugin template code that is ProcessMain functions well if you actually add it to a project. This is because the template ProcessMain code included in a project won't be running under test and so probably won't find the correct persistence.xml anyway. |
OK, I see that it those two are persistence units reusing one datasource. So the property taskservice.datasource.name is quite misleading. Never mind, regarding the Regarding deletion of JBPMHelper. I understand that JBPMHelper is used in Eclipse plugin etc. But if you replace JBPMHelper with a new ExamplesUtil as I mentioned and you just leave there what is actually used, I think we would be safe. The issue with leaving JBPMHelper is that it has been marked as deprecated so I think we have to come up with a new class and only leave there functionality which we really need. I now realized that JBPMHelper says:
So I think we need to just rewrite ProcessMain as ProcessKModuleMain to use runtime manager and engine and obtain ksession from there. Then we can get rid of the |
Okay, it wasn't so bad after looking a little closer to put the code completely in the ProcessMain and ProcessKModuleMain in jbpm-test and the plugin template as well. I just did away with reading any kind of configuration file and hardcoded driver parameters for H2. I think it is fine since it is just example code anyway. Really, it seems much cleaner anyway since you can easily see what's going on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good now. Just minor suggestions and we are good to merge.
user=sa | ||
password= | ||
url=jdbc:h2:tcp://localhost/~/jbpm-db | ||
datasourceName=jdbc/jbpm-ds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now we definitely don't need these properties.
looks good now, will try to run full downstream build just to check if nothing is broken jenkins execute full downstream build |
jenkins execute full downstream build |
Also don't forget PR kiegroup/droolsjbpm-tools#93. |
Yes, I know about that one too. For that we don't have downstream build, just the repo build. jenkins execute full downstream build |
OK, I think we are good to go here. @elguardian can you approve? |
Are this build errors a problem with this PR? |
2 from 3 failed tests were seen before so they are not related, but I am not sure about |
I looked: This is something from the Workbench and seems to be importing/testing a project named OptaCloud which seems to be about OptaPlanner. Shouldn't have anything to do with these changes. |
I am 100% sure issues are not related. Can you rebase so we will merge this? |
@MarianMacik Okay, I merged the latest changes from the master branch. Since there were conflicts I needed to create a new commit to support the merge changes. Should be good to go. |
jenkins retest this |
jenkins execute full downstream build |
jenkins retest this |
jenkins execute full downstream build |
Looks good after full downstream. @mswiderski any comments? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me
Started with #1449 and did additional work to remove JBPMHelper.java and JBPMUnitTestCase.
Moved static routines from JBPMHelper to ProcessMain where they were exclusively used.
Moved a couple static fields from JBPMHelper to JbpmJunitBaseTestBase.java.