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

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

%% Submit a timeformat
p = pzmodel(1, [pz(1) pz(2,10)], [pz(4.3)]);

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


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

%% Retrieve the object


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


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

%% Test

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