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

DROOLS-4249: Implement client-side marshalling #1306

Merged
merged 17 commits into from Feb 18, 2020

Conversation

yesamer
Copy link
Member

@yesamer yesamer commented Feb 10, 2020

@jomarko @danielezonca
This PR introduces the client-side marshalling for SCESIM Kogito project (part of 3879 ticket)

https://issues.redhat.com/browse/DROOLS-4249

@yesamer yesamer marked this pull request as ready for review February 11, 2020 13:03
@yesamer yesamer requested a review from jomarko February 11, 2020 13:06
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.

Is it OK that in target we have mix of classes and java files?
java

  • target/classes/org/drools/workbench/scenariosimulation/kogito/marshaller/jre/javax/xml/

class

  • target/classes/org/drools/workbench/scenariosimulation/kogito/marshaller/js/

Comment on lines +19 to +27
<properties>
<jsinterop-annotations.version>1.0.2</jsinterop-annotations.version>
<jsinterop-base-version>1.0.0-beta-1</jsinterop-base-version>
<jsonix-scripts.version>3.0.0</jsonix-scripts.version>
<js.destination>${project.basedir}/src/main/resources/org/drools/workbench/scenariosimulation/kogito/marshaller/js</js.destination>
<gwt-jsonix-schema-compiler.version>1.1.0</gwt-jsonix-schema-compiler.version>
<gwt-interop-utils.version>0.3.0</gwt-interop-utils.version>
<maven-jaxb2-plugin.version>0.14.0</maven-jaxb2-plugin.version>
</properties>
Copy link

Choose a reason for hiding this comment

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

@manstis @yesamer is it expected that the list of dependencies differ slightly from DMN? I do not mean versions.

https://github.com/kiegroup/kie-wb-common/blob/master/kie-wb-common-dmn/kie-wb-common-dmn-webapp-kogito-marshaller/pom.xml

Copy link
Member Author

@yesamer yesamer Feb 12, 2020

Choose a reason for hiding this comment

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

@jomarko @manstis This is a good point, thank you to raise it. I'll analyze the differences. At first glance, a change in DMN side is required for gwt-jsonix-schema-compiler, in my understanding 1.1.0 is the last version generated by @gcardosi

Copy link

Choose a reason for hiding this comment

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

Copy link
Member Author

@yesamer yesamer Feb 12, 2020

Choose a reason for hiding this comment

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

@jomarko

                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-basics</artifactId>
                </plugin>
                <plugin>
                  <groupId>org.jvnet.jaxb2_commons</groupId>
                  <artifactId>jaxb2-namespace-prefix</artifactId>
                </plugin>

It seems that jaxb2-namespace-prefix version.jaxb2-basics are sub plugin used in maven-jaxb2-plugin together with gwt-jsonix-schema-compiler. IDK why these 2 plugins are required in DMN and NOT in SCESIM. @manstis do you have any idea?

Copy link
Member

Choose a reason for hiding this comment

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

IDK if they're required..

It could be they're dead baggage that can be tidied up (when @jomarko looks at the JIRA he reported).

Copy link
Member Author

Choose a reason for hiding this comment

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

@manstis Thank you! @jomarko probably another "cleanup" change required in DMN is the one spotted by @danielezonca: remove Errai.properties and beans.xml files which should be useless in this module.


@Override
public String toString() {
if (getNamespaceURI().equals(XMLConstants.NULL_NS_URI)) {
Copy link

Choose a reason for hiding this comment

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

Could we please use Objects.equals also here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jomarko I don't see problems do to that, done!

@jomarko
Copy link

jomarko commented Feb 12, 2020

I am also wondering if we should test at least somehow this PR #1309

@yesamer
Copy link
Member Author

yesamer commented Feb 12, 2020

Is it OK that in target we have mix of classes and java files?
java

  • target/classes/org/drools/workbench/scenariosimulation/kogito/marshaller/jre/javax/xml/

class

  • target/classes/org/drools/workbench/scenariosimulation/kogito/marshaller/js/

Considering these files are in resources folder and according to package-info of jre package:

/**
 * Container for GWT "super source" files where GWT does not provide an emulation of JRE classes.
 * See http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html
 */

It seems correct to me. I can dig more on it, anyway.

@yesamer
Copy link
Member Author

yesamer commented Feb 12, 2020

I am also wondering if we should test at least somehow this PR #1309

@jomarko @manstis
About Unit Tests: I agree with you we need to add it. BUT, I would like to use the same approach used in DMN Editor. In my understating, kie-wb-common-dmn-webapp-kogito-marshaller doesn't contains ANY test. All unit tests related to that module are in kie-wb-common-dmn-webapp-kogito-marshaller-tests. Then, my idea is to follow the same approach on SCESIM, and to manage it in a separate ticket after I'll completed ticket 3879. WDYT?

@manstis
Copy link
Member

manstis commented Feb 13, 2020

@yesamer After extensive investigation writing tests for the marshaller in kie-wb-common-dmn-webapp-kogito-marshaller-tests was proving impossible (long story short: we need to run the real JavaScript which means we needed to use GWTTestCase however this uses a library that emulates a real browser and some of the implementation of browser objects returned different results to using a real browser.

Therefore the decision was made to extend @jomarko Selenium tests to also handle marshalling tests. The result is this PR...

@yesamer
Copy link
Member Author

yesamer commented Feb 13, 2020

@yesamer After extensive investigation writing tests for the marshaller in kie-wb-common-dmn-webapp-kogito-marshaller-tests was proving impossible (long story short: we need to run the real JavaScript which means we needed to use GWTTestCase however this uses a library that emulates a real browser and some of the implementation of browser objects returned different results to using a real browser.

Therefore the decision was made to extend @jomarko Selenium tests to also handle marshalling tests. The result is this PR...

@manstis Yes, I remember part of the story and your mails about that topic. I didn't know kie-wb-common-dmn-webapp-kogito-marshaller-tests was planned to be totally removed. I expected that some kind of tests were possible, and in particular tests that checks JSInterops model classes are correctly generated (eg. #1309 wrote by @jomarko, which checks the number of generated model file is the one expected )
Considering this, I think the kind of test proposed by @jomarko are reasonable and are the only way to "unit test" the module.

@manstis
Copy link
Member

manstis commented Feb 13, 2020

@yesamer I could have the same type of test as @jomarko has written but note it is in drools-wb-scenario-simulation-editor-kogito-marshaller (and not a -kogito-marshaller-tests module!)

@yesamer
Copy link
Member Author

yesamer commented Feb 13, 2020

@yesamer I could have the same type of test as @jomarko has written but note it is in drools-wb-scenario-simulation-editor-kogito-marshaller (and not a -kogito-marshaller-tests module!)

@manstis
Perfect, better use a common strategy. We'll do the same. Thanks!

@yesamer yesamer requested a review from jomarko February 13, 2020 11:13
@yesamer
Copy link
Member Author

yesamer commented Feb 13, 2020

jenkins retest this please

* **Callbacks**: Callbacks to be called during a marshall/unmarshall call. automatically generated by
_maven-jaxb2-plugin_ plugin in _js/callbacks_ package
* **SCESIMMainJS**: JSInterop adapter to use for marshalling/unmarshalling, which refer to _SCESIMMainJS.js_
its javascript representation. Thus u
Copy link

Choose a reason for hiding this comment

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

Thus u?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jomarko Completed.

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
Copy link

Choose a reason for hiding this comment

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

shouldn't be disabled just for special folders?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jomarko good point, done!

/**
* @type {{marshall: MainJs.marshall, unmarshall: MainJs.unmarshall}}
*/
SCESIMMainJs = {
Copy link

Choose a reason for hiding this comment

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

isn't this automatically generated? do we need to track it?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jomarko That class is not automatically generated

@yesamer yesamer requested a review from jomarko February 17, 2020 13:43
@sonarcloud
Copy link

sonarcloud bot commented Feb 17, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@yesamer
Copy link
Member Author

yesamer commented Feb 17, 2020

@danielezonca can you please merge it in master? Thanks

@danielezonca danielezonca merged commit aace9e4 into kiegroup:master Feb 18, 2020
@yesamer yesamer deleted the DROOLS-4249 branch February 18, 2020 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants