Skip to content

Commit

Permalink
#177 Hardcoded AddIshBackgroundTaskTableFieldSetup is aligned with th…
Browse files Browse the repository at this point in the history
…e result of RetrieveFieldSetupByIshType for ISHType.ISHBackgroundTask.
  • Loading branch information
Arian Taghva Manesh committed Dec 6, 2023
1 parent 612838c commit 493b8aa
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ Describe "Get-IshTypeFieldDefinition" -Tags "Read" {
Get-IshTypeFieldDefinition -IshSession $ishSession
$ishSession.IshTypeFieldDefinition[0].GetType().Name | Should -BeExactly "IshTypeFieldDefinition"
}
It "Table ISHBackgroundTask (since 13.0.2)" {
It "Table ISHBackgroundTask" {
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Level -EQ 'Task').Count | Should -Be 15
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Level -EQ 'History').Count | Should -Be 8
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property AllowOnRead -EQ $true).Count | Should -Be 23 # all columns are allowed to be read
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property AllowOnCreate -EQ $false).Count | Should -Be 23 # all columns are explicit api parameters and cannot be set over metadata
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property IsMultiValue -EQ $false).Count | Should -Be 23 # all columns are single value
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property IsSystem -EQ $true).Count | Should -Be 23 # all columns are system columns
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Level -EQ 'History').Count | Should -Be 9
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property AllowOnRead -EQ $true).Count | Should -Be 24 # all columns are allowed to be read
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property AllowOnCreate -EQ $false).Count | Should -Be 20 # all columns are explicit api parameters and cannot be set over metadata
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property IsMultiValue -EQ $false).Count | Should -Be 24 # all columns are single value
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property IsSystem -EQ $true).Count | Should -Be 24 # all columns are system columns
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Name -EQ 'STATUS').DataSource | Should -Be 'DBACKGROUNDTASKSTATUS'
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Name -EQ 'USERID').DataSource | Should -Be 'USERNAME'
(Get-IshTypeFieldDefinition -IshSession $ishSession | Where-Object -Property ISHType -EQ 'ISHBackgroundTask' | Where-Object -Property Name -EQ 'USERID').DataSource | Should -Be 'ISHUser'
}
It "Table ISHEvent" {
if((([Version]$ishSession.ServerVersion).Major -eq 15 -and ([Version]$ishSession.ServerVersion).Minor -ge 1) -or ([Version]$ishSession.ServerVersion).Major -ge 16)
Expand Down
47 changes: 24 additions & 23 deletions Source/ISHRemote/Trisoft.ISHRemote/Objects/IshTypeFieldSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,30 @@ private void AddIshBackgroundTaskTableFieldSetup()
_logger.WriteDebug($"IshTypeFieldSetup ishType[ISHBackgroundTask]");
var ishTypeFieldDefinitions = new List<IshTypeFieldDefinition>
{
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, true, true, "TASKID", Enumerations.DataType.Number, "", "", "The column 'TASKID' contains the unique identifier of the background task. This value can only be used for filtering!"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, true, false, "USERID", Enumerations.DataType.ISHLov, "USERNAME", "", "The user that started the background task Note: For this field you can request the value (Admin) or the element name (VUSERADMIN)"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, true, false, "STATUS", Enumerations.DataType.ISHLov, "DBACKGROUNDTASKSTATUS", "", "The status of the background task Note: For this field you can request the value (Pending) or the element name (VBACKGROUNDTASKSTATUSPENDING)"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "HASHID", Enumerations.DataType.String, "", "", "String containing the 'hash' representation for this background task. This will be used to skip older background task for the same action. For instance, synchronizing the same language object only once to SDL LiveContent."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, true, false, "EVENTTYPE", Enumerations.DataType.ISHLov, "DEVENTTYPE", "", "The type of the event (e.g PUBLISH)"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, false, false, "PROGRESSID", Enumerations.DataType.Number, "", "", "The unique identifier of the event log linked with this background task"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, false, false, false, false, true, false, false, "TRACKINGID", Enumerations.DataType.Number, "", "", "Currently the trackingId is the same as the progressId"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "CREATIONDATE", Enumerations.DataType.DateTime, "", "", "The date time that the background task was created"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "MODIFICATIONDATE", Enumerations.DataType.DateTime, "", "", "The date time that the background task was last modified"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "EXECUTEAFTERDATE", Enumerations.DataType.DateTime, "", "", "The background task should not be executed before this date time."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "LEASEDON", Enumerations.DataType.DateTime, "", "", "The date and time when background task was leased"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "LEASEDBY", Enumerations.DataType.String, "", "", "The id of the process/thread that leased the background task"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "CURRENTATTEMPT", Enumerations.DataType.Number, "", "", "Number containing the current attempt"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "INPUTDATAID", Enumerations.DataType.Number, "", "", "Data reference linking to the inputdata of the background task"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "OUTPUTDATAID", Enumerations.DataType.Number, "", "", "Data reference linking to the outputdata of the last execution of the background task"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, true, false, true, false, false, false, false, true, true, true, "HISTORYID", Enumerations.DataType.Number, "", "", "The column 'HISTORYID' contains the unique identifier of one of the history record of the background task. This value can only be used for filtering!"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "EXITCODE", Enumerations.DataType.Number, "", "", "The exit code for this background task execution"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "ERRORNUMBER", Enumerations.DataType.Number, "", "", "The error number thrown by this background task execution"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, false, false, "OUTPUT", Enumerations.DataType.Number, "", "", "Data reference linking to the outputdata of this background task execution"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, false, false, "ERROR", Enumerations.DataType.Number, "", "", "Data reference linking to the detailed error of this background task execution"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "STARTDATE", Enumerations.DataType.DateTime, "", "", "The date time that this execution of the background task was started"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "ENDDATE", Enumerations.DataType.DateTime, "", "", "The date time that this execution of the background task was finished"),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "HOSTNAME", Enumerations.DataType.String, "", "", "The host name from which the background task was created")
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, true, "TASKID", Enumerations.DataType.Number, "", "", "The unique identifier of the background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "USERID", Enumerations.DataType.ISHType, "USERID", "", "The user that created the background task.",new List<Enumerations.ISHType> {Enumerations.ISHType.ISHUser}),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "STATUS", Enumerations.DataType.ISHLov, "DBACKGROUNDTASKSTATUS", "", "The status of the background task. Possible values are: Pending, Executing, Failed, Success, Skipped and Aborted."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, true, false, false, false, true, false, false, "HASHID", Enumerations.DataType.String, "", "", "Hash identifier which allows grouping different background tasks."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, true, false, true, true, false, false, false, true, true, false, "EVENTTYPE", Enumerations.DataType.ISHLov, "DEVENTTYPE", "", "The type of the background task (e.g. PUBLISH, CREATETRANSLATION)."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, true, false, false, false, true, false, false, "PROGRESSID", Enumerations.DataType.Number, "", "", "Reference to the event logging linked with this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "TRACKINGID", Enumerations.DataType.Number, "", "", "Reference to the event logging linked with this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "CREATIONDATE", Enumerations.DataType.DateTime, "", "", "The date time that the background task was created."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "MODIFICATIONDATE", Enumerations.DataType.DateTime, "", "", "The date time that the background task was last modified."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, true, false, false, false, true, true, false, "EXECUTEAFTERDATE", Enumerations.DataType.DateTime, "", "", "The earliest date time that the execution of the background task can start."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "LEASEDON", Enumerations.DataType.DateTime, "", "", "The date time that a background task service start to execute this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "LEASEDBY", Enumerations.DataType.String, "", "", "Some unique code indicating which background task service is executing this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, true, false, "CURRENTATTEMPT", Enumerations.DataType.Number, "", "", "The current attempt which is executed to try to finish the background task successfully."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "INPUTDATAID", Enumerations.DataType.Number, "", "", "Reference to the blob containing the input data for this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.Task, false, false, true, false, false, false, false, true, false, false, "OUTPUTDATAID", Enumerations.DataType.Number, "", "", "Reference to the blob containing some output of this background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, true, false, true, false, false, false, false, true, true, false, "TASKID", Enumerations.DataType.Number, "", "", "The unique identifier of the background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, true, "HISTORYID", Enumerations.DataType.Number, "", "", "The unique identifier of the background task history which represent a specific execution of the background task."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "EXITCODE", Enumerations.DataType.Number, "", "", "The exit code for this background task execution."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "ERRORNUMBER", Enumerations.DataType.Number, "", "", "The error number for this background task execution."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, false, false, "OUTPUT", Enumerations.DataType.Number, "", "", "Reference to the blob containing some output of this background task execution."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, false, false, "ERROR", Enumerations.DataType.Number, "", "", "Reference to the blob containing more details for the error during this background task execution."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "STARTDATE", Enumerations.DataType.DateTime, "", "", "The date time that this background task execution started."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "ENDDATE", Enumerations.DataType.DateTime, "", "", "The date time that this background task execution finished."),
new IshTypeFieldDefinition(_logger, Enumerations.ISHType.ISHBackgroundTask, Enumerations.Level.History, false, false, true, false, false, false, false, true, true, false, "HOSTNAME", Enumerations.DataType.String, "", "", "The name of the server on which this background task attempt was executed.")
};
foreach (var ishTypeFieldDefinition in ishTypeFieldDefinitions)
{
Expand Down

0 comments on commit 493b8aa

Please sign in to comment.