view testing/utp_1.1/generic_utps/utp_68.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +0100
parents 409a22968d5e
children
line wrap: on
line source

% <TestDescription>
%
% Tests that the constructor properly applies history to the conn+Id constructor.
%
% </TestDescription>
function result = utp_68(cl, obj1, ple3)
  
  % <SyntaxDescription>
  %
  % Tests that the constructor properly applies history to the conn+Id
  % constructor.
  %
  % </SyntaxDescription>
  
  msg = '';
  try
    % <SyntaxCode>    
    pl = plist('hostname', utpGetHostname, ...
               'database', utpGetDatabase, ...
               'username', utpGetUsername, ...
               'password', utpGetPassword, ...
               'experiment title', 'utp_68: submit objects', ...
               'experiment description', 'utp_68: test submission', ...
               'analysis description', 'no analysis', ...
               'no dialog',    true, ...
               'use selector', false);
    
    [ids] = submit(obj1, pl);
    
    out  = feval(cl, plist('hostname', utpGetHostname, ...
      'database', utpGetDatabase, ...
      'username', utpGetUsername, ...
      'password', utpGetPassword, ...
      'id', ids));
    % </SyntaxCode>
    stest = true;
  catch err
    msg = err.message;
    disp(err.message)
    stest = false;
  end
  
  % <AlgoDescription>
  %
  % 1) Check that the last entry in the history of 'out' corresponds to
  %    class name.
  % 2) Check that the 'rebuild' method produces the same object as 'out'.
  %
  % </AlgoDescription>
  
  atest = true;
  if stest
    % <AlgoCode>
    % Check the last step in the history of 'out'
    if ~strcmp(out.hist.methodInfo.mname, cl)
      msg = ['The last step in the history is not ''' cl ''''];
      atest = false;
    end
    % Check data values
    if ~eq(out,obj1, ple3)
      msg = ['The values in the objects are not equal: ' lastwarn];
      atest = false;
    end
    % Check the history except the additional 'submit' + 'retrieve' steps
    if ~eq(out.hist.inhists, obj1.hist)
      msg = ['The history of the objects are not equal: ' lastwarn];
      atest = false;
    end

    % </AlgoCode>
  else
    atest = false;
  end
  
  % Return a result structure
  dd = dbstack;
  mfilename = dd(2).file(1:end-2);  
  result = utp_prepare_result(atest, stest, dbstack, mfilename, msg);
end % END UTP_68