With code like
... import oracle.jbo.client.Configuration; import oracle.jbo.ApplicationModule; ... String amDef = "model.AppModule"; String config = "AppModuleLocal"; ApplicationModule am = Configuration.createRootApplicationModule(amDef, config); ...
it is possible to instantiate an ApplicationModule in a standalone Java application (means, without the need to launch an application server and deploy the application).
Based on the created ApplicationModule instance, the View Objects and View Links defined in the Application Module's data model can be accessed and test cases for the common CRUD operations (Create, Read, Update, Delete) can be implemented against them. Executing (and debugging) these test cases is very simple since they can be launched as a standalone Java application.
However, when the application is configured with ADF security, the following error might occur when executing the above code, and creation of the ApplicationModule fails:
javax.security.auth.login.LoginException: Null or empty password was provided.
In order to solve this, we need to provide login credentials to the application module. They can be configured in the application module configuration:
- Open the application module's xml file
- Select the "Configurations" Tab
- Select the configuration which is used when creating the application module
- Click the "Edit" icon to open the Configuration Editor
- Select the "Properties" tab
- Set the properties java.naming.security.principal to a valid user name and java.naming.security.credentials to the user's password
Note: You should use a separate user for the test cases, and make sure that this user is not automatically deployed to any production environment!