comparison m-toolbox/classes/tests/database/@ltpda_objmeta_table/test_objmeta_validated.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 'validated' 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_validated.m,v 1.2 2011/05/24 19:09:55 ingo Exp $
11 %
12 function varargout = test_objmeta_validated(varargin)
13
14 utp = varargin{1};
15
16 if ~utp.testRunner.skipRepoTests()
17
18 dbTable = 'objmeta';
19 tableField = 'validated';
20
21 % Check that the metadata was set with a submit PLIST
22 try
23 for nn = 1:numel(utp.objIds)
24
25 % get 'validated' 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 that the query result is always empty because we don't set
32 % this value in the database table.
33 assert(isempty(val{1}))
34 end
35 catch Me
36 throw(Me);
37 end
38
39 % Check that the metadata was set with a submit structure
40 try
41 for nn = 1:numel(utp.objIdsStruct)
42
43 % get 'validated' from the objmeta table
44 val = utp.getTableEntry(dbTable, tableField, utp.objIdsStruct(nn));
45
46 % Check that we get only one result for the query
47 assert(numel(val)==1)
48
49 % Check that the query result is always empty because we don't set
50 % this value in the database table.
51 assert(isempty(val{1}))
52 end
53 catch Me
54 throw(Me);
55 end
56
57 varargout{1} = sprintf('Test the field ''%s'' of the database table ''%s'' with the database %s ', tableField, dbTable, utp.testRunner.repositoryPlist.find('database'));
58 else
59 varargout{1} = 'Skip database test';
60 end
61 end