Mercurial > hg > ltpda
comparison m-toolbox/classes/tests/database/@ltpda_objmeta_table/test_objmeta_ip.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 'ip' 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_ip.m,v 1.2 2011/05/24 19:09:54 ingo Exp $ | |
11 % | |
12 function varargout = test_objmeta_ip(varargin) | |
13 | |
14 utp = varargin{1}; | |
15 | |
16 if ~utp.testRunner.skipRepoTests() | |
17 | |
18 dbTable = 'objmeta'; | |
19 tableField = 'ip'; | |
20 | |
21 % Check that the metadata was set with a submit PLIST | |
22 try | |
23 for nn = 1:numel(utp.objIds) | |
24 | |
25 % get 'ip' 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 in the meta table is the same as the current IP | |
32 ip = char(getHostAddress(java.net.InetAddress.getLocalHost)); | |
33 assert(strcmp(val{1}, ip)); | |
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 'ip' 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 in the meta table is the same as the current IP | |
50 ip = char(getHostAddress(java.net.InetAddress.getLocalHost)); | |
51 assert(strcmp(val{1}, ip)); | |
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 |