Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Description of obi_test</title>
<meta name="keywords" content="obi_test">
<meta name="description" content="obi_test Testing function for the Matlab openBIS Toolbox">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="m2html v1.5 © 2003-2005 Guillaume Flandin">
<meta name="robots" content="index, follow">
<link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> > <a href="index.html">matlab-openbis</a> > obi_test.m</div>
<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td>
<td align="right"><a href="index.html">Index for matlab-openbis <img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
<h1>obi_test
</h1>
<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>obi_test Testing function for the Matlab openBIS Toolbox</strong></div>
<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function pass = obi_test(varargin) </strong></div>
<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment">obi_test Testing function for the Matlab openBIS Toolbox
This function runs a few tests for the Matlab openBIS Toolbox. It
returns true if all the tests pass successfully and fasle otherwise.
Input argumtents (all optional):
teardown ... delete everything at the end (true)</pre></div>
<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="OpenBis.html" class="code" title="">OpenBis</a> </li></ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->
<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function pass = obi_test(varargin)</a>
0002 <span class="comment">%obi_test Testing function for the Matlab openBIS Toolbox</span>
0003 <span class="comment">% This function runs a few tests for the Matlab openBIS Toolbox. It</span>
0004 <span class="comment">% returns true if all the tests pass successfully and fasle otherwise.</span>
0005 <span class="comment">% Input argumtents (all optional):</span>
0006 <span class="comment">% teardown ... delete everything at the end (true)</span>
0007 pass = true;
0008
0009 <span class="keyword">if</span> nargin == 1
0010 teardown = varargin{1};
0011 <span class="keyword">else</span>
0012 teardown = true;
0013 <span class="keyword">end</span>
0014
0015 <span class="comment">%% 0. Check if pyversion is setup correctly</span>
0016
0017 <span class="comment">%% 1. Login to openBIS</span>
0018 obi = <a href="OpenBis.html" class="code" title="">OpenBis</a>();
0019 assert(obi.is_session_active(), <span class="string">'Session not active'</span>);
0020
0021 <span class="comment">%% 2. Create space for test</span>
0022 space_name = <span class="string">'TESTING_SPACE'</span>;
0023 <span class="keyword">try</span>
0024 space = obi.new_space(space_name, <span class="string">'a space for tests of the Matlab openBIS Toolbox'</span>);
0025 <span class="keyword">catch</span>
0026 disp(<span class="string">'Could not create requested space'</span>)
0027 rethrow(lasterror)
0028 <span class="keyword">end</span>
0029 spaces = obi.get_spaces();
0030 assert(any(ismember(spaces.code, space_name)), <span class="string">'Space has not been created'</span>);
0031
0032 <span class="comment">%% 3. Create project for test</span>
0033 project_name = <span class="string">'TESTING_PROJECT'</span>;
0034 <span class="keyword">try</span>
0035 project = obi.new_project(space, project_name, <span class="string">'a project for tests of the Matlab openBIS Toolbox'</span>);
0036 <span class="keyword">catch</span>
0037 disp(<span class="string">'Could not create requested project'</span>)
0038 rethrow(lasterror)
0039 <span class="keyword">end</span>
0040 projects = obi.get_projects(space_name, project_name);
0041 assert(any(ismember(projects.identifier, sprintf(<span class="string">'/%s/%s'</span>, space_name, project_name))), <span class="string">'Project has not been created'</span>);
0042
0043 <span class="comment">%% 4. Create experiment for test</span>
0044 experiment_name = <span class="string">'TESTING_EXPERIMENT'</span>;
0045
0046
0047 <span class="comment">%% 5. Create dataset with dummy files</span>
0048
0049
0050 <span class="comment">%% 6. Download the created dataset</span>
0051
0052
0053 <span class="comment">%% 7. Tear-down (delete everything, optional)</span>
0054 <span class="keyword">if</span> teardown
0055 <span class="comment">% delete project</span>
0056 obi.delete_project(project_name, <span class="string">'created by Matlab-openBIS toolbox test function'</span>)
0057 <span class="comment">% delete space</span>
0058 obi.delete_space(space, <span class="string">'created by Matlab-openBIS toolbox test function'</span>)
0059 <span class="keyword">end</span>
0060
0061 <span class="comment">%% 8. Logout</span>
0062 obi.logout()
0063
0064 <span class="keyword">end</span>
0065</pre></div>
<hr><address>Generated on Tue 06-Jul-2021 16:01:18 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> © 2005</address>
</body>
</html>