diff testing/utp_1.1/utp_run.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents 409a22968d5e
children
line wrap: on
line diff
--- a/testing/utp_1.1/utp_run.m	Wed Dec 07 17:24:37 2011 +0100
+++ b/testing/utp_1.1/utp_run.m	Wed Dec 07 17:24:37 2011 +0100
@@ -45,6 +45,16 @@
   skipTests    = pl.find('skip tests', '');
   tests        = pl.find('tests', '');
   noRepository = pl.find('no repository', false);
+
+  hostname = pl.find('hostname', '130.75.117.67');
+  database = pl.find('database', 'ltpda_test');
+  username = pl.find('username', 'tester');
+  password = pl.find('password', 'a1b2c3d4');
+  
+  setappdata(0, 'LTPDAUtpRepositoryHostname', hostname);
+  setappdata(0, 'LTPDAUtpRepositoryDatabase', database);
+  setappdata(0, 'LTPDAUtpRepositoryUsername', username);
+  setappdata(0, 'LTPDAUtpRepositoryPassword', password);
   
   if ~isempty(rest) && ~isempty(tests)
     tests = [reshape(cellstr(tests), 1, []), reshape(rest, 1, [])];
@@ -142,7 +152,7 @@
     results = [];
     for jj=1:length(utps)
       try
-        results = [results eval(utps{jj})];
+        results = [results eval(utps{jj})]
       catch ex
         % report the error failure in running the UTP
         stack.name = 'xx';
@@ -164,12 +174,24 @@
   catch ex
     % restore original path
     path(oldpath);
+    % remove appdata
+    rmappdata(0, 'LTPDAUtpRepositoryHostname');
+    rmappdata(0, 'LTPDAUtpRepositoryDatabase');
+    rmappdata(0, 'LTPDAUtpRepositoryUsername');
+    rmappdata(0, 'LTPDAUtpRepositoryPassword');
+    % propagate exception
     rethrow(ex);
   end
 
   % restore original path
   path(oldpath);
+  % remove appdata
+  rmappdata(0, 'LTPDAUtpRepositoryHostname');
+  rmappdata(0, 'LTPDAUtpRepositoryDatabase');
+  rmappdata(0, 'LTPDAUtpRepositoryUsername');
+  rmappdata(0, 'LTPDAUtpRepositoryPassword');
 
+  
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %
   % FUNCTION:    addUtpTest