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

KOGITO-2651 : Allow expressions in output assignments #3363

Merged
merged 2 commits into from
Aug 14, 2020

Conversation

inodeman
Copy link
Contributor

Hi @romartin @handreyrc can you review this PR? Change is simple, there was a check before to show a warning if the variable is output and expression. I removed the custom message and constants and updated test code. Let me know

@inodeman
Copy link
Contributor Author

Jenkins execute full downstream build

@inodeman
Copy link
Contributor Author

Jenkins execute compile downstream build

@romartin romartin requested review from hasys and romartin August 3, 2020 14:37
@inodeman
Copy link
Contributor Author

inodeman commented Aug 4, 2020

Jenkins execute compile downstream build

Copy link
Member

@hasys hasys left a comment

Choose a reason for hiding this comment

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

Hi @inodeman,

looks good to me, just couple of minor nitpick. Thank you!


assertNull(view.getModel().getExpression());
view.setExpression("{hello}");
assertEquals(view.getModel().getExpression(), "{hello}");
Copy link
Member

Choose a reason for hiding this comment

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

New test doesn't test constant, but expression. So {hello} should be reverted back to hello.

Copy link
Contributor

@romartin romartin Aug 6, 2020

Choose a reason for hiding this comment

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

I don't see the issue yet @hasys here, what you mean? I understand the view has some model which contains an expression field (String). The expression has to be set using some syntax (eg: {expr}), also the view shows the raw expression (with complet syntax) on the UI field, which makes sense to me also because this way the view is "agnostic" to the expression syntax (that's maybe a presentation stuff). So for me looks fine to return the {hello} back from the view.getModel().getExpression()...
As an example, think on the view just being an HTML input element - you would write the complete text with syntax as the value, also you'll expect the same value when you obtain it's value.
WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

@inodeman what's wrong here is the order of the arguments for the assertEquals, the first one is the expected value, and second one is the actual. So please try to fix those, if any others. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Hi @romartin, yes it's a bit frustrating. Main idea was to allow put constants to the output value. But test was changed from test Constants to test Expression. So it was possible to set expression before as well, but wasn't possible to set Constants but after the change constants aren't tested any more.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok so if I understand properly @hasys - the actual test case is ok but it's still missing to test the Constants option, is that correct?
Also please @inodeman remember to change the order for the arguments for assertXXX methods.
Thanks guys!

Copy link
Member

Choose a reason for hiding this comment

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

Yes @romartin, you are right. Just sum up: {hello} - is expression and hello - is a constant. Constant already tested in another method and this test method was specifically created to test Expression.

Any way @inodeman already fixed it so thank you guys!

getModel().setExpression(expression);
}
}

private static boolean isConstant(String expression) {
Copy link
Member

Choose a reason for hiding this comment

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

Method can be removed now since it had only one invocation.

notification.fire(new NotificationEvent(StunnerFormsClientFieldsConstants.INSTANCE.Only_expressions_allowed_for_output(),
NotificationEvent.NotificationType.ERROR));
processVarComboBox.textBoxValueChanged("");
} else {
getModel().setExpression(expression);
Copy link
Member

Choose a reason for hiding this comment

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

Some spaces can be removed here since it is now on method level.

@inodeman
Copy link
Contributor Author

inodeman commented Aug 6, 2020

Jenkins execute full downstream build

@romartin
Copy link
Contributor

Hey @inodeman, this needs rebase plz

@inodeman
Copy link
Contributor Author

Jenkins execute full downstream build

@inodeman
Copy link
Contributor Author

Hi @romartin rebased, tested and builds re-fired

@sonarcloud
Copy link

sonarcloud bot commented Aug 10, 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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

warning The version of Java (1.8.0_202) you have used to run this analysis is deprecated and we will stop accepting it from October 2020. Please update to at least Java 11.
Read more here

@romartin
Copy link
Contributor

@inodeman @hasys what's missing here guys? Please try to move this forward ASAP. Thx!

@hasys
Copy link
Member

hasys commented Aug 14, 2020

Hi @romartin, @inodeman all is green, PR is ready for merge. Thank you!

@romartin romartin merged commit 11d4a23 into kiegroup:master Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants