Step 4: Running and Testing the Application

Previous topic
Previous
Next topic
Next

Iterative testing is an integral part of developing an application. In this tutorial, you will run and test the application every time you make changes to the session bean. For testing purposes, you will generate a sample Java client.

To run the application:

You may experience a short delay as the application deploys to the embedded OC4J server. If your Log window is open (View | Log Window), you can follow along with the deployment process. If you see a message that says "Error creating the ORB" ignore this.

To test the application, you need to create a client that can access the session bean. JDeveloper provides a sample Java client that facilitates testing.

To create and run a sample client:

  1. In the Navigator, right click on your session bean (hrApp) and choose New Sample Java Client.
  2. In the Sample EJB Java Client Details dialog, accept the default option to Connect to OC4J Embedded in JDeveloper and click OK.
    A new file, hrAppClient.java appears in the Navigator and opens in the Code Editor.
  3. Uncomment the setCompany() method and set the value to "Oracle Corporation".
  4. Call getCompany() and print it to the console. Your code should be similar to the code below:
    	HrApp = HrAppHome.create( );
        HrApp.setCompany ("Oracle Corporation");
        System.out.println(HrApp.getCompany()); 
    
  5. Run the client by right-clicking on hrAppClient.java in the Navigator and choosing Run hrAppClient.java.
    You should see "Oracle Corporation" displayed in the Log Window.