Files
DP44/docs/ai/Common/DTS.Common.DataModel/Classes/TestObject.md
2026-04-17 14:55:32 -04:00

12 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common.DataModel/Classes/TestObject/TemplateChannelUI.cs
Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplateCollection.cs
Common/DTS.Common.DataModel/Classes/TestObject/TestObjectList.cs
Common/DTS.Common.DataModel/Classes/TestObject/TestTestObject.cs
Common/DTS.Common.DataModel/Classes/TestObject/TestObjectTemplate.cs
2026-04-17T15:35:53.685336+00:00 zai-org/GLM-5-FP8 1 03815d4f910aa842

Test Object Data Model Documentation

1. Purpose

This module provides the data model layer for managing test objects and their templates within the DataPRO/DTS system. It implements a hierarchy of classes that handle test object configuration, template management with channel definitions, and the relationship between test objects and their associated templates. The module supports both standalone test object definitions and test-specific variants (TestTestObject) that include additional runtime settings such as position assignments, timing parameters (excitation warmup, pre/post trigger), and the ability to convert templates to embedded copies for test isolation.


2. Public Interface

TemplateChannelUI

A GUI wrapper class for template channels, providing property change notification for UI binding.

Member Signature Description
Constructor TemplateChannelUI(DTS.Common.ISO.TestObjectTemplateChannel channel) Initializes the wrapper with an ISO template channel
Channel DTS.Common.ISO.TestObjectTemplateChannel Channel { get; set; } Gets or sets the wrapped ISO template channel, raising property change notifications

TestObjectTemplateCollection

A singleton collection manager for test object templates.

Member Signature Description
TemplateCollection static TestObjectTemplateCollection TemplateCollection { get; } Lazy-initialized singleton instance accessor
SysBuiltTestObjectTemplate TestObjectTemplate SysBuiltTestObjectTemplate { get; } Returns a static readonly system-built template
GetTemplate TestObjectTemplate GetTemplate(string templateId) Retrieves a template by ID from the ISO database; returns null if not found

TestObjectList

A thread-safe singleton list that holds test object groups.

Member Signature Description
TestObjectsList static TestObjectList TestObjectsList { get; } Thread-safe singleton instance accessor using lock pattern
Add void Add(TestObject to, bool bNotify) Adds a test object, sets LastModifiedBy to current user, sets LastModified to DateTime.Now, commits the object, and optionally notifies listeners
UpdateAll void UpdateAll() Raises OnPropertyChanged("TestObjects") to notify all listeners
Tags enum Tags { TestObjects } Tag enumeration for property change notification

TestTestObject

A test object belonging to a test, with test-specific settings. Inherits from TestObject and implements IComparable<TestTestObject>.

Member Signature Description
Constructor TestTestObject(TestObject obj) Creates from a base TestObject
Constructor TestTestObject(TestTestObject obj) Copy constructor with metadata
Constructor TestTestObject(TestTestObject obj, bool convertToEmbedded) Copy constructor with optional embedded conversion and metadata
Constructor TestTestObject(TestObject obj, bool convertToEmbedded) Creates with optional embedded template conversion
Position DTS.Common.ISO.MMEPositions Position { get; set; } Gets or sets the group position; setting cascades position to all required sensors with serial numbers
TestObject DTS.Common.ISO.MMETestObjects TestObject { get; set; } Gets or sets the ISO test object reference; cascades to all sensors
ExcitationWarmupTimeMS int ExcitationWarmupTimeMS { get; set; } Excitation warmup time in milliseconds
TargetSampleRate double TargetSampleRate { get; set; } Target sample rate
PreTriggerSeconds double PreTriggerSeconds { get; set; } Pre-trigger duration in seconds
PostTriggerSeconds double PostTriggerSeconds { get; set; } Post-trigger duration in seconds
GroupPositionComboBoxVisible Visibility GroupPositionComboBoxVisible { get; set; } Controls visibility of position combo box
GroupPositionButtonVisible Visibility GroupPositionButtonVisible { get; set; } Controls visibility of position button
AvailablePositions DTS.Common.ISO.MMEPositions[] AvailablePositions { get; } Gets available positions from ISO database
AvailableGroupPositions DTS.Common.ISO.MMEPositions[] AvailableGroupPositions { get; } Gets positions including synthetic "(channel defaults)" entry
AddedGroups TestObject[] AddedGroups { get; set; } Array of added test object groups
ChannelTypes string[] ChannelTypes { get; } Gets unique channel types including "(no channels)" placeholder
DisplayOrder int DisplayOrder { get; set; } Sort order, defaults to -1
IsAdd bool IsAdd { get; set; } Flag indicating add operation
SetTestObject void SetTestObject(string s) Sets internal test object string and raises property change
SetPosition void SetPosition(string s) Sets internal position string and updates visibility states
Rename void Rename(string oldName, string newName) Renames serial number, original serial number, original template, test setup name, and generates new GUID-based template names
CompareTo int CompareTo(TestTestObject other) Compares by DisplayOrder, falling back to base comparison on tie
ChannelDefaultsKey const string ChannelDefaultsKey = "#" Key for channel defaults position
UserSetKey const string UserSetKey = "@" Key for user-set position

TestObjectTemplate

A template definition for test objects with channel configurations. Implements IComparable<TestObjectTemplate>.

Member Signature Description
Constructor TestObjectTemplate() Default constructor; initializes empty strings and first available test object
Constructor TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db) Creates from ISO template
Constructor TestObjectTemplate(DTS.Common.ISO.TestObjectTemplate template, ref ISO13499FileDb db, List<MMETestObjects> testObjects) Creates from ISO template with provided test objects list
Constructor TestObjectTemplate(TestObjectTemplate copy, ref ISO13499FileDb db) Copy constructor
TemplateName string TemplateName { get; set; } Template name identifier
TemplateDescription string TemplateDescription { get; set; } Human-readable description
TemplateParent string TemplateParent { get; set; } Parent template reference
TestObject MMETestObjects TestObject { get; set; } Associated ISO test object; setting updates available test object types
TestObjectType string TestObjectType { get; set; } Type of test object; setting rebuilds all channels from database
TestObjectTypeIndex int TestObjectTypeIndex { get; set; } Index into AvailableTestObjectTypes
AvailableTestObjectTypes string[] AvailableTestObjectTypes { get; set; } Available types for the current test object
TemplateAllChannels TestObjectTemplateChannel[] TemplateAllChannels { get; set; } All template channels (wraps UI channels)
TemplateAllUIChannels TemplateChannelUI[] TemplateAllUIChannels { get; set; } UI-wrapped channel collection
RequiredChannels List<TestObjectTemplateChannel> RequiredChannels { get; set; } List of required channels
Embedded bool Embedded { get; set; } Whether template is embedded; syncs with underlying ISO template
OriginalTemplateName string OriginalTemplateName { get; set; } Original name for embedded templates
SysBuilt bool SysBuilt { get; set; } System-built flag
IsLocalOnly bool IsLocalOnly { get; set; } Local-only flag
LastModifiedBy string LastModifiedBy { get; set; } User who last modified; defaults to "N/A"
LastModified DateTime LastModified { get; set; } Last modification timestamp; defaults to SqlDateTime.MinValue
MarkChanged void MarkChanged(string tag) Raises property change for specified tag
AssignOrders void AssignOrders() Assigns display orders to channels with -1 order
ToISOTestObjectTemplate DTS.Common.ISO.TestObjectTemplate ToISOTestObjectTemplate() Converts to ISO template object
CompareTo int CompareTo(TestObjectTemplate rhs) Compares by TemplateName using ordinal comparison
ToString override string ToString() Returns OriginalTemplateName if embedded, otherwise TemplateName
ReadXML static DTS.Common.ISO.TestObjectTemplate ReadXML(System.Xml.XmlElement root, Dictionary<long, MMEPossibleChannels> importChannels) Reads template from XML element

3. Invariants

  • Singleton Access: TestObjectTemplateCollection.TemplateCollection and TestObjectList.TestObjectsList must be accessed through their static properties, never instantiated directly.
  • Position Keys: TestTestObject._position must be either "#" (channel defaults), "@" (user-set), or a valid position string from AvailablePositions.
  • Embedded Template Names: When a template is converted to embedded (convertToEmbedded = true), both TemplateName and SerialNumber are replaced with Guid.NewGuid().ToString().
  • Display Order Assignment: Channels with DisplayOrder == -1 are considered unassigned and will be assigned incremental orders starting from the current maximum + 1.
  • Thread Safety: TestObjectList uses a lock object for singleton access; TestObjectTemplateCollection uses volatile keyword but no lock.
  • Property Synchronization: Setting Embedded or OriginalTemplateName on TestObjectTemplate also sets the value on the underlying _template object if not null.

4. Dependencies

This module depends on:

  • DTS.Common.Base - BasePropertyChanged base class for property change notification
  • DTS.Common.ISO - ISO 13499 data types including TestObjectTemplateChannel, TestObjectTemplate, TestObject, MMEPositions, MMETestObjects, MMEPossibleChannels, ISO13499FileDb
  • DTS.Common.Utilities.Logging - Logging utilities
  • DTS.Common.DataModel - Additional data model components
  • System.Windows - Visibility enum for UI state management
  • System.Xml - XML serialization support
  • System.Data.SqlTypes - SqlDateTime for default timestamp values

What depends on this module:

  • Cannot be determined from source alone; the namespace DataPROWin7.DataModel suggests consumption by DataPRO Win7 UI components.

5. Gotchas

  1. Method Name Typo: CommonCustructorItems in TestTestObject is misspelled (should be "Constructor"). This is referenced in multiple constructors.

  2. Incomplete Thread Safety: TestObjectTemplateCollection uses volatile on _testObjectCollection but does not use a lock in the singleton getter, unlike TestObjectList which uses a proper lock pattern. This could lead to race conditions.

  3. Template Property Reset Workaround: In TestTestObject.CommonCustructorItems, there is a comment: "UGH, something resets the template properties. just change them back for now to the right values :/". This indicates a known but unresolved issue where template properties are being unexpectedly modified.

  4. TODO Comment: Both GroupPositionComboBoxVisible and GroupPositionButtonVisible getters contain commented-out code with the note "TODO Remove Non-ISO Mode code", suggesting incomplete removal of legacy functionality.

  5. Static Readonly Field Usage: _sysBuiltTestObjectTemplate in TestObjectTemplateCollection is declared static readonly but never initialized in any visible constructor or static constructor, meaning it will always be null.

  6. XML Field Handling: ProcessChannelXMLNode silently skips channels that don't have both MMEChannelId and MMEChannelType fields, and silently skips if the channel cannot be found in the database or import dictionary.

  7. Position Cascading: Setting Position on TestTestObject automatically modifies the Position property of all required sensors with non-empty serial numbers. This side effect may not be obvious to consumers.