kiegroup / drools-ansible-rulebook-integration

Apache License 2.0
1 stars 9 forks source link

[DROOLS-7590] Handle "action" and "actions" in JSON #92

Closed tkobayas closed 11 months ago

tkobayas commented 11 months ago

While I'm working on Impact Analysis to parse ansible-rulebook rules, I noticed that "action" and "actions" are not well tested. "actions" is even ignored.

JSON coming from ansible-rulebook/drools_jpy are pasted in this JIRA and ActionTest in this PR.

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

tkobayas commented 11 months ago

Hi @mariofusco , please review.

As we have 2 types of JSON format (action and actions), I had to have action and actions in Rule class.

While JSON have to choose one of action and actions, in Java side, I make both getAction and getActions work. If you feel it's not appropriate, please let me know.

Btw, the mapping to MapAction doesn't utilize the defined action like AssertFact, PostEvent etc. Just put the data into LinkedHashMap at the moment. Action is not actually used in the Java side anyway, so it doesn't have an impact at the moment. I guess I will improve this area along with Impact Analysis work.