Skip to content

Commit 2f1b2ed

Browse files
Merge pull request #333 from ixcat/issue-87-ext2
TestPopulate serverID / jobs table test setup fixes
2 parents e55b97c + 1cc0d63 commit 2f1b2ed

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

tests/TestPopulate.m

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ function TestPopulate_testPopulate(testCase)
55
disp(['---------------' st(1).name '---------------']);
66
package = 'Lab';
77

8-
c1 = dj.conn(...
9-
testCase.CONN_INFO.host,...
10-
testCase.CONN_INFO.user,...
11-
testCase.CONN_INFO.password,'',true);
12-
138
dj.createSchema(package,[testCase.test_root '/test_schemas'], ...
149
[testCase.PREFIX '_lab']);
10+
11+
lab_schema = Lab.getSchema; % we need schema's connection id
12+
sid = lab_schema.conn.serverId;
1513

1614
insert(Lab.Subject, {
1715
100, '2010-04-02';
@@ -23,33 +21,35 @@ function TestPopulate_testPopulate(testCase)
2321
'rig_note', 'FooLab Frobnicator v1.0' ...
2422
));
2523

26-
% regular populate of 1 record
24+
% parallel populate of 1 record
2725
% .. (SessionAnalysis logs session ID as session_analysis data)
26+
% NOTE: need to call parpopulate 1st to ensure Jobs table
27+
% exists
2828

2929
insert(Lab.Session, struct( ...
3030
'session_id', 0, ...
31-
'subject_id', 0, ...
31+
'subject_id', 100, ...
3232
'rig_manufacturer', 'FooLab', ...
3333
'rig_model', '1.0' ...
3434
));
3535

36-
populate(Lab.SessionAnalysis);
36+
parpopulate(Lab.SessionAnalysis);
3737
a_result = fetch(Lab.SessionAnalysis & 'session_id = 0', '*');
38-
testCase.verifyEqual(a_result.session_analysis, 0);
38+
testCase.verifyEqual(a_result.session_analysis.connection_id, sid);
3939

40-
% parallel populate of 1 record
40+
% regular populate of 1 record
4141
% .. (SessionAnalysis logs jobs record as session_analysis data)
4242

4343
insert(Lab.Session, struct( ...
4444
'session_id', 1, ...
45-
'subject_id', 0, ...
45+
'subject_id', 100, ...
4646
'rig_manufacturer', 'FooLab', ...
4747
'rig_model', '1.0' ...
4848
));
4949

50-
parpopulate(Lab.SessionAnalysis);
50+
populate(Lab.SessionAnalysis);
5151
a_result = fetch(Lab.SessionAnalysis & 'session_id = 1', '*');
52-
testCase.verifyEqual(a_result.session_analysis.connection_id, c1.serverId);
52+
testCase.verifyEqual(a_result.session_analysis, 1);
5353

5454
end
5555
end

tests/test_schemas/+Lab/SessionAnalysis.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
methods(Access=protected)
99
function makeTuples(self,key)
1010

11-
c = dj.conn();
11+
c = self.schema.conn;
1212
r = sprintf('connection_id = %d', c.serverId);
1313

1414
j = fetch(Lab.Jobs() & r, '*');

0 commit comments

Comments
 (0)