ZeligsoftDev / CX4CBDDS

CX4CBDDS component modeling and generation tool
Apache License 2.0
8 stars 5 forks source link

CX Utilities/CodeGenUtil model validation bugs #23

Closed tuhin-github closed 4 years ago

tuhin-github commented 5 years ago

There have been instances where it seems that when Model Validation is done via the CX CodeGenUtils class, that sometimes no failures are returned when, if those models were selected individually and the "right-click-validate" option provided by RSA is selected, then the validation will fail. The CodeGenUtil class also returns some model errors where RSA shows the model as valid.

We use the CodeGenUtil object you provide to validate models, generate IDL, and generate descriptors in two different ways. We have written a bash script that invokes one of our Java classes to call the CodeGenUtil object’s “validateModel()”, “generateIDL()”, and “generateDescriptors()” methods. We also provide an Eclipse menu option for CX Utilities that allows users to check all models in their workspace and validate them or generate model artifacts for multiple models instead of the need to right click every model the RSA way. Both our command line tool and Eclipse menu option invoke the CodeGenUtil methods the same way.

We are seeing issues where model validation is not consistent with the RSA output (which seems to be the correct output). Comparing the output to the RSA “right-click” method of validating models and generating model artifacts, we have noticed some issues. The RSA right-click method correctly validates clean models and correctly invalidates broken models. The CodeGenUtil object validates models that the RSA right-click method finds errors in and finds errors where the RSA right-click method finds none.

J17359 commented 5 years ago

More information from email traffic:

We have seen about 2 different types of issues:

  1. The CX utilities provided to us, wrapped as a plugin that we can call from the command line finds issues that RSA does not a. Unfortunately, no information is provided, so creating a test model to give to you might takes some work b. We believe these issues might be false positives.
  2. The CX utilities provided to us, wrapped and called within eclipse as a menu contributor, does not catch model validation issues for UML modeling or the issues mentioned above. a. Specifically, it does not catch issues in Sequence and class diagrams b. A model to reproduce this is simple as any asynchronous/synchronous calls between life lines that have missing fields will show this c. The CX Utilities call from the command line, specified above does catch these errors.

One thing we would like is to have the validation capabilities be exactly the same as the RSA right click menu. If this can be done by tapping into IBMs API’s (if they exist) that might be the easiest route. Otherwise, we will continue working to gather the resources to provide you examples and possibly our plugin code for you to use to reproduce our issues.

elder4p commented 5 years ago

We have identified the difference between validation done from the CX Utilities and Validate menu item. A fix is currently being reviewed.

emammoser commented 4 years ago

In testing, We found two bugs.

  1. Now, in order to run CX validation, the models have to be open in the worspace otherwise we get a URI error. This renders our script useless as none of the projects are open when we spawn the test from the command line and makes using the tool from the workspace tedious.
  2. The validation tool finds errors in all DDS based models where a component port (DDS_Listen or Write) connects to a DDS EVENT. When debugging, I can see the statuses children and they all say "Status INFO: com.ibm.xtools.uml.validation code 25007 Connector "<> " must connect at least one required interface to a compatible provided interface. null

with a different error code of 12."

elder4p commented 4 years ago

@J17359 : Your utility is running headlessly, with a custom developed 'application', right? In order to open RSA models correctly, we moved to using IBM's UMLModeler class. But, that class requires a running workbench, which I imagine does not exist in your case.

If the above is the case, then the only solution I am aware of is to make your application start a workbench. You can see this pattern in the Eclipse Ant plugin, specifically, this class:

https://git.eclipse.org/c/platform/eclipse.platform.git/tree/ant/org.eclipse.ant.ui/Ant%20Tools%20Support/org/eclipse/ant/internal/ui/WorkbenchAntRunner.java

It starts a workbench, and installs an 'advisor' which gets notified when the workbench is up, allows Ant Runner to do the real work. When the advisor is done, it shuts down the workbench.

Also, we will look into disabling the offending IBM validation.

J17359 commented 4 years ago

@elder4p - That is correct. Our command line application tells Eclipse to headlessly run a Java plugin we wrote that invokes "CodeGenUtil"'s validate method on models we specify in a given Eclipse workspace.

I notice IBM's "UML Model Validation" menu option doesn't require the model to be opened first. Is this separate from this "workbench" you're talking about? Meaning, once we start this "workbench" we won't need to open models in order to validate them, correct?

elder4p commented 4 years ago

@J17359 : Yes, I believe that if you start a workbench from your 'headless' application, then magically, all the models will open for you.

elder4p commented 4 years ago

@tuhin-github : Can you test and confirm that CodeGenUtil will indeed open models that are closed. You can do your tests from a running workbench.

elder4p commented 4 years ago

@J17359 : In reviewing the current code, we discovered that CodeGenUtil was not correctly opening closed models. Pull request #34 has addressed this. Can you try your headless application again? It may be that you do not need to follow the headless-workbench pattern I suggested yesterday.

We are still investigating how to turn off that IBM validation on connections from pub-sub ports. That will be a separate commit.

J17359 commented 4 years ago

@elder4p We'll test our headless app against your master branch and get back to you. Thanks for the quick turn around!

emammoser commented 4 years ago

@elder4p The fix to allow us to open closed models works in both our headless application and when RSA is open. Also, I noticed the validation error that we see seems to be just an information message, but the returned status is marked as not okay (status.isOK() == false). Should we not use the IStatus method "isOK" but instead just check if the "getSeverity" method returns 2, 1 or 0? Or would you be able to have "isOK" return true if no errors occured??

elder4p commented 4 years ago

@J17359 : The documentation for [IStatus.isOK](https://help.eclipse.org/2019-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/runtime/Status.html#isOK()) says that is is true only if the status is "neither info, warning, nor error". You might change your code to:

IStatus status = ... do your call ...;
if (status.isOK() || status.matches(IStatus.INFO)) {
    ... everything is fine ...
}

By the way, you can OR together multiple status codes in matches(), if you want to check for multiple results.

J17359 commented 4 years ago

Thanks again @elder4p. @j26151 will make the Java changes on our end tomorrow to allow INFO statuses and test to make sure there are no other errors in our model validation (via both our command line app and our graphical util).

elder4p commented 4 years ago

@J17359 : Great. Once you've confirmed everything works, we'll close this issue (again).

emammoser commented 4 years ago

I believe everything looks good. Feel free to close the issue.

elder4p commented 4 years ago

Resolved via #24, #34 and #35. Closing