Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions tests/TestPopulate.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ function TestPopulate_testPopulate(testCase)
disp(['---------------' st(1).name '---------------']);
package = 'Lab';

c1 = dj.conn(...
testCase.CONN_INFO.host,...
testCase.CONN_INFO.user,...
testCase.CONN_INFO.password,'',true);

dj.createSchema(package,[testCase.test_root '/test_schemas'], ...
[testCase.PREFIX '_lab']);

lab_schema = Lab.getSchema; % we need schema's connection id
sid = lab_schema.conn.serverId;

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

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

insert(Lab.Session, struct( ...
'session_id', 0, ...
'subject_id', 0, ...
'subject_id', 100, ...
'rig_manufacturer', 'FooLab', ...
'rig_model', '1.0' ...
));

populate(Lab.SessionAnalysis);
parpopulate(Lab.SessionAnalysis);
a_result = fetch(Lab.SessionAnalysis & 'session_id = 0', '*');
testCase.verifyEqual(a_result.session_analysis, 0);
testCase.verifyEqual(a_result.session_analysis.connection_id, sid);

% parallel populate of 1 record
% regular populate of 1 record
% .. (SessionAnalysis logs jobs record as session_analysis data)

insert(Lab.Session, struct( ...
'session_id', 1, ...
'subject_id', 0, ...
'subject_id', 100, ...
'rig_manufacturer', 'FooLab', ...
'rig_model', '1.0' ...
));

parpopulate(Lab.SessionAnalysis);
populate(Lab.SessionAnalysis);
a_result = fetch(Lab.SessionAnalysis & 'session_id = 1', '*');
testCase.verifyEqual(a_result.session_analysis.connection_id, c1.serverId);
testCase.verifyEqual(a_result.session_analysis, 1);

end
end
Expand Down
2 changes: 1 addition & 1 deletion tests/test_schemas/+Lab/SessionAnalysis.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
methods(Access=protected)
function makeTuples(self,key)

c = dj.conn();
c = self.schema.conn;
r = sprintf('connection_id = %d', c.serverId);

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