From 5550c802e05148d0d817982ccf0db30b08f7e644 Mon Sep 17 00:00:00 2001 From: Arian Taghva Manesh Date: Mon, 13 May 2024 16:45:53 +0200 Subject: [PATCH 1/2] #191 The DATETIMEKIND fields are removed from AddIshEventTableFieldSetup and pester tests are aligned. --- .../EventMonitor/GetIshEvent.Tests.ps1 | 24 +++++++++++-------- .../Objects/IshTypeFieldSetup.cs | 5 ---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 index 4d89243b..816e6287 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 @@ -136,7 +136,7 @@ Describe "Get-IshEvent" -Tags "Create" { $ishSession.DefaultRequestedMetadata = "All" $ishEvent = (Get-IshEvent -IShSession $ishSession)[0] if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { - $ishEvent.IshField.Count | Should -Be 12 + $ishEvent.IshField.Count | Should -Be 11 } else { $ishEvent.IshField.Count | Should -Be 10 } @@ -149,7 +149,11 @@ Describe "Get-IshEvent" -Tags "Create" { $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allProgressMetadata)[0] $ishEvent.ProgressRef -gt 0 | Should -Be $true #$ishEvent.DetailRef -gt 0 | Should -Be $true - $ishEvent.IshField.Count | Should -Be 10 + if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16) { + $ishEvent.IshField.Count | Should -Be 12 + } else { + $ishEvent.IshField.Count | Should -Be 10 + } } It "Parameter RequestedMetadata only all of Detail level" { $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allDetailMetadata)[0] @@ -158,14 +162,14 @@ Describe "Get-IshEvent" -Tags "Create" { $ishEvent.IshField.Count -ge 20 | Should -Be $true # Perhaps expected 10 Progress level fields, but Get-IshEvent currently always retrieves details as well } It "Parameter RequestedMetadata PipelineObjectPreference=PSObjectNoteProperty" { - $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" - $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allMetadata)[0] - $ishEvent.GetType().Name | Should -BeExactly "IshEvent" # and not PSObject - [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $true - $ishEvent.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss + $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allMetadata)[0] + $ishEvent.GetType().Name | Should -BeExactly "IshEvent" # and not PSObject + [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $true + $ishEvent.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss } It "Parameter RequestedMetadata PipelineObjectPreference=Off" { $pipelineObjectPreference = $ishSession.PipelineObjectPreference diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs b/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs index 4322700a..f8c91c50 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs +++ b/Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs @@ -173,11 +173,6 @@ private void AddIshEventTableFieldSetup() new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHEvent, Enumerations.Level.Detail, true, false, true, true, false, false, false, true, true, false, "EVENTDATATYPE", Enumerations.DataType.Number, "", "", "The event data type that indicates the content data type of the referenced blob under this event detail. Possible values are: None(0), String(1), List(2), Xml(3), SendEventData(10), LogObject (20), StatusReport(21), CommandOutput(30), DITAOTLogFile (31) and Other(99)."), new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHEvent, Enumerations.Level.Detail, false, false, true, false, false, false, false, true, true, false, "EVENTDATASIZE", Enumerations.DataType.Number, "", "", "The event data size contains the data size of the referenced blob under this detailid."), }; - if ((_ishVersion.MajorVersion == 15 && _ishVersion.MinorVersion >= 1) || _ishVersion.MajorVersion >= 16) - { - ishTypeFieldDefinitions.Add(new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHEvent, Enumerations.Level.Progress, false, false, true, false, false, false, false, true, false, false, "DATETIMEKIND", Enumerations.DataType.String, "", "", "The kind of the date time (LOCAL, UTC) in the creation and modification date of the event progress.")); - ishTypeFieldDefinitions.Add(new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHEvent, Enumerations.Level.Detail, false, false, true, false, false, false, false, true, false, false, "DATETIMEKIND", Enumerations.DataType.String, "", "", "The kind of the date time (LOCAL, UTC) in the creation of the event detail.")); - } foreach (var ishTypeFieldDefinition in ishTypeFieldDefinitions) { From b7c41f1f3a2310ade500f0eed860d832388f397e Mon Sep 17 00:00:00 2001 From: Arian Taghva Manesh Date: Fri, 24 May 2024 08:56:42 +0200 Subject: [PATCH 2/2] #191 Extra tabs are removed from GetIshEvent pester tests. --- .../Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 index 816e6287..a4f5263f 100644 --- a/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 +++ b/Source/ISHRemote/Trisoft.ISHRemote/Cmdlets/EventMonitor/GetIshEvent.Tests.ps1 @@ -162,14 +162,14 @@ Describe "Get-IshEvent" -Tags "Create" { $ishEvent.IshField.Count -ge 20 | Should -Be $true # Perhaps expected 10 Progress level fields, but Get-IshEvent currently always retrieves details as well } It "Parameter RequestedMetadata PipelineObjectPreference=PSObjectNoteProperty" { - $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" - $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allMetadata)[0] - $ishEvent.GetType().Name | Should -BeExactly "IshEvent" # and not PSObject - [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $true - [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $true - $ishEvent.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss + $ishSession.PipelineObjectPreference | Should -Be "PSObjectNoteProperty" + $ishEvent = (Get-IshEvent -IshSession $ishSession -ModifiedSince ((Get-Date).AddMinutes(-10)) -UserFilter All -RequestedMetadata $allMetadata)[0] + $ishEvent.GetType().Name | Should -BeExactly "IshEvent" # and not PSObject + [bool]($ishEvent.PSobject.Properties.name -match "status") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "userid") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "modificationdate") | Should -Be $true + [bool]($ishEvent.PSobject.Properties.name -match "status_detail_value") | Should -Be $true + $ishEvent.modificationdate -like "*/*" | Should -Be $false # It should be sortable date format: yyyy-MM-ddTHH:mm:ss } It "Parameter RequestedMetadata PipelineObjectPreference=Off" { $pipelineObjectPreference = $ishSession.PipelineObjectPreference