Friday, March 5, 2010

Red Samurai Tool - JDeveloper 11g Extension to Validate ADF Code Quality

I was working long on JDeveloper 11g extension for ADF 11g code quality checks. Finally it is available for public use - first release. This release is based on my Oracle Forms to Oracle Fusion 11g migration experience.

You can download extension - redsamuraiqt_1_0.zip and install it through JDeveloper Update wizard. It is available directly from Oracle JDeveloper Open Source and Partners Extension update center as well. Additionally, you can download sample project I'm using for this post - RedSamuraiToolTestSample.zip.

When you will run it, first screen will be welcome screen:


Next, you will be given with a list of rules to be applied for ADF code quality validation:


And finally, we have confirmation screen:


Extension can be customized through JDeveloper Preferences wizard:


You can install redsamuraiqt_1_0.zip extension through JDeveloper Check for Updates wizard from local file:


Or simply to download it from Open Source and Partner Extensions update center:


In order to invoke Red Samurai tool, right click on Model or ViewController project and select RedSamurai QT option:


To demonstrate extension functionality, I decided to show how you can ensure all View Objects contain ORDER BY clause:


It will report rule violations - View Object name and rule title:


Then you go to View Object screen and add ORDER BY clause:


If same rule is applied again, no more violations will be reported:


Another example - page title. We may have a rule to ensure all page titles are coming from Message Bundle file. If developer forgot to use title from Message Bundle and typed hard coded value:


Let's run Page Document Title rule:


Tool will generate report document, where violation will be reported:


It says that page title must be used from Message Bundle and property key should have specific value. I correct this violation and map page title to Message Bundle entry:


You can check,  Message Bundle reference should be included:


Run same rule again, no violations now:


Check for my next blog posts on the same topic - I will post updates and extension improvements.

36 comments:

  1. Very impressive and a really good idea. Will evaluate it soon.

    ReplyDelete
  2. Thanks Aino, in my next posts I will describe more how to use the rest of the rules.

    ReplyDelete
  3. I haven't been able to play around enough yet to validate how effective it is, but this is just very neat. Great idea.

    ReplyDelete
  4. Thanks, its first release - so if you will notice any issue or problems - please submit. Will be happy to improve it ;)

    ReplyDelete
  5. whether customers can add his/her own rules in a simple way. or we can only request you to satisfy new requests.

    ReplyDelete
  6. Hi Tina,

    Technically, we designed it in a such way, that it will allow customers to plug their own rules. However, in first release this functionality is disabled.

    Regards,
    Andrejus

    ReplyDelete
  7. Good stuff. Don't let Oracle to steal your idea & asset. Thanks.

    ReplyDelete
  8. Thanks, if there will be something similar from Oracle, I will be only happy - it will make ADF popular even more. From our side, we will continue to do updates for this extension, based on most common problems we encounter in ADF projects.

    ReplyDelete
  9. Hi, I use jdev 11g latest. Where should I look for JDeveloper Update wizard? Can you help me to install? Thanks.

    ReplyDelete
  10. Hi,

    You can open this wizard through Help -> Check For Updates.

    Regards,
    Andrejus

    ReplyDelete
  11. Thanks. I have installed it using wizard through Help -> Check For Updates. I have opened your test jws using jdev 11g. Now, how do I open the testing tool?

    ReplyDelete
  12. Hi,

    Please read this blog post - I describe "In order to invoke Red Samurai tool, right click on Model or ViewController project and select RedSamurai QT option"

    Regards,
    Andrejus

    ReplyDelete
  13. Hi,

    when i invoke
    'Entity Attribute Label Control Hint' i got al lot of violations with"Label not found on attribute 'XYZ'".
    All EO was created with 'Business Components Wizard from Tables' and i cannot find the right place where i can set a label for a EO attibut.

    Please, could you give some suggestions for using this rule?

    Thanks in advance
    Andre

    ReplyDelete
  14. Hi,

    You can double click on attribute name in Entity and go to Control Hints section. There you will find Label property.

    Regards,
    Andrejus

    ReplyDelete
  15. Out of curiosity, is this leveraging JDeveloper's Audit framework? If not, what did you need to do in your extension that the Audit system couldn't provide?

    ReplyDelete
  16. Hi Mark,

    JDeveloper's Audit provides standard ADF validation. We are implementing logical validation, based on different rules, for example - check if table component is inside panel collection.

    Regards,
    Andrejus

    ReplyDelete
  17. I would like to find every table that has the contentDelivery attribute either missing or set to the default of "whenAvailable" How would I do that? We need to change those to be either lazy or immediate so that our performance testing tool sees the same number of http requests on the playback as it saw on the recording.

    ReplyDelete
  18. Hi,

    We can add this functionality (or any other requested). You can forward your request to abaranovskis at redsamuraiconsulting dot com

    Thanks,
    Andrejus

    ReplyDelete
  19. Is there an option for customizing or adding a new rule

    ReplyDelete
  20. Hi,

    Its not supported in current version, but we could add this feature on customer request.

    Thanks,
    Andrejus

    ReplyDelete
  21. Andrejus,

    When will your extension be available for 11.1.2?

    I tried installing it and it didn't throw an error, but it also didn't show up under the "Project Properties"

    ReplyDelete
  22. Hi,

    Thanks for your interest. We are planning to add support for JDev 11 R2, from next patch set of JDeveloper.

    Andrejus

    ReplyDelete
  23. Hi Andrejus,
    I am a member of a project which is developed as a Oracle ADF Fusion Middleware Webapp. We use JDeveloper 11.1.2.0.0. As you say in this post it does not support JDeveloper R2. Now does it?

    Regards !
    Sameera

    ReplyDelete
  24. Hi,

    No it doesnt support R2. Unless some customer will ask us to migrate to R2.

    Regards,
    Andrejus

    ReplyDelete
  25. Hi Andrejus,

    Thats so cool and helpful:-)

    ReplyDelete
  26. I just downloaded the tool, its freaking cool :-)

    Thanks

    ReplyDelete
  27. Hi

    Could you please point me to source code for this tool... thanks.

    ReplyDelete
  28. Hi,

    We distribute source code only to the customers. You can download JAR...

    Andrejus

    ReplyDelete
  29. hi andrejus,

    How can we make it to work if our VO,EO,AM are in such packages like com.company.model.employee.views
    com.company.model.department.views

    ReplyDelete
  30. You can change package naming config in the settings. We are working now on the next version, improved and easier - we will announce it later in the year, close to UKOUG.

    Andrejus

    ReplyDelete
  31. Hi Andrejus, is there any way to run Red Samurai Tool in command line in order to embed the tool in a Hudson job (while building the application or a job that only validates the code quality)?

    ReplyDelete
  32. Possible, but not in the public version.

    Regards,
    Andrejus

    ReplyDelete
  33. Hi Andrejus,is this tool compatible with Jdeveloper Studio Edition Version 12.1.3.0.0...?

    if possible please provide the download link.

    Thanks in Advance.

    ReplyDelete
  34. For ADF 12c, you should use ADF EMG Rules.

    Andrejus

    ReplyDelete
  35. Hello Andrejus,
    The tools is not available for download for ADF 11g currently, the link seems to be broken.
    Please can you help and/or fix the link so that we can download the tool.
    Thanks.

    ReplyDelete