view m-toolbox/test/repo_tests/test_mfir.m @ 22:b11e88004fca database-connection-manager

Update collection.fromRepository
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

function test_mfir(varargin)
% A test function to submit an mfir to the repository. The mfir is then
% retrieved and compared to the original one.
% 
% Usage: test_mfir()     - connects to Hannover repository
%        test_mfir(conn) - connects to the repository specified by
%                                  the database conn object.
% 
% M Hewitson 24-02-08
% 
% $Id: test_mfir.m,v 1.8 2008/11/14 09:51:55 hewitson Exp $
% 

if nargin == 0
  conn = utils.mysql.connect('130.75.117.67', 'ltpda_test');
else
  conn = varargin{1};
end

%% Submit a mfir
p = mfir(plist);

sinfo.conn                   = conn;
sinfo.experiment_title       = 'submit mfir';
sinfo.experiment_description = 'this is just a test of the whole thing';
sinfo.analysis_description   = 'just submitting';
sinfo.quantity               = 'none';
sinfo.keywords               = 'none';
sinfo.reference_ids          = '1, 3';
sinfo.additional_comments    = 'none';
sinfo.additional_authors     = 'no one';

[ids, cid] = submit(p, sinfo);

%% Close connection
if nargin == 0
  close(conn);
end

%% Retrieve the object

q = mfir(plist('conn', conn, 'cid', cid))


%% Test

if ne(p,q, 'hist')
  error('### mfir objects are not the same.')
end