JDeveloper Auditing Framework (UKOUG Tech2013)
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

JDeveloper Auditing Framework (UKOUG Tech2013)

  • 2,708 views
Uploaded on

Presentation on Quality Assurance with the JDeveloper Auditing Framework, covering: ...

Presentation on Quality Assurance with the JDeveloper Auditing Framework, covering:
- how to use default auditing framework
- creating custom rules and fixes to implement company and project standards
- SuppressWarnings JDeveloper extension to suppresswarnings in XML files
- ADF Code Guidelines JDeveloper extension
- SonarQube plugin for JDeveloper (ojaudit)

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,708
On Slideshare
2,681
From Embeds
27
Number of Embeds
1

Actions

Shares
Downloads
45
Comments
0
Likes
1

Embeds 27

https://twitter.com 27

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Quality Assurance JDeveloper Auditing Framework
  • 2. About Us Richard Olrichs MN www.olrichs.nl @richardolrichs Wilfred van der Deijl The Future Group www.redheap.com @wilfreddeijl
  • 3. Agenda ● ● ● ● ● ● Audit Profiles and Preferences Audit JDeveloper Extension Project Creating Custom Rules Creating Custom Fixes SuppressWarnings Automated QA
  • 4. Aborts Compile On Error
  • 5. ● Applies default Fix ● Run analysis with single (or few) rules ● Example: Generate unique JSF component ID
  • 6. Custom Rules
  • 7. Custom Rules ● Setting up JDeveloper Extension Project ● Implementing Custom Rule ● Implementing Custom Fix
  • 8. Setting up JDev Project
  • 9. Setting up JDev Extension Project ● Install Extension SDK (Help>CheckForUpdates) ● File > New > Applications > Extension Application ● extension.xml and MANIFEST.MF ● Bundled as .ZIP ● Can be distributed through custom JDeveloper Update Center (aka network drive or URL)
  • 10. Creating Custom Rules
  • 11. Analyzing Java Code
  • 12. Analyzing XML Files
  • 13. Disables Analyzer for current construct and all children
  • 14. AuditContext ● Provides Traversal State ● report() for Violations, Metrics, Suppressions ● Holds State for Analyzer ○ Setting Attributes for Child Constructs ○ Setting Attributes for Parent Construct ○ (Sharing Attributes between Analyzers)
  • 15. ● AuditContext creates Analyzer State Keys ● enter() on root-node (Workspaces) invoked once, so can initialize keys
  • 16. Creating Custom Fix
  • 17. Transform subclass ● apply(context, construct) ○ applies fix by changing source ○ TransformContext argument contains editor location, violation, etc ○ Construct is the object with the violation (eg. a JavaMethod or XMLElement) ● isQueryRequired(context, construct) and query(context, construct) ○ queries the user for additional info when applying fix
  • 18. Violation Overload
  • 19. Violation Overload ● Even ADF Sample Application from OTN has 157 issues ● Too many violations cause developers to ignore all of them
  • 20. Violation Overload
  • 21. SuppressWarnings Java Annotation @SuppressWarnings annotation introduced in Java 1.5 and tells Java Compiler to suppress warnings
  • 22. SuppressWarnings Java Annotation JDeveloper 12c now also “listens” to annotation and suppresses warnings itself (not only javac)
  • 23. JDeveloper 12c Suppression Schemes
  • 24. JDeveloper 12c Suppression Scheme Why not create our own for non-Java (aka XML)?
  • 25. Suppress Warnings in XML
  • 26. Suppress Warnings in XML
  • 27. SuppressWarnings ● JDeveloper 12c natively supports @SuppressWarning in Java ● JDev extension adds <!-- SuppressWarning --> ● Extension available today ● JDeveloper 12c only as Suppression Schemes is new 12c feature
  • 28. Analyzer - Suppressing violations
  • 29. Transform - Creating XML Comment
  • 30. Audit Extension Project
  • 31. Audit Extension Project ● Project standards ● Company standards ● Community standards
  • 32. Audit Extension Project
  • 33. ADF EMG Extension Project
  • 34. ADF Code Guidelines Extension ● JDeveloper extension available today ● ADF Code Guidelines auditing during development ● Community project at java.net: adfemgauditrules ● Contribute and discuss at ADF EMG ● JDeveloper 12c only ○ at least for now. No reason why this can’t be backported to JDeveloper 11g
  • 35. Automated QA
  • 36. OJAudit ● Command line auditing ● JDEV_HOME/jdev/bin/ojaudit -help ● Output in XML/text/HTML or custom xsl
  • 37. Automated QA ● Simple solution: Run ojaudit from CI server and publish output ● Benefit: Same rules during development and CI QA ● @SuppressWarnings and <!--SuppressWarning--> keep list of violations short and actionable
  • 38. Automated QA SonarQube
  • 39. SonarQube ● ● ● ● ● ● Tool to manage Code Quality Rules, Violations, Metrics, Test Coverage, etc Free Open Source Initially Java, but now 20+ languages Historical data, thus trends Highly extensible through plugins
  • 40. ADF EMG SonarQube plugin ● SonarQube plugin ○ runs ojaudit ○ converts ojaudit output to SonarQube violations ● ● ● ● www.sonarqube.com for base product Watch ADF EMG for availability of plugin Not specific to ADF, but for any JDev project Tested with JDeveloper 12c, but should work with any version
  • 41. Further Reading ● www.olrichs.nl ● www.redheap.com ● ADF Enterprise Methodology Group ○ Google Groups ● http://docs.oracle.com JDeveloper Doc (not ADF documentation) ○ Developing Extensions for JDeveloper ○ Java API Reference for Extension SDK
  • 42. Summary ● ● ● ● ● ● Audit Profiles and Preferences Creating Custom Rules Creating Custom Fixes SuppressWarnings JDev Extension ADF Code Guidelines JDev Extension SonarQube ojaudit plugin