Access System Properties from a Mock

Hello MicroEJ team,

Is it possible to access System Properties from a Mock ?

I would like to set the following System Property in my application launcher: mock.myproperty=myvalue and get its value in my mock.

Regards,

Fabrice

Hi,

It is possible to extend the launch phase by adding a custom extension script in your Platform.

Here is an example of such script:

  • Download init-hil-addproperties.zip
  • Create a dropins/scripts directory in your Platform configuration project
  • Extract init-hil-addproperties.zip in this folder

Take a look to dropins/scripts/init-hil-addproperties/init.xml: this script automatically embeds all Application options starting with com.mycompany.mock as system properties.

This can be updated at your convenience.

In your mock project, you can retrieve it using System.getProperty(''com.mycompany.mock.myOption")

–Frédéric

Hi Frédéric,

Thanks ! This is working fine.

Fabrice