Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The NRG_Selenium framework also allows the tester to interact directly with XNAT's database. To do this, the properties which begin with xnat.db listed in Setup and Configuration must be set up correctly, and the database must be set up to allow the tester's IP to access it (via the pg_hba.conf file). Then, simply calling XnatDatabase.performXnatDatabaseQuery(...), providing the SQL command as the parameter will pass the command on to the XNAT database. If appropriate, the The method will return a ResultSet with the results of the command, or null if there is nothing to return.

 

. If you wish to modify the database, instead use the XnatDatabase.performXnatDatabaseUpdate(...) method, which will return an int representing the number of database rows affected by the statement.

SSH

The framework also allows SSH connections to the XNAT machine. To do this, the xnat.ssh properties must be configured correctly. The property for xnat.ssh.key specifies the name (without full path) of the SSH private key which will be used to authenticate to the XNAT machine. The key must be placed in ~/.ssh to be found. Then, call SSHConnection.executeCommand(...) with the desired command to be executed on the machine as the parameter.