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