Skip to content

Commit

Permalink
Feature/045 Completes interactive mode with breaking changes (#51)
Browse files Browse the repository at this point in the history
* Extended Get-IshTypeFieldDefinition with ISHBackgroundTask type

* #45 Basic skeleton of Get-IshBackgroundTask is there, all code requires clean up. Up next, the IshBackgroundTask xml parsing and console formatting.

* #45 Basic formatting, basic test, and xml object parsing is there. Next check and test all cmdlet parameters

* #45 Get-IshMetadataField accepts IshBackgroundTask

* #45 Get-IshBackgroundTask is there with doubtfully useful pipelining with test.

* #45 Corrected test and added Get-Help

* #45 More sturdy test

* #45 Introduced NameHelper where I chose underscore as separator. Currently Wrap-function is in the ISHType cmdlet like ISHBackgroundTask (to push down to TrisoftCmdlet all CardField type objects need a generic root class)

* #45 Review by hvermeiren on IsBasic and IsDescriptive for ISHBackgroundTask. Removed object.EventType. Implemented 13.0.2+ check. Wide format table layout.

* #45 IshSession is no longer mandatory. New-IshSession will save in SessionStore every time. Next optional -RequestedMetadata transformation like Descriptive/Basic/System/All

* #45 Parameter value autocompletion on field Name and LovId now respects SessionState

* #45 Optional -RequestedMetadata that now initializes to IShSession.DefaultRequestedMetadata (defaults to Basic, old behavior Descriptive, don't care about performance use All). Tweaked some tests. Up next Get-IshEvents over IshTypeFieldSetup or IshSession not mandatory everywhere...

* #46 Optional IshSession in cmdlets for Application, Baseline and Field... slower test though because of superfluous New-IshSession

* #46 Optional IshSession in cmdlets for Application, Baseline, Field, DocumentObj...More Get-Help examples... but slower tests though, because of superfluous New-IshSession

* #46 Optional IshSession in cmdlets for Application, BackgroundTask, Baseline, DocumentObj, EDT, Event, Feature, Field, Folder, ListOfValues, OutputFormat,...More Get-Help examples... but slower tests though, because of superfluous New-IshSession

* #46 Optional IshSession in cmdlets for Application, BackgroundTask, Baseline, DocumentObj, EDT, Event, Feature, Field, Folder, ListOfValues, OutputFormat, PublicationOutput, Settings, User, UserGroup, UserRole...More Get-Help examples... but slower tests though, because of superfluous New-IshSession

* #48 Implemented WrapAsPSObjectAndAddNoteProperties-Switch-block for DocumentObj... next is Format.ps1xml (see Find-IshDocumentObj example)... then all other classes

* #48 Removed WrapAsPSObjectAndAddNoteProperties-Switch-block for BackgroundTask/DocumentObj... implemented IshBaseObject allowing a one-time implementation of WriteObject in TrisoftCmdlt. Next is Format.ps1xml (see Find-IshDocumentObj example)... then all other classes

* #48 TrisoftCmdlet::WriteObject using IshBaseObject implemented for BackgroundTask, Baseline, DocumentObj. Next is Format.ps1xml (see Find-IshDocumentObj example)... then all other classes

* #48 TrisoftCmdlet::WriteObject using IshBaseObject implemented for BackgroundTask, Baseline, DocumentObj, EDT, Folder, OutputFormat, PublicationOutput, User, UserGroup, UserRole ...Next is more derived IshObject types to allow Format.ps1xml specialized rendering (see Find-IshDocumentObj example)... and Get-IshEvent

* #46 Optional IshSession in Get-IshTypeFieldDefinition

* #48 TrisoftCmdlet::WriteObject strips hyphens from a field name like DOC-LANGUAGE to avoid clumsy code like $ishObject.'doc-language' ...Next is more derived IshObject types to allow Format.ps1xml specialized rendering (see Find-IshDocumentObj example)... and Get-IshEvent

* #46 Optional IshSession makes single Find-IshDocumentObj and Find-IshPublicationOutput work without parameters potentially returning full database, putting in explicit last-day-MetadataFilter

* #46 Optional IshSession makes single Find-IshDocumentObj and Find-IshPublicationOutput work without parameters potentially returning full database, ROLLING BACK the explicit last-day-MetadataFilter that was added in this branch. Created separate issue #49 for tracking

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshDocumentObj cmdlets

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshDocumentObj cmdlets, tuned to use cmdlets ISHType for code consistency

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshPublicationOutput cmdlets

* #46 Optional IshSession in Get-IshTypeFieldDefinition, making sure that TriDKXmlSetupFilePath overload still works

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshBaseline cmdlets and IshBaselineItem prints sortable date

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshEDT cmdlets

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshFolder cmdlets

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshOutputFormat cmdlets

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshOutputFormat cmdlets, fixed OutputType, added samples and allowed empty value

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshUser cmdlets and cleanup of double IshFolder ps1xml entry

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshUserGroup cmdlets

* #48 Factory wrapping base type IshObject allowing .Format.ps1xml formatting now implemented for *-IshUserRole cmdlets

* #48 Find-IshDocumentObj over DocumentObj25.Find still returns ISHReusedObj, so altered default to avoid this. Quick performance test.

* #4 Reduce warning count in solution by replacing ArgumentNullException with ArgumentException, add readonly list,

* #4 Reduce warning count in solution by replacing ArgumentNullException with ArgumentException, add readonly list, added globalsuppressions.cs, wrapped ShouldProcess, refactored using statements

* #4 Adding AddIshPublicationOutput.Tests.ps1

* #47 Add GetIshEvent.Tests.ps1 testing the current old-style cmdlet, needs more work, broken at the moment

* #47 Add GetIshEvent.Tests.ps1 testing the cmdlet, ready for the code changes. Extended Get-IshTypeFieldDefinition with ISHEvent type.

* #47 Finally broke and rewrote Get-IshEvent to use PSNoteProperty with standardized property names. Matching GetIshEvent.Tests.ps1. And proper Format.ps1xml

As part of the v0.7 milestone, this request 
- Closes #44 
- Closes #45 
- Closes #46 
- Closes #47 
- Closes #48 
- Closes #50
  • Loading branch information
ddemeyer authored Mar 22, 2019
1 parent 9b0cd1f commit cad3673
Show file tree
Hide file tree
Showing 153 changed files with 4,783 additions and 822 deletions.
9 changes: 9 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,12 @@ of our module the option would be:
Warning: If you get a security warning, run the above exact powershell.exe command using Run As Administrator,
then execute `Set-ExecutionPolicy Unrestricted`

## Static Code Analysis (experiment)

1. Using `Docker Desktop` and `PowerShell Core 6` started `docker run -d --name sonarqube -p 9000:9000 sonarqube`
1. Navigated to `http://localhost:9000/` going to through the new project wizard (admin, ISHRemote)
1. Using `MSBuild Command Prompt for VS2015` triggered
1. `C:\TEMP\sonar\sonarscanner-msbuild\SonarScanner.MSBuild.exe begin /k:"ISHRemote" /d:sonar.host.url="http://localhost:9000" /d:sonar.login="9e96746fe7c2c8d11f6be0eed88cf3fb08c586d3"`
1. `MsBuild.exe /t:Rebuild`
1. `C:\TEMP\sonar\sonarscanner-msbuild\SonarScanner.MSBuild.exe end /d:sonar.login="9e96746fe7c2c8d11f6be0eed88cf3fb08c586d3"`
1. Then look at the analysis :)
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,31 @@ try {
Describe Get-IshVersion" -Tags "Read" {
Context Get-IshVersion Parameters" {
It "Parameter IshSession invalid" {
{ Get-IshVersion -IShSession "INVALIDISHSESSION" } | Should Throw
{ Get-IshVersion -IshSession "INVALIDISHSESSION" } | Should Throw
}
}

Context "Get-IshVersion returns IshVersion object" {
$ishVersion = Get-IshVersion -IShSession $ishSession
$ishVersion = Get-IshVersion -IshSession $ishSession
It "GetType()" {
$ishVersion.GetType().Name | Should BeExactly "IshVersion"
}
It "IshVersion.MajorVersion" {
$ishVersion.MajorVersion -ge 0 | Should Be $true
}
It "IshVersion.MinorVersion" {
$ishVersion.MinorVersion -ge 0 | Should Be $true
}
It "IshVersion.BuildVersion" {
$ishVersion.BuildVersion -ge 0 | Should Be $true
}
It "IshSession.RevisionVersion" {
$ishVersion.RevisionVersion -ge 0 | Should Be $true
}
}

Context "Get-IshVersion without IshSession returns IshVersion object" {
$ishVersion = Get-IshVersion
It "GetType()" {
$ishVersion.GetType().Name | Should BeExactly "IshVersion"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@ namespace Trisoft.ISHRemote.Cmdlets.Application
/// <example>
/// <code>
/// $ishSession = New-IshSession -WsBaseUrl "https://example.com/ISHWS/" -IshUserName "username" -IshUserPassword "userpassword"
/// $version = Get-Version -IshSession $ishSession
/// Write-Host $version
/// Get-IshVersion -IshSession $ishSession
/// </code>
/// <para>Get version example</para>
/// <para>Get version example with explicit IshSession</para>
/// </example>
/// <example>
/// <code>
/// New-IshSession -WsBaseUrl "https://example.com/ISHWS/" -IshUserName "username" -IshUserPassword "userpassword"
/// Get-IshVersion
/// </code>
/// <para>Get version example with implicit IshSession</para>
/// </example>
[Cmdlet(VerbsCommon.Get, "IshVersion", SupportsShouldProcess = false)]
[OutputType(typeof(IshVersion))]
Expand All @@ -42,13 +48,22 @@ public sealed class GetIshVersion : ApplicationCmdlet
/// <summary>
/// <para type="description">The IshSession variable holds the authentication and contract information. This object can be initialized using the New-IshSession cmdlet.</para>
/// </summary>
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = false), ValidateNotNullOrEmpty]
public IshSession IShSession { get; set; }
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = false)]
[ValidateNotNullOrEmpty]
public IshSession IshSession { get; set; }

protected override void BeginProcessing()
{
if (IshSession == null) { IshSession = (IshSession)SessionState.PSVariable.GetValue(ISHRemoteSessionStateIshSession); }
if (IshSession == null) { throw new ArgumentException(ISHRemoteSessionStateIshSessionException); }
WriteDebug($"Using IshSession[{IshSession.Name}] from SessionState.{ISHRemoteSessionStateIshSession}");
base.BeginProcessing();
}

protected override void ProcessRecord()
{
//Get the version of the application
string version = IShSession.Application25.GetVersion();
string version = IshSession.Application25.GetVersion();
IshVersion versionObject = new IshVersion(version);
WriteObject(versionObject);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2014 All Rights Reserved by the SDL Group.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Management.Automation;
using Trisoft.ISHRemote.Objects;
using Trisoft.ISHRemote.Objects.Public;
using Trisoft.ISHRemote.Exceptions;
using System.Collections.Generic;

namespace Trisoft.ISHRemote.Cmdlets.BackgroundTask
{
public abstract class BackgroundTaskCmdlet : TrisoftCmdlet
{
public Enumerations.ISHType[] ISHType
{
get { return new Enumerations.ISHType[] { Enumerations.ISHType.ISHBackgroundTask }; }
}
}
}

Loading

0 comments on commit cad3673

Please sign in to comment.