comparison m-toolbox/classes/tests/database/@ltpda_objmeta_table/test_objmeta_submitted.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 'submitted' 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_submitted.m,v 1.4 2011/05/24 19:09:55 ingo Exp $
11 %
12 function varargout = test_objmeta_submitted(varargin)
13
14 utp = varargin{1};
15
16 if ~utp.testRunner.skipRepoTests()
17
18 dbTable = 'objmeta';
19 tableField = 'submitted';
20
21 % Check that the metadata was set with a submit PLIST
22 try
23 for nn = 1:numel(utp.objIds)
24
25 % get 'submitted' 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 difference betwen the submitted time and the
32 % current time is not larger than one hour.
33 sTime = val{1};
34 cTime = time();
35 dTime = cTime - sTime;
36 assert(abs(dTime.utc_epoch_milli) <= 60 * 60 * 1000, sprintf('The time difference between submittion-time and checking time is larger than one hour (%d)', double(dTime)))
37 end
38 catch Me
39 throw(Me);
40 end
41
42 % Check that the metadata was set with a submit structure
43 try
44 for nn = 1:numel(utp.objIdsStruct)
45
46 % get 'submitted' from the objmeta table
47 val = utp.getTableEntry(dbTable, tableField, utp.objIdsStruct(nn));
48
49 assert(numel(val)==1)
50
51 % Check that the difference betwen the submitted time and the
52 % current time is not larger than one hour.
53 sTime = val{1};
54 cTime = time();
55 dTime = cTime - sTime;
56 assert(abs(dTime.utc_epoch_milli) <= 60 * 60 * 1000, sprintf('The time difference between submittion-time and checking time is larger than one hour (%d)', double(dTime)))
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