Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g (10.1.3.1.0)

Part Number B25947-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

3.2 Setting Up the Oracle ADF Service Request Demo

These instructions assume that you are running Oracle JDeveloper 10g, Studio Edition, version 10.1.3.x. The application will not work with earlier versions of JDeveloper. To obtain JDeveloper, you may download it from the Oracle Technology Network (OTN):

http://www.oracle.com/technology/software/products/jdev/index.html

To complete the following instructions, you must have access to an Oracle database, and privileges to create new user accounts to set up the sample data.

3.2.1 Downloading and Installing the Oracle ADF Service Request Application

The SRDemo application is available for you to install as a JDeveloper extension. In JDeveloper, you use the Check for Updates wizard to begin the process of installing the extension.

To install the SRDemo application from the Update Center:

  1. If you are using JDeveloper, save your work and close. You will be asked to restart JDeveloper to complete the update.

  2. Open JDeveloper and choose Help > Check for Updates.

  3. In the wizard, click Next and make sure that Search Update Centers and Internal Automatic Updates are both selected. Click Next.

  4. Among the available updates, locate Oracle ADF SRDemo Application (ADF BC Version) and select it. Click Next to initiate the download.

    Note that the Update Center may display two versions of the SRDemo application. Only the one labeled "ADF BC" uses the technology stack described in this guide.

  5. When prompted, restart JDeveloper.

  6. When JDeveloper restarts, select Yes to open the SRDemo application workspace in the Application Navigator.

  7. JDeveloper displays the SRDemo Application Schema Install dialog to identify the database to use for the sample data.

    Figure 3-2 SRDemo Application Schema Dialog

    This image shows SRDemo application schema dialog.
  8. If you want to install the sample data and have access to a SYSTEM DBA account, enter the connection information in the Sample Install dialog.

    Note: The connection information you provide may be for either a local or a remote database, and that database may be installed with or without an existing SRDemo schema.

The SRDemo application will appear in the directory <JDEV_INSTALL>/jdev/samples/SRDemoSampleADFBC. The Update Center also installs the extension JAR file <JDEV_INSTALL>/jdev/extensions/oracle.jdeveloper.srdemo.bc.10.1.3.jar which allows JDeveloper to create the SRDemo application workspace.

3.2.2 Installing the Oracle ADF Service Request Schema

The SRDemo schema is defined in a series of SQL scripts stored in the <JDEV_INSTALL>/jdev/samples/SRDemoSampleADFBC/DatabaseSchema/scripts directory. The schema will automatically be created when you install the application using the Update Center; however, for manual purposes, you can install or reinstall the schema in several ways.


Note:

You may skip the following procedure if you installed the SRDemo application using the Update Center in JDeveloper and proceeded with the schema installer. For details, see Section 3.2.1, "Downloading and Installing the Oracle ADF Service Request Application".

Follow these instructions to manually create the SRDemo schema.

To manually install the SRDemo schema:

  • In JDeveloper, open the ANT build file build.xml in the BuildAndDeploy project of the SRDemoSampleADFBC workspace and run the setupDBOracle task by choosing Run Ant Target from the task's context menu.

    or

  • From SQL*Plus, run the build.sql script when connected as a DBA such as SYSTEM.

To manually refresh data in the SRDemo schema:

  • In JDeveloper, open the ANT build file build.xml in the BuildAndDeploy project of the SRDemoSampleADFBC workspace and run the resetData task by choosing Run Ant Target from the task's context menu.

If the schema already exists, you can use the above tasks to refresh the SRDemo sample data. You can either recreate the schema and data entirely (using the setupDBOracle task) or you can avoid recreating the schema and merely repopulate the SRDemo data (resetData task). Repopulating the schema is the easiest way to refresh the sample data since you will not need to log in as a SYS user. If you decide to reinstall the schema manually, you will be required to enter the SYSTEM DBA account password before the task recreates the schema.

When you install the schema manually, using the setupDBOracle task, the following questions and answers will appear:

-----------------------------------------------------------
SRDemo Database Schema Install 10.1.3
(c) Copyright 2006 Oracle Corporation. All rights reserved.
-----------------------------------------------------------
This script installs the SRDemo database schema into an
Oracle database.
The script uses the following defaults:
 
Schema name: SRDEMO
Schema password: ORACLE
Default tablespace for SRDEMO: USERS
Temp tablespace for SRDEMO: TEMP
DBA account used to create the Schema: SYSTEM
If you wish to change these defaults update the file
BuildAndDeploy/build.properties with your values
-----------------------------------------------------------

What happens next depends on how the demo was installed and what kind of JDeveloper installation yours is (either FULL or BASE).

  • If the SRDemo application was installed manually and is not in the expected <JDEV_HOME>/jdev/samples/SRDemoSample directory, you will be prompted for the JDeveloper home directory.

  • If JDeveloper is a BASE install (one without a JDK), then you will be prompted for the location of the JDK (1.5).

  • If the SRDemo application was installed using the Update Center into a FULL JDeveloper install. The task proceeds.

You will next be prompted to enter database information. Two default choices are given, or you can supply the information explicitly:

Information about your database:
---------------------------------------------
Select one of the following database options:
1. Default local install of Oracle Personal, Standard or Enterprise edition
   Host=localhost, Port=1521, SID=ORCL
2. Default local install of Oracle Express Edition
   Host=localhost, Port=1521, SID=XE
3. Any other non-default or remote database install
Choice [1]:

If you choose 1 or 2, the install proceeds to conclusion. If you choose 3, then you will need to supply the following information: (defaults shown in brackets)

Host Name or IP Address for your database machine [localhost]:
Database Port [1521]:
Database SID [orcl]:

The final question is for the DBA Account password:

Enter password for the SYSTEM DBA account [manager]:

The install continues.

3.2.3 Creating the Oracle JDeveloper Database Connection

You must create a database connection called "SRDemo" to connect to the sample data schema. If you installed the SRDemo application using the Update Center, this connection will have been created for you.


Note:

You may skip the following procedure if you installed the SRDemo application using the Update Center in JDeveloper. In that case, the database connection will automatically be created when you download the application.

Follow these instructions to manually create a new database connection to the Service Request schema.

To manually create a database connection for the SRDemo application:

  1. In JDeveloper, choose View > Connections Navigator.

  2. Right-click the Database node and choose New Database Connection from the context menu.

  3. Click Next on the Welcome page.

  4. In the Connection Name field, type the connection name SRDemo. Then click Next.

    Note: The name of the connection (SRDemo) is case sensitive and must be typed exactly to match the SRDemo application's expected connection name.

  5. On the Authentication page, enter the following values. Then click Next.

    Username: SRDEMO

    Password: Oracle

    Deploy Password: Select the checkbox.

  6. On the Connection page, enter the following values. Then click Next.

    Host Name: localhost

    JDBC Port: 1521

    SID: ORCL (or XE)

    Note: If you are using Oracle 10g Express Edition, then the default SID is "XE" instead of "ORCL".

  7. Click Test Connection. If the database is available and the connection details are correct, then continue. If not, click the Back button and check the values.

  8. Click Finish. The connection now appears below the Database Connection node in the Connections Navigator.

You can now examine the schema from JDeveloper. In the Connections Navigator, expand Database > SRDemo. Browse the database elements for the schema and confirm that they match the schema definition described in Section 3.1.2, "Overview of the Schema".

3.2.4 Running the Oracle ADF Service Request Demo in JDeveloper

If you installed the SRDemo application using the Update Center, choose Help > Open SRDemo Application Workspace to open the application workspace.

  • Run the application in JDeveloper by selecting the UserInterface project in the Application Navigator and choosing Run from the context menu, as shown in Figure 3-3.

Figure 3-3 Running the SRDemo Application in JDeveloper

This image shows the SRDemo application in JDeveloper.

Tip:

The UserInterface project defines index.jspx to be the default run target. This information appears in the Runner page of the Project Properties dialog for the UserInterface project. This allows you to simply click the Run icon in the JDeveloper toolbar when this project is active, or right-click the project and choose Run. To see the project's properties, select the project in the navigator, right-click, and choose Property Properties.

Running the index.jspx page from inside JDeveloper will start the embedded Oracle Application Server 10g Oracle Containers for J2EE (OC4J) server, launch your default browser, and cause it to request the following URL:

http://130.35.103.198:8988/SRDemoADFBC/faces/app/SRWelcome.jspx

If everything is working correctly, the index.jspx page's simple scriptlet response.sendRedirect("faces/app/SRWelcome.jspx"), will redirect to display the login page of the SRDemo application, as shown in Figure 3-4.


Tip:

If your machine uses DHCP to get an automatically-assigned IP address, then after JDeveloper launches your default browser and starts embedded OC4J you may see an HTTP error stating that the web page does not exist. To correct this issue, you can specify the host name, localhost. Choose Embedded OC4J Preferences from the Tools menu and on the Startup tab set the Host Name or IP Address Used to Refer to the Embedded OC4J preference to use the Specify Host Name option, and enter the value localhost. Then, edit the URL above to use localhost instead of 130.35.103.198.

Figure 3-4 SRWelcome.jspx: SRDemo Login Page

This image shows the SRDemo Login page.

See Section 3.3, "Quick Tour of the Oracle ADF Service Request Demo" to become familiar with the web pages that are the subject of this developer's guide. Additionally, read the tour to learn about ADF functionality used in the SRDemo application and to find links to the implementation details documented in this guide.

3.2.5 Running the Oracle ADF Service Request Demo Unit Tests in JDeveloper

JUnit is a popular framework for building regression tests for Java applications. Oracle JDeveloper 10g features native support for creating and running JUnit tests, but this feature is installed as a separately downloadable JDeveloper extension. You can tell if you already have the JUnit extension installed by choosing File > New from the JDeveloper main menu and verifying that you have a Unit Tests (JUnit) category under the General top-level category in the New Gallery.

If you do not already have the JUnit extension installed, then use the Update Center in JDeveloper to install it.


Note:

You may skip the following procedure if you installed the SRDemo application using the Update Center in JDeveloper. In that case, the JUnit extension will automatically be installed when you download the application.

To install the JUnit extension from the Update Center:

  1. If you are using JDeveloper, save your work and close. You will be asked to restart JDeveloper to complete the update.

  2. Open JDeveloper and choose Help > Check for Updates.

  3. In the wizard, click Next and make sure that Search Update Centers and Internal Automatic Updates are both selected. Click Next.

  4. Among the available updates, locate JUnit Integration 10.1.3.xx and select it. Click Next to initiate the download.

  5. When prompted, restart JDeveloper.

  6. When JDeveloper restarts, the new extension will be visible in the Unit Tests category in the New Gallery.

The UnitTests project in the SRDemo application workspace contains a suite of JUnit tests that are configured in the SRServiceAllTests.java class shown in Figure 3-5. To run the regression test suite, select the SRServiceAllTests.java class in the Application Navigator and choose Run from the context menu. Since this class is configured as the default run target of the UnitTests project, alternatively you can select the project itself in the Application Navigator and choose Run from its context menu.

Figure 3-5 Running the SRDemo Unit Tests in JDeveloper

This image shows SRDemo Unit tests in JDeveloper.

JDeveloper opens the JUnit Test Runner window to show you the results of running all the unit tests in the suite. Each test appears in a tree display at the left, grouped into test cases. Green checkmark icons appear next to each test in the suite that has executed successfully, and a progress indicator gives you visual feedback on the percentage of your testiest that is passing.


Tip:

You can find more details on JUnit on the web at http://www.junit.org/index.htm.