Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers 10g (10.1.3.1.0) Part Number B25947-01 |
|
|
View PDF |
JDeveloper includes an interactive application module testing tool that enables you to to test all aspects of its data model without having to use your application user interface or write a test client program. It can often be the quickest way of exercising the data functionality of your business service during development.
To test an application module, select it in the Application Navigator and choose Test from the context menu. The Business Component Browser Connect dialog appears as shown in Figure 5-14. In the upper right corner of the dialog, the Configuration Name list allows you to choose any of your application module's configurations for the current run of the tester tool. Click Connect to start the application module using the selected configuration.
When you launch the Business Components Browser, JDeveloper starts the tester tool in a separate process and the Business Components Browser appears. The tree at the left of the dialog displays all of the view object instances in your application module's data model. Figure 5-15 has only one instance called UserList
. Double-clicking the UserList
view object instance in the tree executes the view object — if it has not been executed so far in the testing session — and displays a panel to inspect the query results as shown in Figure 5-15. Additional context menu items on the view object node allow you to re-execute the query if needed, to remove the tester panel, and to perform other tasks.
You can see that the fields in the test panel for the view object are disabled for the UserList
view object instance, because the view object is read only. In Section 7.5, "Testing Entity-Based View Objects Interactively", you'll see that the tester tool becomes even more valuable by allowing you to experiment with inserting, updating, and deleting rows in view objects, too. But even for a read-only view object, the tool affords some useful features. Firstly, you can validate that the UI hints and format masks are defined correctly. The attributes display with their defined Label Text control hints as the prompt, and the UserId
field is displayed as 00303 due to the 00000
format mask defined in Section 5.4.1, "How to Add Attribute Control Hints". Secondly, you can scroll through the data using the toolbar buttons.
Thirdly, you can enter query-by-example criteria to find a particular row whose data you want to inspect. By clicking the Specify View Criteria button in the toolbar, the View Criteria dialog displays as shown in Figure 5-16. You can enter a query criteria like "H%
" in the LastName
attribute and click Find to narrow the search to only those users with a last name that begins with the letter H
(Hunold, Himuro, Hartstein, and Higgins).
When using the Business Components Browser you can customize configuration options for the current run. You can also enable ADF Business Component debug diagnostics to output messages to the console. Both of these features can help you test various portions of your application or find problems.
As described in Figure 5-14, on the Connect dialog of the Business Component Browser you can select a predefined configuration to run the tool using that named set of runtime configuration properties. The Connect dialog also features a Properties tab that allows you to see the selected configurations settings and to override any of the configuration's settings for the current run of the browser. For example, you could test the Italian language translations of the UI control hints for a single Business Components Browser run by opening the Properties tab and setting the following two properties:
jbo.default.country = IT
jbo.default.language = it
If you wanted to make the changes permanent, you could use the Configuration Manager to copy the current UserServiceLocal
configuration and create a new UserServiceLocalItalian
which had these two additional properties set. This way, anytime you wanted to test in Italian you could simply choose to use the UserServiceLocalItalian
configuration instead of the default UserServiceLocal
one.
When launching the Business Components Browser, if your project's current run configuration is set to include the Java System parameter jbo.debugoutput=console
, you can enable ADF Business Components debug diagnostics with messages directed to the console. These will display in the JDeveloper Log window.
Note: Despite the similar name, the JDeveloper project's run configurations are different from the ADF application module's configurations. The former are part of the project properties, the latter are defined along with your application module component in itsbc4j.xcfg file and edited using the configuration editor. |
To set the system property described above, open the Run/Debug page in the Project Properties dialog for your model project. Click Edit to edit the chosen run configuration, and add the string:
-Djbo.debugoutput=console
to the Java Options field in the panel. The next time you run the Business Component Browser and double-click on the UserList
view object, you'll see detailed diagnostic output in the console.
Example 5-5 Diagnostic Output of Business Component Browser
: [234] Created root application module: 'devguide.examples.UserService' [235] Stringmanager using default locale: 'en_US' [236] Locale is: 'en_US' [237] ApplicationPoolImpl.resourceStateChanged wasn't release related. [238] Oracle SQLBuilder: Registered driver: oracle.jdbc.driver.OracleDriver [239] Creating a new pool resource [240] Trying connection/2: url='jdbc:oracle:thin:@localhost:1521:XE' ... [241] Successfully logged in [242] JDBCDriverVersion: 10.1.0.5.0 [243] DatabaseProductName: Oracle [244] DatabaseProductVersion: Oracle Database 10g Release 10.2.0.1.0 [245] Column count: 4 [246] ViewObject: UserList Created new QUERY statement [247] UserList>#q computed SQLStmtBufLen: 110, actual=70, storing=100 [248] select USER_ID, EMAIL, FIRST_NAME, LAST_NAME from USERS order by EMAIL :
Using the diagnostics, you can see everything the framework components are doing for your application.
Other legal values for this property are silent
(the default, if not specified) and file
. If you choose the file option, diagnostics are written to the system temp directory. One best practice is to create multiple JDeveloper run configurations, one with the ADF Business Components debug diagnostics set on, and another without it, so you can easily flip between seeing and not seeing debug diagnostics by choosing the appropriate project run configuration.