Skip Headers
Oracle® Application Development Framework Developer's Guide
10g Release 3 (10.1.3)
B25386-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

2.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.

2.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 and select it. Click Next to initiate the download.

  5. When prompted, restart JDeveloper.

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

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

    Figure 2-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 above process creates a directory samples if one does not exist. The SRDemo application will appear in the directory <JDEV_INSTALL>/jdev/sample/SRDemoSample. The Update Center also installs an extension JAR file in <JDEV_INSTALL>/jdev/extensions/oracle.jdeveloper.srdemo.10.1.3 which allows JDeveloper to create the SRDemo application workspace.

2.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/sample/SRDemoSample/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 2.2.1, "Downloading and Installing the Oracle ADF Service Request Application".

Follow these instructions to manually create the SRDemo schema. You may also use this procedure when you want to refresh the sample data.

To manually install the SRDemo schema:

  • From the command line, run the SRDemoInstall.bat/.sh command line script from the SRDemoSample root directory.

    or

  • In JDeveloper, open the ANT build file build.xml in the BuildAndDeploy project and run the setupDB task.

    or

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

If the schema already exists, you can also use any of the above methods to delete the old version of the schema and refresh the sample data. When you install the schema manually, the following information and questions 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 then runs.

2.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

  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 2.1.2, "Overview of the Schema".

2.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 index.jspx in the UserInterface project and choosing Run, as shown in Figure 2-3.

Figure 2-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/SRDemo/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 2-4.

Figure 2-4 SRWelcome.jspx: SRDemo Login Page

This image shows the SRDemo Login page.

See Section 2.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.

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

You must ensure that the JUnit Extension for JDeveloper is installed. JUnit is the standard tool for building regression tests for Java applications. Go to the JUnit home page at http://www.junit.org/index.htm for further details.

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.

Figure 2-5 Running the SRDemo Unit Tests in JDeveloper

This image shows SRDemo Unit tests in JDeveloper.

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


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.