% REPO_TEST_RAND_OBJS Test repository submission/retrieval of different
% LTPDA user objects
%
% M HUeller 05-12-08
%
% $Id: repo_test_rand_objs.m,v 1.5 2009/03/25 17:39:01 nicola Exp $
%

function results = repo_test_rand_objs()
  
N_OBJ = 2e1;
test_timer = now;
  
  %% Prepares a plist with the needed parameters
  pl_run = plist('RAND_N_OBJ',      false, ...
    'N_OBJ',           N_OBJ, ...
    'RAND_OBJ_TYPE',   true, ...
...%'OBJ_TYPE',        '', ...
    'HOSTNAME',        'btlab.science.unitn.it', ...
    'DBASE',           'ltpda_test', ...
    'SAVE_OBJS',       false, ...
    'SUBMIT',          true, ...
    'CONN',            [], ...
    'SAVE_RESULTS',    false, ...
    'FILESIZE',        true, ...
    'DIR',             [], ...
    'RESULTS_FILENAME','repo_test' ...
    );
    
  %% Runs the tests
  
%   for kk = 1 : N_OBJ
%     results{kk} = repo_test_func(pl_run);
    results = repo_test_func(pl_run);
%   end

  %% Puts together a report
  pl_used = find(results,'pl_used');
  import utils.const.*
  
  if isempty(find(pl_used, 'start_time')), start_time = datestr(test_timer,'HH:MM:SS.FFF'); stop_time = datestr(now,'HH:MM:SS.FFF');
  else start_time = find(pl_used, 'start_time'); stop_time = find(pl_used, 'stop_time');
  end
  
  if find(pl_used,'RAND_OBJ_TYPE'), obj_type = [num2str(N_OBJ) ' objects were generated using random user classes'];
  else obj_type = [num2str(N_OBJ) ' objects were generated using only class ' find(pl_used,'OBJ_TYPE')];
  end
  
  if ~find(pl_used,'SUBMIT'), submission = 'Submission to repository was disabled';
  else submission = ['Submitted to database ', find(pl_used,'DBASE'), ' @ ', find(pl_used,'HOSTNAME')];
  end
  
  if ~find(pl_used,'SAVE_OBJS'), saved = 'No data was saved on disk';
  else saved = ['The results were saved with filename ', find(pl_used,'RESULTS_FILENAME'), ' in the folder ', find(pl_used,'DIR')];
  end
  
  utils.helper.msg(msg.MNAME, '%s \n %s \n %s \n %s \n %s \n %s \n %s \n %s', ...
    ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ', '  ', obj_type,...
    ['Test started at ' datestr(start_time) '  and ended at ' datestr(stop_time)], ...
    submission, saved, '  ',' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ');

  
end
% END