Re: Updated my Ofbiz trunk copy to tomcat 11
Hi Omar, and thanks for sharing. I started this upgrade as well as you can see on the jira [1] I encountered a problem with The migration of JUEL connector and the FlexibleStringExpander in doing so, and i didn't had time to work more on the subject. You're are more than welcome to share your work ! Also, what version did you upgrade ? Best regards, Gaetan [1] https://issues.apache.org/jira/browse/OFBIZ-12989 On 7/10/24 15:27, Omar Abdullwahhab wrote: Hello developers at Ofbiz I am new to the group, and want to share my changes with the people at ofbiz, I have done the following - upgraded tomcat 10.x then I noticed a better performance, - upgraded to tomcat 11 gaining even better. - upgraded to jakarta servlet - added also the H2 database And right now all works fine with no issues except for three or more plugins (ecommerce, Solr ) and the third one I do not remember. But of course working alone is a hard task for such a big software product. So I want to share these modifications if it's possible, so that everyone can review and solve the issues with the plugins. Thank you
Re: Unit testing for a custom module
Hi Carsten, did you manage to solve your problem ? Regards, Gaetan On 6/21/24 14:45, Gaetan wrote: Hi, I created a public gitlab account account so that i can help you, with this address : (mr.plop.p...@netcourrier.com) If you feel confortable with it, you can share with me the repo link (read only, of course). Best regards Gaetan PS: i don't know if there are any community rules for this kind of cases ? On 6/21/24 11:17, Carsten Schinzer wrote: Hi Gaetan, Thanks to get back to me. I see no change - all the things you applied I already did. I also added your test case to the code and ran that locally - the test is obviously not found. It might have to do with the fact that I prefer JUnit 5 because of its advanced parametrized testing features? I can give you access to the code repo if you have a Gitlab account. When running tests locally, I do not see any test reports for my classes, so this is the indicator I am using. Also, I have test cases that should fail with the current code state. So situation is unchanged unfortunately. Warm regards Carsten Am 20.06.2024 um 16:58 schrieb Gaetan : Hi Carsten, do you have any updates on your case ? Regards, Gaetan On 6/11/24 09:58, Gaetan wrote: Hello Carsten. I set up a very small example plugin that i tested myself localy. Could you please reproduce the steps below ? - get ofbiz framework from apache repo (https://github.com/apache/ofbiz-framework) - checkout trunk on ofbiz framework - get example plugin and set it up inside plugins (https://github.com/gtchaboussie/ofbiz-demo-test-plugin) at the ofbiz root location, run `./gradlew test`. The build should fail (this means the test in the plugin is runned) with this error: ``` org.test.TestClass > test FAILED java.lang.AssertionError at TestClass.java:9 ``` This gives you a template or example of a unit test. As you can see, you should not have to update anything on the base framework for your tests yo be runned. Also, could you share your OS and OFBiz version ? Regards, Gaetan On 6/10/24 19:13, Carsten Schinzer wrote: Hello Gaetan, I do all this as you describe, source path for tests is as required and tests are properly annotated. The main difference is that this is not a unit test out of a framework, but unit tests sitting in a plugin component. I so not see any traces of the framework stepping into my test directories when executing test (I ran .gradlew test —info to get more info). IMO something is probably missing in my build.gradle: /*…*/ dependencies { // information: the ofbiz:release22.01 is on jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31' pluginLibsCompile 'org.glassfish.jersey.containers:jersey-container-servlet:2.31' pluginLibsCompile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.31' pluginLibsCompile 'javax.json:javax.json-api:1.1.4' pluginLibsCompile 'jakarta.inject:jakarta.inject-api:2.0.1' pluginLibsCompile 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-annotations:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-core:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-databind:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1' // Swagger Annotations for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.20' // Swagger JAX-RS Integration for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.20' // Swagger UI pluginLibsCompile 'org.webjars:swagger-ui:4.1.3' // Junit core, api and parameterization pluginLibsCompile 'org.junit.jupiter:junit-jupiter:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-api:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-params:5.10.0' } task install { doLast { // Install logic for this plugin } } task uninstall { doLast { // uninstall logic for this plugin } } I have dependencies on JUnit 5 since I want to use the ParameterizedTest feature available there. Maybe that is the issue. I also cannot find a passing build when stating these dependencies as pluginCompileOnly either. So almost certainly this is rather a hook into the test executionon grade side, WDYT? Thanks for your comments so far! Warm regards Carsten Am 10.06.2024 um 17:54 schrieb Gaetan : Hi again, After some research, it seems you should follow this kind of structure for your unit tests : https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259 So you should setup your tests at the right package (either groovy or java according to build instructions) and add the test decorator like this example https://github.com/apache/ofbiz-framework/b
Re: Unit testing for a custom module
Hi, I created a public gitlab account account so that i can help you, with this address : (mr.plop.p...@netcourrier.com) If you feel confortable with it, you can share with me the repo link (read only, of course). Best regards Gaetan PS: i don't know if there are any community rules for this kind of cases ? On 6/21/24 11:17, Carsten Schinzer wrote: Hi Gaetan, Thanks to get back to me. I see no change - all the things you applied I already did. I also added your test case to the code and ran that locally - the test is obviously not found. It might have to do with the fact that I prefer JUnit 5 because of its advanced parametrized testing features? I can give you access to the code repo if you have a Gitlab account. When running tests locally, I do not see any test reports for my classes, so this is the indicator I am using. Also, I have test cases that should fail with the current code state. So situation is unchanged unfortunately. Warm regards Carsten Am 20.06.2024 um 16:58 schrieb Gaetan : Hi Carsten, do you have any updates on your case ? Regards, Gaetan On 6/11/24 09:58, Gaetan wrote: Hello Carsten. I set up a very small example plugin that i tested myself localy. Could you please reproduce the steps below ? - get ofbiz framework from apache repo (https://github.com/apache/ofbiz-framework) - checkout trunk on ofbiz framework - get example plugin and set it up inside plugins (https://github.com/gtchaboussie/ofbiz-demo-test-plugin) at the ofbiz root location, run `./gradlew test`. The build should fail (this means the test in the plugin is runned) with this error: ``` org.test.TestClass > test FAILED java.lang.AssertionError at TestClass.java:9 ``` This gives you a template or example of a unit test. As you can see, you should not have to update anything on the base framework for your tests yo be runned. Also, could you share your OS and OFBiz version ? Regards, Gaetan On 6/10/24 19:13, Carsten Schinzer wrote: Hello Gaetan, I do all this as you describe, source path for tests is as required and tests are properly annotated. The main difference is that this is not a unit test out of a framework, but unit tests sitting in a plugin component. I so not see any traces of the framework stepping into my test directories when executing test (I ran .gradlew test —info to get more info). IMO something is probably missing in my build.gradle: /*…*/ dependencies { // information: the ofbiz:release22.01 is on jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31' pluginLibsCompile 'org.glassfish.jersey.containers:jersey-container-servlet:2.31' pluginLibsCompile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.31' pluginLibsCompile 'javax.json:javax.json-api:1.1.4' pluginLibsCompile 'jakarta.inject:jakarta.inject-api:2.0.1' pluginLibsCompile 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-annotations:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-core:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-databind:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1' // Swagger Annotations for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.20' // Swagger JAX-RS Integration for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.20' // Swagger UI pluginLibsCompile 'org.webjars:swagger-ui:4.1.3' // Junit core, api and parameterization pluginLibsCompile 'org.junit.jupiter:junit-jupiter:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-api:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-params:5.10.0' } task install { doLast { // Install logic for this plugin } } task uninstall { doLast { // uninstall logic for this plugin } } I have dependencies on JUnit 5 since I want to use the ParameterizedTest feature available there. Maybe that is the issue. I also cannot find a passing build when stating these dependencies as pluginCompileOnly either. So almost certainly this is rather a hook into the test executionon grade side, WDYT? Thanks for your comments so far! Warm regards Carsten Am 10.06.2024 um 17:54 schrieb Gaetan : Hi again, After some research, it seems you should follow this kind of structure for your unit tests : https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259 So you should setup your tests at the right package (either groovy or java according to build instructions) and add the test decorator like this example https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/framework/base/src/test/java/org/apache/ofbiz/base/container/ComponentContainerTest.java#L63 Please let me k
Re: Unit testing for a custom module
Hi Carsten, do you have any updates on your case ? Regards, Gaetan On 6/11/24 09:58, Gaetan wrote: Hello Carsten. I set up a very small example plugin that i tested myself localy. Could you please reproduce the steps below ? - get ofbiz framework from apache repo (https://github.com/apache/ofbiz-framework) - checkout trunk on ofbiz framework - get example plugin and set it up inside plugins (https://github.com/gtchaboussie/ofbiz-demo-test-plugin) at the ofbiz root location, run `./gradlew test`. The build should fail (this means the test in the plugin is runned) with this error: ``` org.test.TestClass > test FAILED java.lang.AssertionError at TestClass.java:9 ``` This gives you a template or example of a unit test. As you can see, you should not have to update anything on the base framework for your tests yo be runned. Also, could you share your OS and OFBiz version ? Regards, Gaetan On 6/10/24 19:13, Carsten Schinzer wrote: Hello Gaetan, I do all this as you describe, source path for tests is as required and tests are properly annotated. The main difference is that this is not a unit test out of a framework, but unit tests sitting in a plugin component. I so not see any traces of the framework stepping into my test directories when executing test (I ran .gradlew test —info to get more info). IMO something is probably missing in my build.gradle: /*…*/ dependencies { // information: the ofbiz:release22.01 is on jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31' pluginLibsCompile 'org.glassfish.jersey.containers:jersey-container-servlet:2.31' pluginLibsCompile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.31' pluginLibsCompile 'javax.json:javax.json-api:1.1.4' pluginLibsCompile 'jakarta.inject:jakarta.inject-api:2.0.1' pluginLibsCompile 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-annotations:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-core:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-databind:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1' // Swagger Annotations for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.20' // Swagger JAX-RS Integration for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.20' // Swagger UI pluginLibsCompile 'org.webjars:swagger-ui:4.1.3' // Junit core, api and parameterization pluginLibsCompile 'org.junit.jupiter:junit-jupiter:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-api:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-params:5.10.0' } task install { doLast { // Install logic for this plugin } } task uninstall { doLast { // uninstall logic for this plugin } } I have dependencies on JUnit 5 since I want to use the ParameterizedTest feature available there. Maybe that is the issue. I also cannot find a passing build when stating these dependencies as pluginCompileOnly either. So almost certainly this is rather a hook into the test executionon grade side, WDYT? Thanks for your comments so far! Warm regards Carsten Am 10.06.2024 um 17:54 schrieb Gaetan : Hi again, After some research, it seems you should follow this kind of structure for your unit tests : https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259 So you should setup your tests at the right package (either groovy or java according to build instructions) and add the test decorator like this example https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/framework/base/src/test/java/org/apache/ofbiz/base/container/ComponentContainerTest.java#L63 Please let me know if you encounter any more trouble ! Regards Gaetan On 6/10/24 16:55, Carsten Schinzer wrote: … and after some more assertions, I can add: I have verified the paths to all my test suites to point to the correct Java classes. I do not find any error in the test logs. I do find the classes in the build/classes/java/test directory. I do not find related test results at all. An hint you can give me is appreciated! Warm regards Carsten Am 10.06.2024 um 15:47 schrieb Carsten Schinzer < cars...@dcs-verkaufssysteme.de>: Hello, You mean like this:
Re: Unit testing for a custom module
Hello Carsten. I set up a very small example plugin that i tested myself localy. Could you please reproduce the steps below ? - get ofbiz framework from apache repo (https://github.com/apache/ofbiz-framework) - checkout trunk on ofbiz framework - get example plugin and set it up inside plugins (https://github.com/gtchaboussie/ofbiz-demo-test-plugin) at the ofbiz root location, run `./gradlew test`. The build should fail (this means the test in the plugin is runned) with this error: ``` org.test.TestClass > test FAILED java.lang.AssertionError at TestClass.java:9 ``` This gives you a template or example of a unit test. As you can see, you should not have to update anything on the base framework for your tests yo be runned. Also, could you share your OS and OFBiz version ? Regards, Gaetan On 6/10/24 19:13, Carsten Schinzer wrote: Hello Gaetan, I do all this as you describe, source path for tests is as required and tests are properly annotated. The main difference is that this is not a unit test out of a framework, but unit tests sitting in a plugin component. I so not see any traces of the framework stepping into my test directories when executing test (I ran .gradlew test —info to get more info). IMO something is probably missing in my build.gradle: /*…*/ dependencies { // information: the ofbiz:release22.01 is on jakarta.ws.rs:jakarta.ws.rs-api:2.1.6 pluginLibsCompile 'org.glassfish.jersey.inject:jersey-hk2:2.31' pluginLibsCompile 'org.glassfish.jersey.containers:jersey-container-servlet:2.31' pluginLibsCompile 'org.glassfish.jersey.media:jersey-media-json-jackson:2.31' pluginLibsCompile 'javax.json:javax.json-api:1.1.4' pluginLibsCompile 'jakarta.inject:jakarta.inject-api:2.0.1' pluginLibsCompile 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-annotations:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-core:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.core:jackson-databind:2.16.1' pluginLibsCompile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.16.1' // Swagger Annotations for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-annotations:2.2.20' // Swagger JAX-RS Integration for OpenAPI pluginLibsCompile 'io.swagger.core.v3:swagger-jaxrs2:2.2.20' // Swagger UI pluginLibsCompile 'org.webjars:swagger-ui:4.1.3' // Junit core, api and parameterization pluginLibsCompile 'org.junit.jupiter:junit-jupiter:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-api:5.10.0' pluginLibsCompile 'org.junit.jupiter:junit-jupiter-params:5.10.0' } task install { doLast { // Install logic for this plugin } } task uninstall { doLast { // uninstall logic for this plugin } } I have dependencies on JUnit 5 since I want to use the ParameterizedTest feature available there. Maybe that is the issue. I also cannot find a passing build when stating these dependencies as pluginCompileOnly either. So almost certainly this is rather a hook into the test executionon grade side, WDYT? Thanks for your comments so far! Warm regards Carsten Am 10.06.2024 um 17:54 schrieb Gaetan : Hi again, After some research, it seems you should follow this kind of structure for your unit tests : https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259 So you should setup your tests at the right package (either groovy or java according to build instructions) and add the test decorator like this example https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/framework/base/src/test/java/org/apache/ofbiz/base/container/ComponentContainerTest.java#L63 Please let me know if you encounter any more trouble ! Regards Gaetan On 6/10/24 16:55, Carsten Schinzer wrote: … and after some more assertions, I can add: I have verified the paths to all my test suites to point to the correct Java classes. I do not find any error in the test logs. I do find the classes in the build/classes/java/test directory. I do not find related test results at all. An hint you can give me is appreciated! Warm regards Carsten Am 10.06.2024 um 15:47 schrieb Carsten Schinzer < cars...@dcs-verkaufssysteme.de>: Hello, You mean like this:
Re: Unit testing for a custom module
Hi again, After some research, it seems you should follow this kind of structure for your unit tests : https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/build.gradle#L259 So you should setup your tests at the right package (either groovy or java according to build instructions) and add the test decorator like this example https://github.com/apache/ofbiz-framework/blob/7c2487bc3f1a6ec472585c27d7ceb5ca19471387/framework/base/src/test/java/org/apache/ofbiz/base/container/ComponentContainerTest.java#L63 Please let me know if you encounter any more trouble ! Regards Gaetan On 6/10/24 16:55, Carsten Schinzer wrote: … and after some more assertions, I can add: I have verified the paths to all my test suites to point to the correct Java classes. I do not find any error in the test logs. I do find the classes in the build/classes/java/test directory. I do not find related test results at all. An hint you can give me is appreciated! Warm regards Carsten Am 10.06.2024 um 15:47 schrieb Carsten Schinzer : Hello, You mean like this: Am 10.06.2024 um 09:17 schrieb Gaetan : Hi Carsten, did you include your tests in the ofbiz-component file a the root of your plugin ? Best regards Gaetan On 6/9/24 21:15, Carsten Schinzer wrote: Hello all, I am looking for a reference to integrate my plugin unit tests into the test run of OfBiz, i.e. when I run ./gradlew test My defined test suite should be included and executed. I did browse the official plugin repository and found no reference. First issue: how to define the hook into the test task in build.gradle. Second: Ho to make sure, the build.gradle dependencies on JUnit are only loaded for test and not packaged. Does anyone have an example possibly how to do this. Thanks & warm regards Carsten
Re: Unit testing for a custom module
Hi Carsten, did you include your tests in the ofbiz-component file a the root of your plugin ? Best regards Gaetan On 6/9/24 21:15, Carsten Schinzer wrote: Hello all, I am looking for a reference to integrate my plugin unit tests into the test run of OfBiz, i.e. when I run ./gradlew test My defined test suite should be included and executed. I did browse the official plugin repository and found no reference. First issue: how to define the hook into the test task in build.gradle. Second: Ho to make sure, the build.gradle dependencies on JUnit are only loaded for test and not packaged. Does anyone have an example possibly how to do this. Thanks & warm regards Carsten
Discussion on OFBiz Tomcat upgrade
Hi all. I'm opening a new thread to discuss the upgrade of the Tomcat version used by OFBiz. First, i pushed the task a bit hard without consulting the community first, and i apologize for it. I got carried away. The initial task came from a Prometheus plugin idea. [1] There is a documentation provided by tomcat on how to do the basic migration operations. [2] My opinion is that it will have to be done at some point. I don't have enough experience on OFBiz to know the full implications of a Tomcat migration. This one would be bigger even, because it would imply migrating from javax package to jakarta package. javax to jakarta change breaks some other things, such as JUEL dependency. Migration would be a lot of work and testing. The advantages i see in migrating as soon as possible would be that we could put it behind us. Any thougts ? The ticket has been created some days ago [3] [1] https://lists.apache.org/thread/jy7y96nmdr0rl43bss3sjm0jkcf2s2gz [2] https://tomcat.apache.org/migration-10.html [3] https://issues.apache.org/jira/browse/OFBIZ-12989
Re: UEL migration
Good point. I'll start a new thread focused on Tomcat. On 4/10/24 10:24, Jacques Le Roux wrote: Le 10/04/2024 à 09:45, Florian Motteau a écrit : Sure, I just question the fact that this important discussion (updating tomcat, which leads to a lot of work/implications) occurs via a remote task. It may need its own thread (updating tomcat : yes ? no ? why ? how ? people insights about this subject). +1 Jacques
Re: UEL migration
Hi Florian ! Thanks for the answer I agree that migrating Tomcat isn't mandatory for the initial task. It just feels cleaner that way, so that we don't have two http servers running in the framework. But it made me think that OFBiz would have to migrate at some point. > updating Tomcat is no small thing Indeed. But now would be as good a time as any ? And i have some time so spend into it now. Your point stays valid though. On 4/10/24 08:31, Florian Motteau wrote: Hi Gaetan, I would ask if using the prometheus java client's embedded http server is such a bad thing that we need to update OFBiz Tomcat and face the huge consequences of this update. I'm not fully aware of all the implications here, but my 2ct would be to reconsider this point, because updating Tomcat is no small thing, and if i understand correctly you won't get any added value for your main goal (expose data). Beside this, it will still be possible to update your plugin once the community has updated Tomcat (maybe separate the topics : the plugin, and the OFBiz Tomcat migration update ?). Le 09/04/2024 à 17:13, Gaetan a écrit : Hi everyone. I'm working on UEL engine migration (OFBIZ-12991 [1]). Why ? It starts from the idea of creating a Prometheus plugin, allowing to expose data to grafana. There is a lib that exists in java. [2] This lib comes with an integrated httpserver but it would be much cleaner to use the tomcat server already present in OFBiz, but the java lib uses jakarta, making it imcompatible with Tomcat 9 (the current version in OFBiz) that still uses javax. For OFBiz to be able to switch to Tomcat 10, we need to switch to javax to jakarta. And OFBiz uses a library for UEL that has had no update in the last 10 years, and still uses javax [3] The thing is that we still need (IMO) to have custom overrides of libraries that implements UEL. All UEL implementation cases i saw still won't allow for auto-vivify. [4] [4bis] This would prevent some uses of null map keys in XML scripting from what i understand. I don't know if it's a big change, or regression. Now my problem is that i don't know how to procede. The work of migrating the library has been done but not merged (yet ?) [5] I can't find an other library that would suit the existing code without having to re-write a lot of code. I think i understand some of it currently works, but i can't figure out how to keep going after that. One possibility would be to see if we can use jakarta vanilla EL [6]. An other possibility could be to have both javax and jakarta (for some time) to give us some time for migration. Any thoughts ? Gaetan [1] https://issues.apache.org/jira/projects/OFBIZ/issues/OFBIZ-12991 [2] https://github.com/prometheus/client_java [3] https://mvnrepository.com/artifact/de.odysseus.juel/juel-impl [4] https://github.com/apache/ofbiz-framework/blob/6039526c744e1a75e5c40b553de964041f386531/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java#L461 [4bis] https://en.wikipedia.org/wiki/Autovivification [5] https://github.com/beckchr/juel/pull/104 [6]https://jakarta.ee/specifications/expression-language/4.0/jakarta-expression-language-spec-4.0 PS: Thanks Gil for helping me get some clarity in this VAST subject
UEL migration
Hi everyone. I'm working on UEL engine migration (OFBIZ-12991 [1]). Why ? It starts from the idea of creating a Prometheus plugin, allowing to expose data to grafana. There is a lib that exists in java. [2] This lib comes with an integrated httpserver but it would be much cleaner to use the tomcat server already present in OFBiz, but the java lib uses jakarta, making it imcompatible with Tomcat 9 (the current version in OFBiz) that still uses javax. For OFBiz to be able to switch to Tomcat 10, we need to switch to javax to jakarta. And OFBiz uses a library for UEL that has had no update in the last 10 years, and still uses javax [3] The thing is that we still need (IMO) to have custom overrides of libraries that implements UEL. All UEL implementation cases i saw still won't allow for auto-vivify. [4] [4bis] This would prevent some uses of null map keys in XML scripting from what i understand. I don't know if it's a big change, or regression. Now my problem is that i don't know how to procede. The work of migrating the library has been done but not merged (yet ?) [5] I can't find an other library that would suit the existing code without having to re-write a lot of code. I think i understand some of it currently works, but i can't figure out how to keep going after that. One possibility would be to see if we can use jakarta vanilla EL [6]. An other possibility could be to have both javax and jakarta (for some time) to give us some time for migration. Any thoughts ? Gaetan [1] https://issues.apache.org/jira/projects/OFBIZ/issues/OFBIZ-12991 [2] https://github.com/prometheus/client_java [3] https://mvnrepository.com/artifact/de.odysseus.juel/juel-impl [4] https://github.com/apache/ofbiz-framework/blob/6039526c744e1a75e5c40b553de964041f386531/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java#L461 [4bis] https://en.wikipedia.org/wiki/Autovivification [5] https://github.com/beckchr/juel/pull/104 [6]https://jakarta.ee/specifications/expression-language/4.0/jakarta-expression-language-spec-4.0 PS: Thanks Gil for helping me get some clarity in this VAST subject
Tomcat 10 Migration
Hello community, We are thinking of building a Prometheus plugin the OFBiz. are thinking of using this library [1] We already made a small POC. The problem is that we had to create a second HTTP server for this puspose only. We thought about using the already existing Tomcat structure, but the library uses Tomcat 10, and OFBiz is Tomcat 9. The migration will have to be made at some point, and this is the occasion for us to do it. There is a documentation that can be followed [2]. Is there any opposition ? Gaetan and Nicolas. [1] https://prometheus.github.io/client_java/ [2] https://tomcat.apache.org/migration-10.html <https://tomcat.apache.org/migration-10.html>
Re: OFBiz 22.01 - Eclipse - Issues on setting up a debugging environment.
Hello Wiebke, The dev mentioned in the last email is now done and available in the last idea plugin version with 2023.1 Intellij community version. You can find all the installation instructions here : https://github.com/Nereide-lab/idea-ofbiz-plugin#usage I hope this helps. Best regards, Gaetan On 05/05/2023 16:43, Gil Portenseigne wrote: Hello, Reading this i discussed with Gaëtan about somthing that could help control that every groovyScript reference in Screens/Forms/Services are effectively referencing an existing file. As you might know, Gaëtan is contributing an IDEA plugin dedicated to OFBiz [1]. The plugin already manage component:// notation, that allow highlighting of missing referenced file in editor. We discussed about inspection feature, that could detect bad references for groovyScript (and others) files. Whereas he is not familiar with IDEA inspection feature in the plugin, we could try to start building one for this particular effort, if that could bring more confidence in migration. Regards, Gil [1] https://lists.apache.org/thread/03fr40tvhkv97pqrgt4nl78w4m6ml33w On 2023/05/02 07:16:35 Daniel Watford wrote: Hi Michael, I would be concerned about our capacity to move all these groovy scripts and ensure correct location updates are made to the elements in the controller.xml files and elements in service definitions in both trunk and the release22.01 branch. If we were to pursue these changes, could we add a test mode to code that parses service definitions and controller xml files to check that the groovy location (and invoked methods were relevant) are accessible? This means we would have some automation to help ensure changes have been applied correctly. This will be a big undertaking, so I would suggest creating some mini-project-management similar to that done for the CodeNarc integration where we have a list of files that need moving and committers add their name to files they are actively working on. I would also request that we introduce rules for this mini-project such as, 'No functional changes to code', and 'keep Pull Requests small', etc. To answer your original question, if we do not make the proposed changes to release 22.01, we will substantially degrade the ability for developers using Eclipse to work with OFBiz. But if we do proceed with this work, we will effectively need to do it twice - once for the release22.01 branch and once for trunk - a pretty heavy undertaking. On balance I think it would be bad for the project to release OFBiz in a state which is difficult for developers/system integrators to work with, so we MUST ensure OFBiz is 'debuggable'. I'll ask one more question (and then run for cover!): Rather than carry out this work twice. What if we abandon the 22.01 release and instead make a new release branch (23.xx) soon after moving the Groovy sources? Thanks, Dan. On Wed, 26 Apr 2023 at 12:23, Michael Brohl wrote: Hi, I suggest to start with a new ticket to coordinate the refactoring work (will you take this into your hands, Wiebke?). OFBIZ-10226 has another intention which will not solve the overall problem Wiebke described. Does the community agree that we'll have to do this work? Even more, do we agree that it has to be done before we can ship a first 22.01 release based on JDK 17? Best regards, Michael Brohl ecomify GmbH - www.ecomify.de Am 25.04.23 um 18:30 schrieb Jacques Le Roux: Thanks Wiebke, I know that for a while (https://s.apache.org/kewrn) but was desperately trying to avoid what you propose. It's indeed the right solution. So I think we can go on with OFBIZ-10226. At the bottom there is a link to a related discussion with some opinions from then. Or do you prefer to start anew for the sake of clarity? Thanks again for your work, I was not aware of this Groovy page. It definitely confirms what Mathieu said then. Jacques Le 25/04/2023 à 16:09, Wiebke Pätzold a écrit : Hi everyone, I did a bit of research regarding the groovy debugging. After some research I found this: “The Java Platform Module System requires that classes in distinct modules have distinct package names. Groovy has its own "modules" but these haven’t historically been structured according to the above requirement. For this reason, Groovy 2.x and 3.0 should be added to the classpath not module path when using JDK9+. This places Groovy’s classes into the unnamed module where the split package naming requirement is not enforced.“ http://groovy-lang.org/releasenotes/groovy-3.0.html#Groovy3.0releasenotes-Splitpackages For testing I used the service "sendEmailDated" in CommunicationEventServices.groovy. I can confirm the described behavior of Jacques, without a package declaration the service does not stop at my breakpoint. If I add the package declaration for the class, the service stops at my breakpoint. From my point of view it would make sense for the project not only to add the package decla
Question/reflexion about html validation
Hello community, We are under the process of migrating ofbiz from 18 to 22 for a project, and we saw some part of the code that we would like to discuss. Our case is the following : - We have this string as input data : "MY ITEM DESSCRIPTION\rS:UK 5.5 - EU 39 - CC:126334" - We are calling the service `createShoppingListOrderItemAttribute` with `attrValue` set with the previous string. - this service has and safe html policy. ```xml ``` - the service fails because of security validation process. - we got puzzled and analyzed the code, and found this : UtilCodec:L538 ```java String filtered = policy.sanitize(value); String unescapeHtml4 = StringEscapeUtils.unescapeHtml4(filtered); String unescapeEcmaScriptAndHtml4 = StringEscapeUtils.unescapeEcmaScript(unescapeHtml4); // Replaces possible quotes entities in value (due to HtmlSanitizer above) to avoid issue with // testCreateCustRequestItemNote and allow saving when using quotes in fields if (filtered != null && !value.replace("", "'").replace("", "\"").equals(unescapeEcmaScriptAndHtml4)) { String issueMsg = null; if (locale.equals(new Locale("test"))) { // labels are not available in testClasses Gradle task issueMsg = "In field [" + valueName + "] by our input policy, your input has not been accepted " + "for security reason. Please check and modify accordingly, thanks."; } else { issueMsg = UtilProperties.getMessage("SecurityUiLabels", "PolicySafe", UtilMisc.toMap("valueName", valueName), locale); } errorMessageList.add(issueMsg); } ``` From what we understood, the input string is parsed as HTML and Javascript, and then compared to the initial string. If the initial and the parsed string are different, then there is a security issue, and an error is added to the service return. This causes us some questions and issues, with the example string above, and more specifically the `\r` string. Because the `StringEscapeUtils.unescapeEcmaScript()` parses the `\r` string as the **line break character**, and the comparison doesn't match. So for us, in this case, the security validation doesn't allow the string even though there is no security issue. Could someone give some guidance or explanation on why this is done like this ? Thanks a lot in advance
Re: IDEA plugin for OFBiz
Hello OFBiz community. I thought about it, and i would like to contribute my plugin to the OFBiz project, and to the APACHE foundation I made a demo video which is viewable at this link : https://www.youtube.com/watch?v=r3fLo04rnvc <https://www.youtube.com/watch?v=r3fLo04rnvc> So I come to you for several reasons first to see if someone would have any blocking reticences and second i have a few questions : * How would one commit this to the OFBiz Project ? Or where ? * How would one request a tweet from OFBiz or Apache official social networks ? * How would one ask to maybe edit a page of the Apache OFBiz site ? If there is anyone interested, i can propose a meeting to discuss these topics Thanks beforehand Gaetan OFBiz enthusiast and junior dev On 26/11/2021 17:32, Gaetan wrote: Thank you very much Jacques for your precious advice and your feedback. I'll work on a pull request to ofbiz-tools (which i didn't know about) or think about an other way to share the plugin, and see for a demo video. Once these are done properly, i can get started on other ideas you gave me. Gaetan OFBiz enthusiast and junior dev On 26/11/2021 17:05, Jacques Le Roux wrote: Le 26/11/2021 à 15:52, Gaetan a écrit : Hello OFBiz community, A few weeks ago, we made an announcement for an IDEA plugin for OFBiz. Though we didn't get any return on it, we'd like to insist on what this may bring to the community. It was designed to make OFBiz development easier, mostly for junior OFBiz devs. Seniors have their own habits for navigation towards service, entity, or file locations, but for a junior (such as me) it can be difficult at first. We made this as the tool I'd have liked to have when I began working with ofbiz. For example let's see this case (from `ContentManagmentServices.java`): ```java Map thisResult = dispatcher.runSync("createContent", contentContext); if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } ``` For a junior, it might be unclear where to find the definition of the `createContent` service. The plugin allows you to simply `CTRL+Click` on the service name to navigate towards the definition. As a bonus, you can even `CTRL+Click`the name of the label and navigate to the property definition. The same goes for entity name (and we plan to add a quick doc popup for fields contained in the entity definition). We really think this has the potential to soften the framework's first impression of complexity that some people might feel. Knowing that a tool exists to help you build with OFBiz could help a lot. The idea is to get feedback of the interest for the community and to eventually contribute it into Apache OFBiz repository. Is there a place to find OFBiz related tools, or should we let it in Github as it is (https://github.com/Nereide-lab/idea-ofbiz-plugin)? Gaetan, OFBiz junior dev and enthusiast. Hi Gaetan, It sounds like a great improvement for InteliJ users. Notably, as you mention, new comers. There is an official tools repository*. It could be the place to put this new tool to allow easy download, maybe not the best place though. But I think more should be done. It should be advertised using the usual tools: blog, tweeter, maybe a Youtube demo, etc. (see the official site**) I ever think that a dedicated page on the site should be created, or maybe a subpage of community, a word in the FAQ, etc. This said I'm an Eclipse old timer and I can't give any feedback on the tool itself ;) * https://gitbox.apache.org/repos/asf?p=ofbiz-tools.git and related https://github.com/apache/ofbiz-tools ** https://ofbiz.apache.org/ Jacques
Re: IDEA plugin for OFBiz
Thank you very much Jacques for your precious advice and your feedback. I'll work on a pull request to ofbiz-tools (which i didn't know about) or think about an other way to share the plugin, and see for a demo video. Once these are done properly, i can get started on other ideas you gave me. Gaetan OFBiz enthusiast and junior dev On 26/11/2021 17:05, Jacques Le Roux wrote: Le 26/11/2021 à 15:52, Gaetan a écrit : Hello OFBiz community, A few weeks ago, we made an announcement for an IDEA plugin for OFBiz. Though we didn't get any return on it, we'd like to insist on what this may bring to the community. It was designed to make OFBiz development easier, mostly for junior OFBiz devs. Seniors have their own habits for navigation towards service, entity, or file locations, but for a junior (such as me) it can be difficult at first. We made this as the tool I'd have liked to have when I began working with ofbiz. For example let's see this case (from `ContentManagmentServices.java`): ```java Map thisResult = dispatcher.runSync("createContent", contentContext); if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } ``` For a junior, it might be unclear where to find the definition of the `createContent` service. The plugin allows you to simply `CTRL+Click` on the service name to navigate towards the definition. As a bonus, you can even `CTRL+Click`the name of the label and navigate to the property definition. The same goes for entity name (and we plan to add a quick doc popup for fields contained in the entity definition). We really think this has the potential to soften the framework's first impression of complexity that some people might feel. Knowing that a tool exists to help you build with OFBiz could help a lot. The idea is to get feedback of the interest for the community and to eventually contribute it into Apache OFBiz repository. Is there a place to find OFBiz related tools, or should we let it in Github as it is (https://github.com/Nereide-lab/idea-ofbiz-plugin)? Gaetan, OFBiz junior dev and enthusiast. Hi Gaetan, It sounds like a great improvement for InteliJ users. Notably, as you mention, new comers. There is an official tools repository*. It could be the place to put this new tool to allow easy download, maybe not the best place though. But I think more should be done. It should be advertised using the usual tools: blog, tweeter, maybe a Youtube demo, etc. (see the official site**) I ever think that a dedicated page on the site should be created, or maybe a subpage of community, a word in the FAQ, etc. This said I'm an Eclipse old timer and I can't give any feedback on the tool itself ;) * https://gitbox.apache.org/repos/asf?p=ofbiz-tools.git and related https://github.com/apache/ofbiz-tools ** https://ofbiz.apache.org/ Jacques
IDEA plugin for OFBiz
Hello OFBiz community, A few weeks ago, we made an announcement for an IDEA plugin for OFBiz. Though we didn't get any return on it, we'd like to insist on what this may bring to the community. It was designed to make OFBiz development easier, mostly for junior OFBiz devs. Seniors have their own habits for navigation towards service, entity, or file locations, but for a junior (such as me) it can be difficult at first. We made this as the tool I'd have liked to have when I began working with ofbiz. For example let's see this case (from `ContentManagmentServices.java`): ```java Map thisResult = dispatcher.runSync("createContent", contentContext); if (ServiceUtil.isError(thisResult) || ServiceUtil.isFailure(thisResult)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentContentCreatingError", UtilMisc.toMap("serviceName", "persistContentAndAssoc"), locale), null, null, thisResult); } ``` For a junior, it might be unclear where to find the definition of the `createContent` service. The plugin allows you to simply `CTRL+Click` on the service name to navigate towards the definition. As a bonus, you can even `CTRL+Click`the name of the label and navigate to the property definition. The same goes for entity name (and we plan to add a quick doc popup for fields contained in the entity definition). We really think this has the potential to soften the framework's first impression of complexity that some people might feel. Knowing that a tool exists to help you build with OFBiz could help a lot. The idea is to get feedback of the interest for the community and to eventually contribute it into Apache OFBiz repository. Is there a place to find OFBiz related tools, or should we let it in Github as it is (https://github.com/Nereide-lab/idea-ofbiz-plugin)? Gaetan, OFBiz junior dev and enthusiast.
IDEA plugin for OFBiz
Hello OFBiz community, We are proud to present a plugin we've been working on for the last weeks, a plugin for OFBiz development for Intellij IDEA IDE. You can find instructions on how to install at the GitHub repo : https://github.com/Nereide-lab/idea-ofbiz-plugin You are most welcome to give us any feedback and bug-report (via the GitHub interface). We hope you enjoy this :) Gaëtan, from the team Néréide Néréide, intégrateur ERP Libre Apache OFBiz