view m-toolbox/test/repo_tests/test_plist.m @ 34:03d92954b939 database-connection-manager

Improve look of LTPDAPreferences diaolog
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_plist(varargin)
% A test function to submit a plist to the repository. The plist is then
% retrieved and compared to the original one.
% 
% Usage: test_plist()     - connects to Hannover repository
%        test_plist(conn) - connects to the repository specified by
%                                  the database conn object.
% 
% M Hewitson 24-02-08
% 
% $Id: test_plist.m,v 1.7 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 parameter
p1 = param('a', 'val');
p2 = param('b', 3);
p  = plist([p1 p2]);

sinfo.conn                   = conn;
sinfo.experiment_title       = 'submit plist';
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 2 3];
sinfo.additional_comments    = 'none';
sinfo.additional_authors     = 'no one';

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

%% Retrieve the object

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

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


%% Test

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