comparison m-toolbox/classes/tests/database/@ltpda_objmeta_table/test_objmeta_version.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 %
2 % DESCRIPTION: Tests that the metadata 'version' of a database
3 % works for a ltpda object
4 %
5 % CHECKS: - Check that we get only one connection from the used
6 % repository PLIST
7 % - Check that the metadata was set with a submit PLIST
8 % - Check that the metadata was set with a submit structure
9 %
10 % VERSION: $Id: test_objmeta_version.m,v 1.6 2011/05/24 19:09:55 ingo Exp $
11 %
12 function varargout = test_objmeta_version(varargin)
13
14 utp = varargin{1};
15
16 if ~utp.testRunner.skipRepoTests()
17
18 dbTable = 'objmeta';
19 tableField = 'version';
20
21 % Check that the metadata was set with a submit PLIST
22 try
23 for nn = 1:numel(utp.objIds)
24
25 % get 'version' from the objmeta table
26 val = utp.getTableEntry(dbTable, tableField, utp.objIds(nn));
27
28 % Check that we get only one result for the query
29 assert(numel(val)==1)
30
31 % Check the query result with the current LTPDA version
32 v = ver('LTPDA');
33 assert(numel(v) == 1, sprintf('I found more than one LTPDA toolbox. Versions (%s)', utils.helper.val2str({v(:).Version})))
34 assert(any(strfind(val{1}, v.Version)), sprintf('The LTPDA version doesn''t match. Class val %s', class(val{1})))
35 assert(any(strfind(val{1}, v.Release)), 'The LTPDA release doesn''t match')
36 end
37 catch Me
38 throw(Me);
39 end
40
41 % Check that the metadata was set with a submit structure
42 try
43 for nn = 1:numel(utp.objIdsStruct)
44
45 % get 'version' from the objmeta table
46 val = utp.getTableEntry(dbTable, tableField, utp.objIdsStruct(nn));
47
48 % Check that we get only one result for the query
49 assert(numel(val)==1)
50
51 % Check the query result with the current LTPDA version
52 v = ver('LTPDA');
53
54 assert(numel(v) == 1, sprintf('I found more than one LTPDA toolbox. Versions (%s)', utils.helper.val2str({v(:).Version})))
55 assert(any(strfind(val{1}, v.Version)), 'The LTPDA version doesn''t match')
56 assert(any(strfind(val{1}, v.Release)), 'The LTPDA release doesn''t match')
57 end
58 catch Me
59 throw(Me);
60 end
61
62 varargout{1} = sprintf('Test the field ''%s'' of the database table ''%s'' with the database %s ', tableField, dbTable, utp.testRunner.repositoryPlist.find('database'));
63 else
64 varargout{1} = 'Skip database test';
65 end
66 end