Technical Articles
Groovy IDE Fixes, Feedback Form, and Desktop Beta
Groovy IDE had some basic flaws! Thanks to Philippe Addor‘s high-quality feedback, they are fixed and every user in the community benefits from the result!
Fixes
1.Confusing “Connection Error” in the console.
This error could occur for other reasons and mislead the user so I just changed it to “Error”
2.Missing Groovy DateUtil Extensions functions
This code is now working:
def date = new Date()
date = date.minus(days)
3.Completely wrong getBody function!
As I discussed in my previous blog post message.getBody can use different class types. But the first implementation in Groovy IDE was wrong. It took some encouragement from the community to fix it ?
There is another community member(whose profile I wait for permission to share. Edit: Thanks momin alim-ahmed !) that made me aware that org.w3c.dom.Document works on CPI.
After the fixes, it works with InputStream as default
//This is InputStream
def body = message.getBody()
def root = new XmlSlurper().parse(body)
You can also use Reader as it is common in the examples.
Reader reader = message.getBody(Reader)
def root = new XmlSlurper().parse(reader)
Feedback Form
I have also added a feedback form! Just click on the “Give Feedback” button. If you have any issues with the code that works on CPI, you can send the problematic case with a Groovy share link so I can analyze it. You can also send your ideas about UI and other useful tools.
Desktop Beta
This can be interesting! I have published a version that works on Windows 10. You can download it from the Microsoft Store:
https://www.microsoft.com/en-us/p/groovy-ide/9n7z5k1vrhb3
If you ever wanted to work on Groovy mappings while you are on a plane, you can do easily now 🙂 Feel free to comment if offline functionality is important for you, so I can plan to spend more time on its development.
See you in the next post! Until then I’m waiting for your ideas!
Hi Faith Pense,
Really Nice one, Thanks for the offline one.
Thanks and Regards,
Vijay
Hello Vijay,
I'm glad you find it useful! If you have any ideas for making better, I'm always listening!
Regards,
Fatih
Hi Fatih,
Thank you for your contribution I have been using it for a while and it is great.
Although I am having different results from the tool and the CPI iFlow script step.
Example: Running the exact script on CPI and the tool.
Snippet:
Hi Ricardo,
A very interesting finding, thanks for writing.
I have been notified about another difference for JSON processing. I sometimes think that I should also include these bugs into my simulation runtime so it becomes bug-for-bug compatible. It is not easy to achieve though. At least I should document them so everyone can see and benefit.
I guess, it is also a hard situation for CPI maintainers. If there are some integrations that depend on the current behavior(even if it has bugs) then they can't update. I can only speculate, maybe they can add another explicitly-chosen version of the script step and encourage the migration over time.
For your "Set" example, I would also expect unique values as a result. It would be more interesting if it is about versions. Since I can't ever use the exact same runtime code, I went with Java 11 and Groovy 2.5.10(to be able to use Java 11). I plan to update the Java version in the future for fun & profit. Ideally, it should not break anything, since it is still a minor version update for Groovy.
Thanks for your feedback.
Regards,
Fatih