view m-toolbox/test/repo_tests/test_ao.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

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

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

%% Submit a mfir
tic
p = ao(plist('waveform', 'sine wave', 'f', 1, 'phi', 0, 'nsecs', 1000, 'fs', 1));

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


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

%% Retrieve the object

tic
q = ao(plist('conn', conn, 'binary', 'yes', 'id', ids ));
% q = ltpda_uo.retrieve(conn, 'binary', ids);
% q = ltpda_uo.retrieve(conn, ids);
toc

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


%% Test
if ne(p,q(1), 'hist')
  error('### ao objects are not the same.')
end