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