diff --git a/.github/badges/code_issues.svg b/.github/badges/code_issues.svg
index 54e3a7f3f..ed6821365 100644
--- a/.github/badges/code_issues.svg
+++ b/.github/badges/code_issues.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/.github/badges/tests.svg b/.github/badges/tests.svg
index ebcbf5a95..526be2cac 100644
--- a/.github/badges/tests.svg
+++ b/.github/badges/tests.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/ndi/+ndi/+calc/+example/simple.m b/src/ndi/+ndi/+calc/+example/simple.m
index d963d7357..6d1472a08 100644
--- a/src/ndi/+ndi/+calc/+example/simple.m
+++ b/src/ndi/+ndi/+calc/+example/simple.m
@@ -96,16 +96,16 @@
% 1. Create mock documents if they don't exist
% Check/Create Doc for Test 1 (Value 5)
- q1 = ndi.query('','isa','demoNDIMock','');
- q2 = ndi.query('demoNDI.value','exact_number', 5, '');
+ q1 = ndi.query('','isa','demo_ndi_mock','');
+ q2 = ndi.query('demo_ndi.value','exact_number', 5, '');
q_test1 = q1 & q2;
docs_test1 = ndi_calculator_obj.session.database_search(q_test1);
if isempty(docs_test1)
- mock_doc1_struct.demoNDI.value = 5;
- % demoNDIMock requires a file because it inherits from demoNDI
- mock_doc1 = ndi.document('demoNDIMock', 'demoNDI', mock_doc1_struct.demoNDI) + ndi_calculator_obj.session.newdocument();
- % We need to add a dummy file because demoNDI schema requires 'filename1.ext'
+ mock_doc1_struct.demo_ndi.value = 5;
+ % demo_ndi_mock requires a file because it inherits from demo_ndi
+ mock_doc1 = ndi.document('demo_ndi_mock', 'demo_ndi', mock_doc1_struct.demo_ndi) + ndi_calculator_obj.session.newdocument();
+ % We need to add a dummy file because demo_ndi schema requires 'filename1.ext'
% Ideally we create a dummy file on disk.
fname1 = [ndi_calculator_obj.session.path() filesep 'test1_dummy.txt'];
vlt.file.str2text(fname1, 'dummy content');
@@ -117,13 +117,13 @@
end
% Check/Create Doc for Test 2 (Value 10)
- q3 = ndi.query('demoNDI.value','exact_number', 10, '');
+ q3 = ndi.query('demo_ndi.value','exact_number', 10, '');
q_test2 = q1 & q3;
docs_test2 = ndi_calculator_obj.session.database_search(q_test2);
if isempty(docs_test2)
- mock_doc2_struct.demoNDI.value = 10;
- mock_doc2 = ndi.document('demoNDIMock', 'demoNDI', mock_doc2_struct.demoNDI) + ndi_calculator_obj.session.newdocument();;
+ mock_doc2_struct.demo_ndi.value = 10;
+ mock_doc2 = ndi.document('demo_ndi_mock', 'demo_ndi', mock_doc2_struct.demo_ndi) + ndi_calculator_obj.session.newdocument();;
fname2 = [ndi_calculator_obj.session.path() filesep 'test2_dummy.txt'];
vlt.file.str2text(fname2, 'dummy content');
mock_doc2 = mock_doc2.add_file('filename1.ext', fname2);
@@ -154,7 +154,7 @@
end
% Setup Query for this specific test
- q_val = ndi.query('demoNDI.value', 'exact_number', target_value, '');
+ q_val = ndi.query('demo_ndi.value', 'exact_number', target_value, '');
q_combined = q1 & q_val;
search_params = struct('input_parameters', struct('answer', target_value), ...
diff --git a/src/ndi/+ndi/+compat/fieldAliases.m b/src/ndi/+ndi/+compat/fieldAliases.m
index ed6ce8419..3c2599cb9 100644
--- a/src/ndi/+ndi/+compat/fieldAliases.m
+++ b/src/ndi/+ndi/+compat/fieldAliases.m
@@ -67,12 +67,6 @@
{'ontology_label.ontology_name', 'ontology_label.label_id'}, ...
{@i_labelNodeToVDelta, @i_labelNodeToLegacy}; ...
'ontology_label.term.name', 'ontology_label.label', []; ...
- ...
- % daqmetadatareader: V_delta renamed the MATLAB-class storage
- % field. did2 migrator copies the v1 value verbatim; the alias
- % keeps legacy reader/writer code working at runtime.
- 'daqmetadatareader.reader_class', ...
- 'daqmetadatareader.ndi_daqmetadatareader_class', []; ...
};
end
diff --git a/src/ndi/+ndi/+database/+fun/ndi_document2ndi_object.m b/src/ndi/+ndi/+database/+fun/ndi_document2ndi_object.m
index dab2556fd..62f7fa5ee 100644
--- a/src/ndi/+ndi/+database/+fun/ndi_document2ndi_object.m
+++ b/src/ndi/+ndi/+database/+fun/ndi_document2ndi_object.m
@@ -37,41 +37,7 @@
error(['NDI_DOCUMENT_OBJ does not have a ''' obj_parent_string ''' field.']);
else
obj_struct = getfield(ndi_document_obj.document_properties, obj_parent_string);
- obj_string = resolveReconstructorClass(obj_parent_string, obj_struct);
+ obj_string = getfield(obj_struct,['ndi_' obj_parent_string '_class']);
end
o = eval([obj_string '(ndi_session_obj, ndi_document_obj);']);
-
-function obj_string = resolveReconstructorClass(obj_parent_string, obj_struct)
- % resolveReconstructorClass - determine the MATLAB class to
- % `eval()` for the document's reconstruction.
- %
- % did_v1 stored this class name on the body under
- % `.ndi__class`. Most V_delta migrators pass
- % the field through unchanged, but a few drop it on the
- % grounds that the stored value was a constant across every
- % instance of the class (so the migration loses no
- % information). For those classes we know the class name from
- % the document class itself and resolve it here.
-
- % Override map: V_delta class name -> MATLAB constructor class.
- % daqreader_ndr always reconstructs as ndi.daq.reader.mfdaq.ndr
- % (verified: every v1 daqreader_ndr blank stored the same value;
- % did-schema#50 / did-matlab#135 audit).
- overrides = struct( ...
- 'daqreader_ndr', 'ndi.daq.reader.mfdaq.ndr');
-
- legacyField = ['ndi_' obj_parent_string '_class'];
- if isfield(obj_struct, legacyField) && ~isempty(obj_struct.(legacyField))
- obj_string = obj_struct.(legacyField);
- return;
- end
- if isfield(overrides, obj_parent_string)
- obj_string = overrides.(obj_parent_string);
- return;
- end
- error('NDI:database:fun:noReconstructorClass', ...
- ['Cannot determine MATLAB reconstructor class for ' ...
- 'document class "%s": neither the legacy field "%s" ' ...
- 'nor a known override is available.'], ...
- obj_parent_string, legacyField);
diff --git a/src/ndi/+ndi/+database/+internal/applyReadNormalization.m b/src/ndi/+ndi/+database/+internal/applyReadNormalization.m
index b36cb3606..0e4619844 100644
--- a/src/ndi/+ndi/+database/+internal/applyReadNormalization.m
+++ b/src/ndi/+ndi/+database/+internal/applyReadNormalization.m
@@ -3,32 +3,27 @@
%
% NDIDOCUMENTOBJ = ndi.database.internal.applyReadNormalization(RAWDOC)
% wraps a body read from a concrete ndi.database backend in an
-% ndi.document. When the env var NDI_DID2_NORMALIZE_ON_READ is set to
-% '1', RAWDOC is first routed through did2.convert.v1_to_v2 so v1
+% ndi.document. RAWDOC is routed through did2.convert.v1_to_v2 so v1
% bodies are returned as V_delta-shaped documents. V_delta bodies
% short-circuit the converter's idempotency check, so re-reads of
% already-V_delta documents stay cheap.
%
-% The env-var gate is OFF by default so this PR can land ahead of the
-% companion work that the issue body lists as dependencies:
-% - "Issue 1": NDI schemas converted to V_delta (every blank doc
-% under src/ndi/ndi_common/database_documents/ is still v1, and
-% ndi.document.readblankdefinition reads from there).
-% - #779: in-memory compat shim that injects legacy aliases on
-% ndi.document read, so existing callers (e.g.,
-% ndi.database.fun.ndi_document2ndi_object,
-% ndi.daq.metadatareader) keep finding v1 field names like
-% ndi_daqmetadatareader_class after V_delta normalisation
-% renames them to reader_class.
-% With the gate OFF the wiring + tests in this file are dormant; flip
-% to ON via setenv('NDI_DID2_NORMALIZE_ON_READ','1') once #779 / issue
-% 1 ship to activate normalisation across every ndi.database backend.
+% The in-memory ndi.document then carries the did_v1 legacy alias
+% paths injected by ndi.compat.augmentRead (issue #779) plus
+% canonical `depends_on.document_id` entries via
+% ndi.compat.normalizeDependsOn (issue #801). Callers that still
+% read legacy field names (e.g.,
+% ndi.database.fun.ndi_document2ndi_object,
+% ndi.daq.metadatareader, customer code reading
+% document_properties.probe_location.ontology_name) keep working
+% even though storage normalised to V_delta. The write-side mirror
+% lives in ndi.compat.reconcileWrite (issue #780); query-side path
+% translation lives in ndi.compat.translateQueryPaths (issue #781).
%
% Concrete ndi.database subclasses call this helper from their
% do_read / do_search implementations so the abstract ndi.database
-% API stays byte-identical regardless of the gate state: callers
-% above the abstraction (session, dataset, queries) only ever see
-% ndi.document objects.
+% API stays byte-identical: callers above the abstraction (session,
+% dataset, queries) only ever see ndi.document objects.
%
% RAWDOC may be:
% - a struct (the body itself),
@@ -40,12 +35,14 @@
% Errors:
% NDI:database:normalizeBadInput - RAWDOC is not a recognised
% document/body type.
-% NDI:database:normalizeFailed - the gate is ON and
-% did2.convert.v1_to_v2
+% NDI:database:normalizeFailed - did2.convert.v1_to_v2
% quarantined the body so no
% migrated document was produced.
%
-% See also: did2.convert.v1_to_v2, ndi.database,
+% See also: did2.convert.v1_to_v2, ndi.compat.augmentRead,
+% ndi.compat.normalizeDependsOn,
+% ndi.compat.reconcileWrite, ndi.compat.translateQueryPaths,
+% ndi.database,
% ndi.database.implementations.database.didsqlite,
% ndi.database.implementations.database.matlabdumbjsondb2.
@@ -70,14 +67,6 @@
'(got "%s").'], class(rawDoc));
end
- if ~normalizationGateOn()
- % Gate OFF: preserve the pre-#776 behaviour (just wrap the
- % body) so the rest of the codebase keeps finding v1 field
- % names until issue 1 / #779 land.
- ndiDocumentObj = ndi.document(body);
- return;
- end
-
% Validate=false on the read path: the body was validated when it
% was written, and re-validating every read for every doc burns
% time on production workloads. The migrate command and the write
@@ -99,14 +88,3 @@
ndiDocumentObj = ndi.document(result.migrated{1}.toStruct());
end
-
-function tf = normalizationGateOn()
-% Read NDI_DID2_NORMALIZE_ON_READ and treat '1', 'true', 'yes', 'on' as
-% ON (case-insensitive). Anything else (including unset) is OFF.
-raw = getenv('NDI_DID2_NORMALIZE_ON_READ');
-if isempty(raw)
- tf = false;
- return;
-end
-tf = any(strcmpi(strtrim(raw), {'1', 'true', 'yes', 'on'}));
-end
diff --git a/src/ndi/+ndi/+migrate/cloud.m b/src/ndi/+ndi/+migrate/cloud.m
index 660bb562e..ce07ec9e7 100644
--- a/src/ndi/+ndi/+migrate/cloud.m
+++ b/src/ndi/+ndi/+migrate/cloud.m
@@ -8,7 +8,7 @@
% did2.convert.v1_to_v2 (idempotent — already-V_delta docs are
% skipped cheaply), and the surviving bodies are pushed back via the
% existing bulk-upload endpoint. Because each successfully written
-% doc carries `base.schema_version: 'V_delta'`, an interrupted run
+% doc carries `document_class.schema_version: 'V_delta'`, an interrupted run
% can resume by re-running this command — already-migrated docs
% short-circuit through the conversion.
%
diff --git a/src/ndi/+ndi/+test/+database/test_ndi_document.m b/src/ndi/+ndi/+test/+database/test_ndi_document.m
index 424f48a36..d51c439f2 100755
--- a/src/ndi/+ndi/+test/+database/test_ndi_document.m
+++ b/src/ndi/+ndi/+test/+database/test_ndi_document.m
@@ -23,16 +23,16 @@ function test_ndi_document(dirname)
% if we ran the demo before, delete the entry
- doc = E.database_search(ndi.query('','isa','demoNDI',''));
+ doc = E.database_search(ndi.query('','isa','demo_ndi',''));
if ~isempty(doc)
for i=1:numel(doc)
E.database_rm(id(doc{i}));
end
end
- doc = E.newdocument('demoNDI',...
+ doc = E.newdocument('demo_ndi',...
'base.name','Demo document',...
- 'demoNDI.value', 5);
+ 'demo_ndi.value', 5);
% add a binary file
@@ -54,15 +54,15 @@ function test_ndi_document(dirname)
% now read the object back
- doc = E.database_search(ndi.query('demoNDI.value','exact_number',5,''));
+ doc = E.database_search(ndi.query('demo_ndi.value','exact_number',5,''));
if numel(doc)~=1
- error(['Found <1 or >1 document with demoNDI.value of 5; this means there is a database problem.']);
+ error(['Found <1 or >1 document with demo_ndi.value of 5; this means there is a database problem.']);
end
doc = doc{1}, % should be only one match
- doc = E.database_search(ndi.query('','isa','demoNDI',''));
+ doc = E.database_search(ndi.query('','isa','demo_ndi',''));
if numel(doc)~=1
- error(['Found <1 or >1 document of type demoNDI; this means there is a database problem.']);
+ error(['Found <1 or >1 document of type demo_ndi; this means there is a database problem.']);
end
doc = doc{1}, % should be only one match
@@ -78,7 +78,7 @@ function test_ndi_document(dirname)
% remove the document
- doc = E.database_search(ndi.query('','isa','demoNDI',''));
+ doc = E.database_search(ndi.query('','isa','demo_ndi',''));
if ~isempty(doc)
for i=1:numel(doc)
E.database_rm(doc{i}.id());
diff --git a/src/ndi/+ndi/element.m b/src/ndi/+ndi/element.m
index 8180dd6b9..4250dde7a 100644
--- a/src/ndi/+ndi/element.m
+++ b/src/ndi/+ndi/element.m
@@ -405,12 +405,15 @@
newet.epoch_number = i;
newet.epoch_id = potential_epochdocs{i}.document_properties.epochid.epochid;
newet.epochprobemap = '';
- clock_types = strtrim(split(potential_epochdocs{i}.document_properties.element_epoch.epoch_clock,','));
+ % V_delta element_epoch.clocks: array-of-records
+ % with fields {name, t0, t1}. Replaces the v1
+ % parallel (epoch_clock CSV + t0_t1 matrix) shape.
+ clocks_array = potential_epochdocs{i}.document_properties.element_epoch.clocks;
ec = {};
t0_t1 = {};
- for k=1:numel(clock_types)
- ec{k} = ndi.time.clocktype(clock_types{k});
- t0_t1{k} = vlt.data.rowvec(potential_epochdocs{i}.document_properties.element_epoch.t0_t1(:,k));
+ for k=1:numel(clocks_array)
+ ec{k} = ndi.time.clocktype(char(clocks_array(k).name));
+ t0_t1{k} = vlt.data.rowvec([clocks_array(k).t0, clocks_array(k).t1]);
end
newet.epoch_clock = ec;
newet.t0_t1 = t0_t1;
diff --git a/src/ndi/ndi_common/database_documents/demoNDI.json b/src/ndi/ndi_common/database_documents/demo_ndi.json
similarity index 51%
rename from src/ndi/ndi_common/database_documents/demoNDI.json
rename to src/ndi/ndi_common/database_documents/demo_ndi.json
index 15cb37fa1..170c7c88a 100644
--- a/src/ndi/ndi_common/database_documents/demoNDI.json
+++ b/src/ndi/ndi_common/database_documents/demo_ndi.json
@@ -1,9 +1,9 @@
{
"document_class": {
- "definition": "$NDIDOCUMENTPATH\/demoNDI.json",
- "validation": "$NDISCHEMAPATH\/demoNDI_schema.json",
- "class_name": "demoNDI",
- "property_list_name": "demoNDI",
+ "definition": "$NDIDOCUMENTPATH\/demo_ndi.json",
+ "validation": "$NDISCHEMAPATH\/demo_ndi_schema.json",
+ "class_name": "demo_ndi",
+ "property_list_name": "demo_ndi",
"class_version": 1,
"superclasses": [
{ "definition": "$NDIDOCUMENTPATH\/base.json" }
@@ -14,7 +14,7 @@
"filename1.ext"
]
},
- "demoNDI": {
+ "demo_ndi": {
"value": ""
}
}
diff --git a/src/ndi/ndi_common/database_documents/mock/demoNDIMock.json b/src/ndi/ndi_common/database_documents/mock/demoNDIMock.json
deleted file mode 100644
index 922acd5d6..000000000
--- a/src/ndi/ndi_common/database_documents/mock/demoNDIMock.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "document_class": {
- "definition": "$NDIDOCUMENTPATH\/mock\/demoNDIMock.json",
- "validation": "$NDISCHEMAPATH\/mock\/demoNDIMock.json",
- "class_name": "demoNDIMock",
- "property_list_name": "demoNDIMock",
- "class_version": 1,
- "superclasses": [
- { "definition": "$NDIDOCUMENTPATH\/mock.json" },
- { "definition": "$NDIDOCUMENTPATH\/demoNDI.json" }
- ]
- },
- "demoNDIMock": {
- }
-}
diff --git a/src/ndi/ndi_common/database_documents/mock/demo_ndi_mock.json b/src/ndi/ndi_common/database_documents/mock/demo_ndi_mock.json
new file mode 100644
index 000000000..cf9678966
--- /dev/null
+++ b/src/ndi/ndi_common/database_documents/mock/demo_ndi_mock.json
@@ -0,0 +1,15 @@
+{
+ "document_class": {
+ "definition": "$NDIDOCUMENTPATH\/mock\/demo_ndi_mock.json",
+ "validation": "$NDISCHEMAPATH\/mock\/demo_ndi_mock.json",
+ "class_name": "demo_ndi_mock",
+ "property_list_name": "demo_ndi_mock",
+ "class_version": 1,
+ "superclasses": [
+ { "definition": "$NDIDOCUMENTPATH\/mock.json" },
+ { "definition": "$NDIDOCUMENTPATH\/demo_ndi.json" }
+ ]
+ },
+ "demo_ndi_mock": {
+ }
+}
diff --git a/src/ndi/ndi_common/resources/ndiDocumentAttributes.json b/src/ndi/ndi_common/resources/ndiDocumentAttributes.json
index 74f282b51..9c34427f0 100644
--- a/src/ndi/ndi_common/resources/ndiDocumentAttributes.json
+++ b/src/ndi/ndi_common/resources/ndiDocumentAttributes.json
@@ -54,7 +54,7 @@
"Data acqusiiton metadata"
]
},
- "demoNDI": {
+ "demo_ndi": {
"attributes": [
"Calculation"
]
diff --git a/src/ndi/ndi_common/schema_documents/demoNDI_schema.json b/src/ndi/ndi_common/schema_documents/demo_ndi_schema.json
similarity index 68%
rename from src/ndi/ndi_common/schema_documents/demoNDI_schema.json
rename to src/ndi/ndi_common/schema_documents/demo_ndi_schema.json
index 4c8d588f8..12b472a74 100644
--- a/src/ndi/ndi_common/schema_documents/demoNDI_schema.json
+++ b/src/ndi/ndi_common/schema_documents/demo_ndi_schema.json
@@ -1,18 +1,18 @@
{
- "classname": "demoNDI",
+ "classname": "demo_ndi",
"superclasses": [ "base" ],
"depends_on": [ ],
- "file": [
+ "file": [
{"name": "filename1.ext", "mustbenotempty": 1}
],
- "demoNDI": [
+ "demo_ndi": [
{
"name": "value",
"type": "integer",
"default_value": 1,
"parameters": [-100000,100000,0],
"queryable": 1,
- "documentation": "A value field for the demoNDI class."
+ "documentation": "A value field for the demo_ndi class."
}
]
}
diff --git a/src/ndi/ndi_common/schema_documents/mock/demoNDIMock.json b/src/ndi/ndi_common/schema_documents/mock/demoNDIMock.json
deleted file mode 100644
index 0ecbd7a0f..000000000
--- a/src/ndi/ndi_common/schema_documents/mock/demoNDIMock.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "classname": "demoNDIMock",
- "superclasses": [ "base", "mock", "demoNDI" ],
- "depends_on": [ ],
- "demoNDIMock": [
- ]
-}
diff --git a/src/ndi/ndi_common/schema_documents/mock/demo_ndi_mock.json b/src/ndi/ndi_common/schema_documents/mock/demo_ndi_mock.json
new file mode 100644
index 000000000..249b18560
--- /dev/null
+++ b/src/ndi/ndi_common/schema_documents/mock/demo_ndi_mock.json
@@ -0,0 +1,7 @@
+{
+ "classname": "demo_ndi_mock",
+ "superclasses": [ "base", "mock", "demo_ndi" ],
+ "depends_on": [ ],
+ "demo_ndi_mock": [
+ ]
+}
diff --git a/tests/+ndi/+unittest/+compat/AugmentReadTest.m b/tests/+ndi/+unittest/+compat/AugmentReadTest.m
index d79c8dba5..b90130131 100644
--- a/tests/+ndi/+unittest/+compat/AugmentReadTest.m
+++ b/tests/+ndi/+unittest/+compat/AugmentReadTest.m
@@ -68,23 +68,6 @@ function test_ontology_label_composite_empty_node(testCase)
testCase.verifyEqual(out.ontology_label.label, '');
end
- function test_daqmetadatareader_reader_class_mirrored(testCase)
- % New row added in #801: V_delta `reader_class` mirrors
- % back to did_v1 `ndi_daqmetadatareader_class` so legacy
- % callers (e.g., ndi.database.fun.ndi_document2ndi_object)
- % still find the class string after normalisation.
- body = i_baseBody('daqmetadatareader');
- body.daqmetadatareader = struct( ...
- 'reader_class', 'ndi.daq.metadatareader');
- out = ndi.compat.augmentRead(body);
- testCase.verifyEqual( ...
- out.daqmetadatareader.ndi_daqmetadatareader_class, ...
- 'ndi.daq.metadatareader');
- testCase.verifyEqual( ...
- out.daqmetadatareader.reader_class, ...
- 'ndi.daq.metadatareader');
- end
-
function test_idempotent_when_run_twice(testCase)
body = i_baseBody('probe_location');
body.probe_location = struct( ...
@@ -136,7 +119,6 @@ function test_unaffected_class_passes_through(testCase)
testCase.verifyFalse(isfield(out, 'treatment'));
testCase.verifyFalse(isfield(out, 'ontology_image'));
testCase.verifyFalse(isfield(out, 'ontology_label'));
- testCase.verifyFalse(isfield(out, 'daqmetadatareader'));
end
function test_noop_on_v1_shaped_body(testCase)
diff --git a/tests/+ndi/+unittest/+compat/FieldAliasesTest.m b/tests/+ndi/+unittest/+compat/FieldAliasesTest.m
index 0230e21d4..02f469953 100644
--- a/tests/+ndi/+unittest/+compat/FieldAliasesTest.m
+++ b/tests/+ndi/+unittest/+compat/FieldAliasesTest.m
@@ -97,13 +97,6 @@ function test_ontology_label_node_empty_inputs(testCase)
testCase.verifyEqual(parts{2}, 0);
end
- function test_daqmetadatareader_reader_class_row(testCase)
- aliases = ndi.compat.fieldAliases();
- row = i_findRow(aliases.fields, 'daqmetadatareader.reader_class');
- testCase.verifyEqual(row{2}, ...
- 'daqmetadatareader.ndi_daqmetadatareader_class');
- testCase.verifyTrue(isempty(row{3}));
- end
end
end
diff --git a/tests/+ndi/+unittest/+database/+internal/TestApplyReadNormalization.m b/tests/+ndi/+unittest/+database/+internal/TestApplyReadNormalization.m
index 202ea5404..92a7e21e7 100644
--- a/tests/+ndi/+unittest/+database/+internal/TestApplyReadNormalization.m
+++ b/tests/+ndi/+unittest/+database/+internal/TestApplyReadNormalization.m
@@ -3,34 +3,10 @@
% normaliser that concrete ndi.database subclasses call from do_read
% and do_search.
%
-% The normaliser is gated by the env var NDI_DID2_NORMALIZE_ON_READ
-% (OFF by default; see applyReadNormalization.m). Every test below
-% manages that env var explicitly via TestMethodSetup /
-% TestMethodTeardown so the gate state never leaks between tests.
-%
% The active-gate tests use the same v1 body shape as the synthetic-
% corpus tests under +ndi/+unittest/+migrate, so an upstream change
% in did2.convert.v1_to_v2 surfaces here too.
- properties (Access = private)
- SavedGate
- end
-
- methods (TestMethodSetup)
- function captureGate(testCase)
- testCase.SavedGate = getenv('NDI_DID2_NORMALIZE_ON_READ');
- % Default each test to the OFF gate; tests that need the
- % converter wired up flip it on explicitly.
- setenv('NDI_DID2_NORMALIZE_ON_READ', '');
- end
- end
-
- methods (TestMethodTeardown)
- function restoreGate(testCase)
- setenv('NDI_DID2_NORMALIZE_ON_READ', testCase.SavedGate);
- end
- end
-
methods (Test)
function testEmptyReturnsEmpty(testCase)
@@ -40,52 +16,27 @@ function testEmptyReturnsEmpty(testCase)
ndi.database.internal.applyReadNormalization(struct([])));
end
- function testGateOffWrapsBodyUnchanged(testCase)
- % With the gate OFF the v1 field names must survive
- % verbatim so callers above the database layer (e.g.,
- % ndi.database.fun.ndi_document2ndi_object,
- % ndi.daq.metadatareader) still find them. This is the
- % dormant-PR state pending issue 1 / #779.
- v1 = makeV1Body('alpha');
- doc = ndi.database.internal.applyReadNormalization(v1);
-
- verifyClass(testCase, doc, 'ndi.document');
- % document_class.class_name is not snake-cased while the
- % gate is OFF.
- verifyEqual(testCase, ...
- char(doc.document_properties.document_class.class_name), ...
- 'demo_a');
- % The original v1 demo_a block is preserved as-is.
- verifyTrue(testCase, isfield(doc.document_properties, 'demo_a'));
- verifyEqual(testCase, ...
- char(doc.document_properties.demo_a.marker), 'alpha');
- % universalRenames is NOT applied, so base.schema_version
- % was not stamped by the converter.
- verifyFalse(testCase, isfield( ...
- doc.document_properties.base, 'schema_version'));
- end
-
- function testGateOnConvertsV1StructToVDelta(testCase)
- setenv('NDI_DID2_NORMALIZE_ON_READ', '1');
+ function testConvertsV1StructToVDelta(testCase)
v1 = makeV1Body('alpha');
doc = ndi.database.internal.applyReadNormalization(v1);
verifyClass(testCase, doc, 'ndi.document');
% After v1->V_delta normalisation universalRenames stamps
- % base.schema_version to 'V_delta'.
- verifyTrue(testCase, isfield(doc.document_properties, 'base'));
- verifyTrue(testCase, isfield(doc.document_properties.base, ...
- 'schema_version'));
+ % document_class.schema_version to 'V_delta' (sibling of
+ % class_name/class_version/superclasses — never on base).
+ verifyTrue(testCase, isfield(doc.document_properties, ...
+ 'document_class'));
+ verifyTrue(testCase, isfield( ...
+ doc.document_properties.document_class, 'schema_version'));
verifyEqual(testCase, ...
- char(doc.document_properties.base.schema_version), ...
+ char(doc.document_properties.document_class.schema_version), ...
'V_delta');
verifyEqual(testCase, ...
char(doc.document_properties.document_class.class_name), ...
'demo_a');
end
- function testGateOnVDeltaBodyShortCircuits(testCase)
- setenv('NDI_DID2_NORMALIZE_ON_READ', '1');
+ function testVDeltaBodyShortCircuits(testCase)
% An already-V_delta body should round-trip with no shape
% drift (the converter's idempotency check fires).
v1 = makeV1Body('beta');
@@ -97,14 +48,14 @@ function testGateOnVDeltaBodyShortCircuits(testCase)
secondPass.document_properties.base.name, ...
firstPass.document_properties.base.name);
verifyEqual(testCase, ...
- char(secondPass.document_properties.base.schema_version), ...
+ char(secondPass.document_properties.document_class.schema_version), ...
'V_delta');
end
function testNdiDocumentPassThrough(testCase)
% An ndi.document already lives at the abstraction layer
% the helper is normalising into, so it is returned
- % verbatim regardless of gate state.
+ % verbatim.
v1 = makeV1Body('gamma');
wrapped = ndi.document(v1);
doc = ndi.database.internal.applyReadNormalization(wrapped);
@@ -113,8 +64,7 @@ function testNdiDocumentPassThrough(testCase)
wrapped.document_properties);
end
- function testGateOnAcceptsDid2Document(testCase)
- setenv('NDI_DID2_NORMALIZE_ON_READ', '1');
+ function testAcceptsDid2Document(testCase)
v1 = makeV1Body('delta');
d2 = did2.document(v1);
doc = ndi.database.internal.applyReadNormalization(d2);
@@ -130,32 +80,6 @@ function testBadInputErrors(testCase)
'NDI:database:normalizeBadInput');
end
- function testGateTruthyValues(testCase)
- % '1', 'true', 'yes', 'on' (any case, with whitespace) all
- % count as ON. Anything else is OFF.
- v1 = makeV1Body('eta');
- truthy = {'1', 'true', 'TRUE', 'yes', 'YES', 'on', ' 1 '};
- for k = 1:numel(truthy)
- setenv('NDI_DID2_NORMALIZE_ON_READ', truthy{k});
- doc = ndi.database.internal.applyReadNormalization(v1);
- verifyEqual(testCase, ...
- char(doc.document_properties.base.schema_version), ...
- 'V_delta', ...
- sprintf('Truthy gate value "%s" did not activate normalisation.', ...
- truthy{k}));
- end
-
- falsy = {'0', 'false', 'no', 'off', ''};
- for k = 1:numel(falsy)
- setenv('NDI_DID2_NORMALIZE_ON_READ', falsy{k});
- doc = ndi.database.internal.applyReadNormalization(v1);
- verifyFalse(testCase, isfield( ...
- doc.document_properties.base, 'schema_version'), ...
- sprintf('Falsy gate value "%s" unexpectedly activated normalisation.', ...
- falsy{k}));
- end
- end
-
end
end
diff --git a/tests/+ndi/+unittest/+database/TestNDIDocument.m b/tests/+ndi/+unittest/+database/TestNDIDocument.m
index 2c1db36f1..d724ac06e 100644
--- a/tests/+ndi/+unittest/+database/TestNDIDocument.m
+++ b/tests/+ndi/+unittest/+database/TestNDIDocument.m
@@ -66,9 +66,9 @@ function testDocumentCreationAndIO(testCase)
E = ndi.session.dir('exp1', testCase.testDir);
% 2. Create a new document object
- doc = E.newdocument('demoNDI', ...
+ doc = E.newdocument('demo_ndi', ...
'base.name', 'Demo document', ...
- 'demoNDI.value', 5);
+ 'demo_ndi.value', 5);
% 3. Create a binary file with known data
myfid = fopen(testCase.binaryFile, 'w', 'ieee-le');
@@ -86,11 +86,11 @@ function testDocumentCreationAndIO(testCase)
testCase.log(matlab.unittest.Verbosity.Verbose, 'Verifying document searching...');
% 5a. Search by a specific field value
- doc_search1 = E.database_search(ndi.query('demoNDI.value', 'exact_number', 5, ''));
+ doc_search1 = E.database_search(ndi.query('demo_ndi.value', 'exact_number', 5, ''));
testCase.verifyNumElements(doc_search1, 1, 'Did not find exactly one document when searching by value.');
% 5b. Search by the document type ('isa')
- doc_search2 = E.database_search(ndi.query('', 'isa', 'demoNDI', ''));
+ doc_search2 = E.database_search(ndi.query('', 'isa', 'demo_ndi', ''));
testCase.verifyNumElements(doc_search2, 1, 'Did not find exactly one document when searching by type.');
% 6. Verify reading binary data from the document
@@ -113,8 +113,8 @@ function testDocumentCreationAndIO(testCase)
function cleanupDemoDocuments(testCase)
E = ndi.session.dir('exp1', testCase.testDir);
- % Search for any documents of type 'demoNDI'
- docs_to_remove = E.database_search(ndi.query('', 'isa', 'demoNDI', ''));
+ % Search for any documents of type 'demo_ndi'
+ docs_to_remove = E.database_search(ndi.query('', 'isa', 'demo_ndi', ''));
% If any are found, remove them
if ~isempty(docs_to_remove)
diff --git a/tests/+ndi/+unittest/+dataset/testDatasetBuild.m b/tests/+ndi/+unittest/+dataset/testDatasetBuild.m
index 81e630bd9..a2e8bc556 100644
--- a/tests/+ndi/+unittest/+dataset/testDatasetBuild.m
+++ b/tests/+ndi/+unittest/+dataset/testDatasetBuild.m
@@ -24,11 +24,11 @@ function testSetup(testCase)
testCase.verifyTrue(any(strcmp(testCase.Session.id(), id_list)), 'Session ID should be in dataset session list');
% Check documents in dataset
- % There should be 5 demoNDI documents
- q = ndi.query('','isa','demoNDI');
+ % There should be 5 demo_ndi documents
+ q = ndi.query('','isa','demo_ndi');
docs = testCase.Dataset.database_search(q);
- testCase.verifyEqual(numel(docs), 5, 'Should find 5 demoNDI documents in the dataset');
+ testCase.verifyEqual(numel(docs), 5, 'Should find 5 demo_ndi documents in the dataset');
% Verify content
for i=1:5
diff --git a/tests/+ndi/+unittest/+fun/+dataset/diffTest.m b/tests/+ndi/+unittest/+fun/+dataset/diffTest.m
index 9ff6d7f75..6d5d3b66a 100644
--- a/tests/+ndi/+unittest/+fun/+dataset/diffTest.m
+++ b/tests/+ndi/+unittest/+fun/+dataset/diffTest.m
@@ -19,7 +19,7 @@ function testIdenticalDatasets(testCase)
D1 = ndi.dataset.dir('dref1', tempDir1);
% Add document
- doc1_base = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1_base = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
doc1 = doc1_base + S1.newdocument();
S1.database_add(doc1);
@@ -62,7 +62,7 @@ function testDocumentsInAOnly(testCase)
D2 = ndi.dataset.dir(tempDir2);
% Add a document only to the first dataset
- doc1 = S1.newdocument('demoNDI', 'base.name', 'doc in A only', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'doc in A only', 'demo_ndi.value', 1);
doc1 = doc1 + S1.newdocument();
S1.database_add(doc1);
@@ -103,7 +103,7 @@ function testDocumentsInBOnly(testCase)
S2 = D2.open_session(sessions{1});
- doc2 = S2.newdocument('demoNDI', 'base.name', 'doc in B only', 'demoNDI.value', 1);
+ doc2 = S2.newdocument('demo_ndi', 'base.name', 'doc in B only', 'demo_ndi.value', 1);
doc2 = doc2 + S2.newdocument();
S2.database_add(doc2);
@@ -140,12 +140,12 @@ function testMismatchedDocuments(testCase)
copyfile(tempDir1,tempDir2);
% Add documents with same ID but different properties
- doc1 = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
doc1 = doc1 + S1.newdocument();
S1.database_add(doc1);
doc2_structure = doc1.document_properties;
- doc2_structure.demoNDI.value = 2;
+ doc2_structure.demo_ndi.value = 2;
doc2_structure.base.session_id = S1.id();
doc2 = ndi.document(doc2_structure);
@@ -189,7 +189,7 @@ function testMismatchedFiles(testCase)
copyfile(tempDir1,tempDir2);
% Add documents with files that have different content
- doc1 = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
file1_path = fullfile(tempDir1, 'file1.bin');
fid1 = fopen(file1_path, 'w');
fwrite(fid1, 'content1', 'char');
@@ -199,7 +199,7 @@ function testMismatchedFiles(testCase)
S1.database_add(doc1);
doc2_structure = doc1.document_properties;
- doc2_structure.demoNDI.value = 2;
+ doc2_structure.demo_ndi.value = 2;
doc2_structure.base.session_id = S1.id();
doc2 = ndi.document(doc2_structure);
diff --git a/tests/+ndi/+unittest/+fun/+doc/TestFindFuid.m b/tests/+ndi/+unittest/+fun/+doc/TestFindFuid.m
index 5e65ce321..835602f0b 100644
--- a/tests/+ndi/+unittest/+fun/+doc/TestFindFuid.m
+++ b/tests/+ndi/+unittest/+fun/+doc/TestFindFuid.m
@@ -24,7 +24,7 @@ function setupTest(testCase)
testCase.D.add_linked_session(testCase.S);
% Create a test document with a file
- test_doc_ndi = ndi.document('demoNDI', 'demoNDI.value', 5);
+ test_doc_ndi = ndi.document('demo_ndi', 'demo_ndi.value', 5);
% Create a dummy file
testCase.test_filename = 'dummy.txt';
diff --git a/tests/+ndi/+unittest/+fun/+doc/testDiff.m b/tests/+ndi/+unittest/+fun/+doc/testDiff.m
index df10b5555..867dc7893 100644
--- a/tests/+ndi/+unittest/+fun/+doc/testDiff.m
+++ b/tests/+ndi/+unittest/+fun/+doc/testDiff.m
@@ -28,7 +28,7 @@ function teardown(testCase)
methods (Test)
function testIdenticalDocuments(testCase)
% Create two identical documents
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
doc2 = ndi.document(doc1.document_properties);
[are_equal, report] = ndi.fun.doc.diff(doc1, doc2);
@@ -39,9 +39,9 @@ function testIdenticalDocuments(testCase)
end
function testPropertyMismatch(testCase)
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
props = doc1.document_properties;
- props.demoNDI.value = 20;
+ props.demo_ndi.value = 20;
doc2 = ndi.document(props);
[are_equal, report] = ndi.fun.doc.diff(doc1, doc2);
@@ -52,21 +52,21 @@ function testPropertyMismatch(testCase)
end
function testIgnoreFields(testCase)
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
props = doc1.document_properties;
- props.demoNDI.value = 20; % Normally a mismatch
+ props.demo_ndi.value = 20; % Normally a mismatch
doc2 = ndi.document(props);
% Ignore the specific mismatching field
- [are_equal, ~] = ndi.fun.doc.diff(doc1, doc2, 'ignoreFields', {'base.session_id', 'demoNDI.value'});
+ [are_equal, ~] = ndi.fun.doc.diff(doc1, doc2, 'ignoreFields', {'base.session_id', 'demo_ndi.value'});
testCase.verifyTrue(are_equal, 'Documents should be equal when mismatching field is ignored.');
end
function testDifferentIDs(testCase)
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
% Create doc2 completely fresh so it has a different ID
- doc2 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc2 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
% Default behavior: base.id is compared, so they should differ
[are_equal, ~] = ndi.fun.doc.diff(doc1, doc2);
@@ -78,7 +78,7 @@ function testDifferentIDs(testCase)
end
function testDependenciesOrderIndependence(testCase)
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
% Add dependencies manually to props structure
props1 = doc1.document_properties;
@@ -105,7 +105,7 @@ function testDependenciesOrderIndependence(testCase)
function testFileListsOrderIndependence(testCase)
% Note: this only tests the file LIST, not binary content
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
% Mock up file structure since adding real files requires them to exist
props1 = doc1.document_properties;
@@ -134,7 +134,7 @@ function testFileListsOrderIndependence(testCase)
function testBinaryFileComparison(testCase)
% Create documents with files
- doc1 = testCase.Session.newdocument('demoNDI', 'base.name', 'MyDoc', 'demoNDI.value', 10);
+ doc1 = testCase.Session.newdocument('demo_ndi', 'base.name', 'MyDoc', 'demo_ndi.value', 10);
file1_path = fullfile(testCase.TempDir, 'file1.bin');
fid1 = fopen(file1_path, 'w');
fwrite(fid1, 'content1', 'char');
diff --git a/tests/+ndi/+unittest/+fun/+session/diffTest.m b/tests/+ndi/+unittest/+fun/+session/diffTest.m
index b93a027e8..20768672c 100644
--- a/tests/+ndi/+unittest/+fun/+session/diffTest.m
+++ b/tests/+ndi/+unittest/+fun/+session/diffTest.m
@@ -13,7 +13,7 @@ function testIdenticalSessions(testCase)
S1 = ndi.session.dir('ref1', tempDir1);
% Add a doc
- doc1 = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
S1.database_add(doc1);
% Create S2 as a COPY of S1
@@ -57,7 +57,7 @@ function testDocumentsInAOnly(testCase)
S1 = ndi.session.dir('ref1', tempDir1);
% Add a document only to S1
- doc1 = S1.newdocument('demoNDI', 'base.name', 'doc in A only', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'doc in A only', 'demo_ndi.value', 1);
S1.database_add(doc1);
% Create S2 as a copy of S1 (initially identical)
@@ -102,7 +102,7 @@ function testDocumentsInBOnly(testCase)
S2 = ndi.session.dir('ref1', tempDir2);
% Add a document only to S2
- doc2 = S2.newdocument('demoNDI', 'base.name', 'doc in B only', 'demoNDI.value', 1);
+ doc2 = S2.newdocument('demo_ndi', 'base.name', 'doc in B only', 'demo_ndi.value', 1);
S2.database_add(doc2);
% Call the diff function
@@ -133,13 +133,13 @@ function testMismatchedDocuments(testCase)
S1 = ndi.session.dir('ref1', tempDir1);
S2 = ndi.session.dir('ref1', tempDir2);
- doc1 = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
S1.database_add(doc1);
fixed_id = doc1.id();
% Add modified version to S2
doc2_props = doc1.document_properties;
- doc2_props.demoNDI.value = 2;
+ doc2_props.demo_ndi.value = 2;
doc2 = ndi.document(doc2_props);
% ID is preserved in properties
S2.database_add(doc2);
@@ -177,7 +177,7 @@ function testMismatchedFiles(testCase)
S1 = ndi.session.dir('ref1', tempDir1);
S2 = ndi.session.dir('ref1', tempDir2);
- doc1 = S1.newdocument('demoNDI', 'base.name', 'test doc', 'demoNDI.value', 1);
+ doc1 = S1.newdocument('demo_ndi', 'base.name', 'test doc', 'demo_ndi.value', 1);
doc1 = doc1.add_file('filename1.ext', file1_path);
S1.database_add(doc1);
fixed_id = doc1.id();
diff --git a/tests/+ndi/+unittest/+migrate/TestMigrateCloud.m b/tests/+ndi/+unittest/+migrate/TestMigrateCloud.m
index dffb0fc68..c9e4dc70f 100644
--- a/tests/+ndi/+unittest/+migrate/TestMigrateCloud.m
+++ b/tests/+ndi/+unittest/+migrate/TestMigrateCloud.m
@@ -255,7 +255,7 @@ function testRepublishAttemptedOnFailureIfWasPublished(testCase)
function body = makeVDeltaBody(name)
body = makeV1Body(name);
-body.base.schema_version = 'V_delta';
+body.document_class.schema_version = 'V_delta';
end
function s = pad16(name)
diff --git a/tests/+ndi/+unittest/+session/buildSession.m b/tests/+ndi/+unittest/+session/buildSession.m
index ba2429abf..383be1d38 100644
--- a/tests/+ndi/+unittest/+session/buildSession.m
+++ b/tests/+ndi/+unittest/+session/buildSession.m
@@ -90,7 +90,7 @@ function buildSessionTeardown(testCase)
% SESSION = WITHDOCSANDFILES()
%
% Creates an NDI.SESSION.DIR object in a temporary directory
- % with 5 NDI.DOCUMENTS of type 'demoNDI'.
+ % with 5 NDI.DOCUMENTS of type 'demo_ndi'.
%
% The documents have names 'doc_1', 'doc_2', ..., 'doc_5'.
% The file content for each is 'doc_1', 'doc_2', etc.
@@ -113,7 +113,7 @@ function addDocsWithFiles(session, docNumber)
%
% ADDDOCSWITHFILES(SESSION, DOCNUMBER)
%
- % Adds a document of type 'demoNDI' to the session.
+ % Adds a document of type 'demo_ndi' to the session.
% The document has name 'doc_' and the file content is also 'doc_'.
dirname = session.path();
@@ -127,12 +127,12 @@ function addDocsWithFiles(session, docNumber)
% Create document
% Create a blank document first to get the structure
- doc = ndi.document('demoNDI') + session.newdocument();
+ doc = ndi.document('demo_ndi') + session.newdocument();
% Modify properties
doc_props = doc.document_properties;
doc_props.base.name = docname;
- doc_props.demoNDI.value = docNumber;
+ doc_props.demo_ndi.value = docNumber;
% Recreate document with modified properties
doc = ndi.document(doc_props);
diff --git a/tests/+ndi/+unittest/+session/buildSessionNDRAxon.m b/tests/+ndi/+unittest/+session/buildSessionNDRAxon.m
index 9d21f1ed4..0ff3719cf 100644
--- a/tests/+ndi/+unittest/+session/buildSessionNDRAxon.m
+++ b/tests/+ndi/+unittest/+session/buildSessionNDRAxon.m
@@ -90,7 +90,7 @@ function buildSessionTeardown(testCase)
% SESSION = WITHDOCSANDFILES()
%
% Creates an NDI.SESSION.DIR object in a temporary directory
- % with 5 NDI.DOCUMENTS of type 'demoNDI'.
+ % with 5 NDI.DOCUMENTS of type 'demo_ndi'.
%
% The documents have names 'doc_1', 'doc_2', ..., 'doc_5'.
% The file content for each is 'doc_1', 'doc_2', etc.
@@ -113,7 +113,7 @@ function addDocsWithFiles(session, docNumber)
%
% ADDDOCSWITHFILES(SESSION, DOCNUMBER)
%
- % Adds a document of type 'demoNDI' to the session.
+ % Adds a document of type 'demo_ndi' to the session.
% The document has name 'doc_' and the file content is also 'doc_'.
dirname = session.path();
@@ -127,12 +127,12 @@ function addDocsWithFiles(session, docNumber)
% Create document
% Create a blank document first to get the structure
- doc = ndi.document('demoNDI') + session.newdocument();
+ doc = ndi.document('demo_ndi') + session.newdocument();
% Modify properties
doc_props = doc.document_properties;
doc_props.base.name = docname;
- doc_props.demoNDI.value = docNumber;
+ doc_props.demo_ndi.value = docNumber;
% Recreate document with modified properties
doc = ndi.document(doc_props);
diff --git a/tests/+ndi/+unittest/+session/buildSessionNDRIntan.m b/tests/+ndi/+unittest/+session/buildSessionNDRIntan.m
index f54bf79c7..17ab96be4 100644
--- a/tests/+ndi/+unittest/+session/buildSessionNDRIntan.m
+++ b/tests/+ndi/+unittest/+session/buildSessionNDRIntan.m
@@ -90,7 +90,7 @@ function buildSessionTeardown(testCase)
% SESSION = WITHDOCSANDFILES()
%
% Creates an NDI.SESSION.DIR object in a temporary directory
- % with 5 NDI.DOCUMENTS of type 'demoNDI'.
+ % with 5 NDI.DOCUMENTS of type 'demo_ndi'.
%
% The documents have names 'doc_1', 'doc_2', ..., 'doc_5'.
% The file content for each is 'doc_1', 'doc_2', etc.
@@ -113,7 +113,7 @@ function addDocsWithFiles(session, docNumber)
%
% ADDDOCSWITHFILES(SESSION, DOCNUMBER)
%
- % Adds a document of type 'demoNDI' to the session.
+ % Adds a document of type 'demo_ndi' to the session.
% The document has name 'doc_' and the file content is also 'doc_'.
dirname = session.path();
@@ -127,12 +127,12 @@ function addDocsWithFiles(session, docNumber)
% Create document
% Create a blank document first to get the structure
- doc = ndi.document('demoNDI') + session.newdocument();
+ doc = ndi.document('demo_ndi') + session.newdocument();
% Modify properties
doc_props = doc.document_properties;
doc_props.base.name = docname;
- doc_props.demoNDI.value = docNumber;
+ doc_props.demo_ndi.value = docNumber;
% Recreate document with modified properties
doc = ndi.document(doc_props);
diff --git a/tests/+ndi/+unittest/DocumentWriteTest.m b/tests/+ndi/+unittest/DocumentWriteTest.m
index 4db580169..5bb87a7ca 100644
--- a/tests/+ndi/+unittest/DocumentWriteTest.m
+++ b/tests/+ndi/+unittest/DocumentWriteTest.m
@@ -43,8 +43,8 @@ function testWriteLocalFiles(testCase)
fprintf(fid, 'Hello World');
fclose(fid);
- % Create doc and add file. Use demoNDI type.
- d = ndi.document('demoNDI', 'demoNDI.value', 1);
+ % Create doc and add file. Use demo_ndi type.
+ d = ndi.document('demo_ndi', 'demo_ndi.value', 1);
d = d.add_file('filename1.ext', dummyFile);
outputPrefix = fullfile(testCase.TempDir, 'test_output_local');
@@ -79,7 +79,7 @@ function testWriteSessionFiles(testCase)
fclose(fid);
% Create doc
- d = S.newdocument('demoNDI', 'base.name', 'session_doc', 'demoNDI.value', 1);
+ d = S.newdocument('demo_ndi', 'base.name', 'session_doc', 'demo_ndi.value', 1);
d = d.add_file('filename1.ext', dummyFile);
% Add to session database