Posts Tagged JDeveloper

Find problems when you develop: using XRebel with Oracle ADF

Some days before ZeroTurnaround has released XRebel , a new tool to recognized problems in your web applications, when you make your developer test.

This was promising, so I give it a short try for Oracle ADF applications. For this blog I use the Summit ADF application, delivered by Oracle, but I have tried with our own application too. Test is done in JDeveloper 12.1.2.

After the download there are some easy steps of setup to do:

First thing is to change an existing or add a new run configuration:
2014-06-30 07 09 28

2014-06-30 07 09 38

Then edit this configuration

2014-06-30 07 09 45

and add XRebel path as described in the documentation:

2014-06-30 07 11 16

Save the configuration by pressing OK two times.

Then open your Page and run it via the run configuration:

2014-06-30 07 12 39

As First you see one time a dialog to request and enter the trial license.

Then you see the XRebel widget on the left side and after waiting some little time the first issues are shown.

2014-06-30 07 28 34

From the default configuration (which can be changed with the gear in the widget) there seems a problem with the size of the session and with SQL Queries. If you drill down to the queries tab on the SQL page you see the execute queries, sorted by execution time, maybe the app should execute some of the queries at least not before changed to the tab, where it is used?

2014-06-30 07 29 20

2014-06-30 07 29 27

If you look at the session size, then interesting is, that most of the session size is hold on the ODL log manager. Maybe oracle should think about this result, maybe there is a better way to hold this data.

2014-06-30 07 32 32

So download XRebel and give it chance on your ADF application.

, , , , ,

Leave a comment

Slides for my german presentation “Quality Assurance for ADF projects” available

I have presented today on DOAG Development 2014 in Dusseldorf. For all non DOAG members – you can find the german presentation on slideshare too.

2014-Development_Banner-Speaker-180x180

, , , , , , , , , , , , , , , , , ,

Leave a comment

Quality Assurance for ADF projects

If you speak german and you are interested in quality assurance for your ADF projects you should come and attend my presentation at DOAG Development on 06/04/2014 in Dusseldorf.

I will show you, how you can implement in the JDeveloper IDE and in Continous Integration server Jenkins:

  • static code analysis with PMD, FindBugs and Checkstyle
  • Task’s
  • Commit tests with JUnit, Mockito and Powermock for Mockito
  • Code coverage for commit tests with JaCoCo
  • Acceptance tests with JUnit and Selenium

See you!

2014-Development_Banner-Speaker-180x180

, , , , , , , , , , , , , , , , , ,

2 Comments

Deploy your ADF Mobile App to a virtual Android device from JDeveloper IDE

If you tired from the android emulator speed you may have read Chris Muir’s article ADF Mobile: Avoiding the Android Emulator with AndroVM.

In the meantime the successor of AndroVM is GENYMOTION.

If you have configured the port forwarding section from the AndroVM or use GENYMOTION, then you have to deploy your ADF Mobile app first to apk-File and manually install this into to the virtual android image via the android sdk command adb. The virtual Android device must be started to do this.

To do the last step from JDeveloper IDE directly with 1 click following steps help to reach this:

  1. Convention over configuration: Name all of your deployment profiles for android with the same name, eg. all adf mobile samples use the name “ANDROID_MOBILE_NATIVE_archive1″
  2. Create in JDeveloper an external tool
    1. Select from the menu Tools -> External Tools … -> New
    2. Select Tool Type: External Program

    3. Select Program Executable: adb.exe from your Android SDK
      Enter Arguments: install ${workspace.dir}\deploy\ANDROID_MOBILE_NATIVE_archive1\${file.name.no.ext}.apk

    4. Enter Caption for Menu Items, eg.: Install apk file to virtual Android device

    5. Select Add Items to Menus: Navigator Context Menu

    6. Select Enabled When Specific File Types are selected: Application

Now you first deploy your Application to an Android package:

Then you can install this via application context menu directly to your virtual android devive:

Now you can test your app in the virtual Android device:

That’s it!

Chrysanth WebStory Published by WebStory

, , , , ,

11 Comments

Write ADF static code analysis rules with PMD and running these in JDeveloper

Do you know, that PMD can analyse XML files since version 5? Many of ADF files are XML configuration files – wouldn’t it be a good idea to create some static code analysis rules for ADF too?

Unfortunatly oracle configuration files in most times create references to dtd’s, which are not exist anywhere in the path. Till PMD 5.0.1 such files results in errors, as PMD tries to validate this doctype. I have switched of this validation in PMD release 5.0.2.

Following article requires configuration of PMD as described in my blog PMD Integration with JDeveloper through Ant External Tools.

You can download all requried files from here.

Let’s start from the beginning.

  1. At the moment PMD only provide XML check’s against files with the extension *.xml, there is a feature request to change this behaviour. So at the moment, we have to change the code by ourself to reach the result. Load the the 5.0.4 source code.
  2. Look for the file src\main\java\net\sourceforge\pmd\lang\Language.java and replace the line
    XML(“XML”, null, “xml”, XmlRuleChainVisitor.class, “xml”);
    with
    XML(“XML”, null, “xml”, XmlRuleChainVisitor.class, “xml”, “jws”, “jpr”, “cpx”, “xcfg”, “dcx”, “jpx”);
  3. Change to directory pmd-src-5.0.4
  4. set JAVA_HOME, e.g. to your 1.6 JDeveloper jdk
  5. run “mvn clean package”, I have succesfully used maven 2.2.1 from <JDev-Home>\jdeveloper\apache-maven-2.2.1\bin
  6. If you don’t need further extensions, you can instead running steps 2 till 5 the resulting pmd-5.0.4.jar from my side.
  7. Replace the file pmd-5.0.4.jar in pmd-bin-5.0.4\lib (see my previous blog) with the downloaded file or the file from pmd-src-5.0.4\target
  8. Now is the time to create the first adf static code analysis rule. In the adf architecture course I attend, there was a rule, that the taskflow behaviour “No controller transaction”
    should not be mixed with the other option of this selection list

    In the sourcecode this property is described through the absence of the node adfc-config/task-flow-definition/transaction, the other options create this node and additional child nodes, here e.g. for the option “Always create new transaction”
  9. In PMD you can create two kind of rules: Java and XPath. For our xml Files XPath should be the efficient option. We have to put our configuraration e.g. in file my_pmd_rules.xml in the same directory as pmd.xml in the last blog. For the above rule the XPath query in line 14 find nodes, which does not contain the transaction node
    <?xml version="1.0"?>
    <ruleset name="Oracle ADF rules" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
    <description>This ruleset checks Oracle ADF code for bad stuff</description>
    <!-- ADF Rules ############################################################################################### -->
    <rule name="OracleAdfTaskflowShouldNotHaveNoControllerTransaktion" since="5.0" language="xml"
    message='ADF tasklows should normally not contain transaktion behavior "No Controller Transaction"'
    >
    <priority>1</priority>
    <properties>
    <property name="xpath">
    <value><![CDATA[
    adfc-config/task-flow-definition[not(transaction)]
    ]]></value>
    </property>
    </properties>
    </rule>
    </ruleset>
    
  10. Now we have to change the configuration file pmd.xml from the last blog in the marked lines to call our new configuration and run this on files with defined Extensions
    <?xml version="1.0" encoding="windows-1252" ?>
    <project xmlns="antlib:org.apache.tools.ant" name="Project1" default="all" basedir=".">
    <path id="classpathForPMD">
    <fileset dir="pmd-bin-5.0.4\lib">
    <include name="**/**.jar"/>
    </fileset>
    </path>
    <taskdef name="pmd" classpathref="classpathForPMD" classname="net.sourceforge.pmd.ant.PMDTask"/>
    <target name="pmdAll">
    <echo message="PMD is running on directory ${dir}" level="info"/>
    <pmd rulesetfiles="my_pmd_rules.xml" failOnRuleViolation="true" minimumPriority="1">
    <fileset dir="${dir}">
    <include name="**/*.java"/>
    <include name="**/*.xml"/>
    <include name="**/*.jws"/>
    <include name="**/*.jpr"/>
    <include name="**/*.cpx"/>
    <include name="**/*.xcfg"/>
    <include name="**/*.dcx"/>
    <include name="**/*.jpx"/>
    </fileset>
    </pmd>
    </target>
    </project>
    
  11. Now call again pmd from the Fusion Order Demo Application StoreFrontModule
  12. You can see the results for xml in the message pane. Unfortunatly the direct jump to violated files does not work at the moment as pmd delivers for every xml violation -1 as line, but I have created an bug for this

That’s it.

Maybe somebody has an idea, where we can build an extension exchange for ADF rules, e.g. for creating rules for ADF Code Guidelines v1.00 or ADF Naming and Project Layout Guidelines v2.00?

Remember: you are not restricted to ADF files, e.g. we do checks to for JDeveloper application (*.jws) and project files (*.jpr) as well, as this are xml files too. The configuration you see already in step 2.

Chrysanth WebStory Published by WebStory

, , , , ,

Leave a comment

PMD Integration with JDeveloper through Ant External Tools

In the past I read following blogs from Shay Shmeltzer:

Now (after little code change in pmd) this integration is possible. I use here JDeveloper 11.2.0.4, with other versions this should be very similar. Now let’s start:

1. Create a new folder
2. Download PMD 5.0.4
3. Extract the zip file into the created folder
4. Create a file pmd.xml into the created folder
5. Enter following code into the file pmd.xml:

<?xml version="1.0" encoding="windows-1252" ?>
<project xmlns="antlib:org.apache.tools.ant" name="Project1" default="all" basedir=".">
    <path id="classpathForPMD">
        <fileset dir="pmd-bin-5.0.4\lib">
            <include name="**/**.jar"/>
        </fileset>
    </path>
    <taskdef name="pmd" classpathref="classpathForPMD" classname="net.sourceforge.pmd.ant.PMDTask"/>
    <target name="pmdAll">
        <echo message="PMD is running on directory ${dir}" level="info"/>
        <pmd rulesetfiles="rulesets/internal/dogfood.xml" failOnRuleViolation="true" minimumPriority="1">
            <fileset dir="${dir}">
                <include name="**/src/**/*.java"/>
            </fileset>
        </pmd>
    </target>
    <target name="pmd">
        <echo message="PMD is running on file ${dir}\${file}" level="info"/>
        <pmd rulesetfiles="rulesets/internal/dogfood.xml" failOnRuleViolation="true">
            <fileset dir="${dir}">
                <include name="${file}"/>
            </fileset>
        </pmd>
    </target>
</project>

6. Select Tools – Exernal Tools from the JDeveloper menu
7. Press Button New
8. Select Tool Type: Apache Ant
9. Select your created pmd.xml file in Ant Buildfile:

10. Shuttle target pmdAll to SelectedTargets

11. Add Property dir with value ${file.dir}

12. Skip the Options and Process Step to leave the defaults
13. Add the lib directory of pmd as additional classpath entry

14. Enter Caption and Icon as you want

15. Add the tool to the Navigator Context Menu and Main Toolbar and do not forget to set Log Output to Messages Log

16. Press Next and Finish.

Now you can call pmd e.g. from the fusion order demo application

You see the results of the ant process in the message pane and you can click on the link to open the file and jump to the rule violation:

In upcoming blogs I will show you how you can define your own rulesets (replacing the ones in pmd.xml) and how to use it with any kind of xml files, eg. jws, jpr, xcfg etc..

Chrysanth WebStory Published by WebStory

, , , ,

1 Comment

Save JDeveloper application workings sets in the application workspace – please vote for this enhancement request

If you create for an example a big adf application you may want to add all of your entities to one base application for reuse labels, validation and and so on. If you have a big database schema than in short time you have a problem to find your entity.

In JDeveloper there is a neat feature to overcome this problem: working sets! With this you can easily group your entities or other artefacts in logical working set, eg. for a sub application. Unfortunatly working sets are saved per user. There are several description how to share this between your team members. But a better way would to distinct between user and application working sets. Application working set should be saved consequently in the application workspace (jws).

Therefore I have created enhancent request bug 15841657 : SAVE APPLICATION WORKING SETS IN THE APPLICATION WORKSPACE JWS.

If you find this useful too, then create a service request, that you need this feature too. Unfortunatly there seems no other voting function for enhancement requests on oracle.

, ,

2 Comments

Have released PMD Jdeveloper Extension 4.3

Sorry for a time without new post – but I have finished now my work on integrating last PMD version 4.3 into JDeveloper.

This is available now for JDeveloper 10.1.3.x, 11.1.1.6 and 11.1.2.x. There is no new functionality, as the most work intensive part was the rewriting for 11.1.2.x. There has changed a lot of JDeveloper api functionality. Additional I tried to solve a class loader conflict in JDeveloper 11.1.1.x with the delivered libraries from PMD 4.3, but I was not succesful. Fortunatly Oracle JDeveloper product management solved this conflict in 11.1.1.6, so I can deliver at least the extension for this JDeveloper version.

Please give it a try, you can download it via the standard update center “Open Source and Partners Extensions” in JDveloper itself or directly from the PMD SourceForge.net Project Page.

, , , , ,

4 Comments

Follow

Get every new post delivered to your Inbox.

Join 43 other followers

%d bloggers like this: