You are here: Home ยป Setting security credentials in Application Module test cases

Setting security credentials in Application Module test cases

Posted on Wednesday, May 07 2014 at 12:01 (Age: 5 yrs) | Category: Oracle ADF & JDeveloper

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!


Comments

From: daya on Tuesday, March 03 2015 13:37:01

Thanks for sharing this info , it really helped me.

From: Kavi on Monday, February 22 2016 14:21:28

Thanks a lot for this useful info