Skip to content

Commit f701419

Browse files
Fix issues with odd filenames in repo and add Service Studio and Integration Studio as separate installers (#138)
* Changes due to split of Development Environment installer Changes due to the split of Development Environment installer into separate Service Studio and Integration Studio ones. * Fix issues with names and version numbers incompatible with [System.Version[]] Some files in the repository have names ending in ..exe or have version numbers not following major.minor.build.revision causing variable assignment with [System.Version[]] to fail Removing extension and whatever is after the correct version numbering with regex. * Add tests for Get-OSRepoAvailableVersions * Add tests for cases when using -Latest * Add mock of list of files from repository
1 parent e8145cb commit f701419

2 files changed

Lines changed: 131 additions & 7 deletions

File tree

src/Outsystems.SetupTools/Functions/Get-OSRepoAvailableVersions.ps1

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Get-OSRepoAvailableVersions
1010
1111
.PARAMETER Application
1212
Specifies which application to retrieve the version
13-
This can be 'PlatformServer', 'ServiceStudio', 'Lifetime'
13+
This can be 'PlatformServer', 'Lifetime', 'DevelopmentEnvironment', 'ServiceStudio', 'IntegrationStudio'
1414
1515
.PARAMETER MajorVersion
1616
Specifies the platform major version
@@ -24,7 +24,7 @@ function Get-OSRepoAvailableVersions
2424
Get-OSRepoAvailableVersions -Application 'PlatformServer' -MajorVersion '10'
2525
2626
.EXAMPLE
27-
Get the latest available version of the OutSystems 11 development environment
27+
Get the latest available version of the OutSystems 11 Service Studio
2828
Get-OSRepoAvailableVersions -Application 'ServiceStudio' -MajorVersion '11' -Latest
2929
3030
#>
@@ -33,7 +33,7 @@ function Get-OSRepoAvailableVersions
3333
[OutputType('String')]
3434
param (
3535
[Parameter(Mandatory = $true)]
36-
[ValidateSet('PlatformServer', 'ServiceStudio', 'Lifetime')]
36+
[ValidateSet('PlatformServer', 'Lifetime', 'DevelopmentEnvironment', 'ServiceStudio', 'IntegrationStudio')]
3737
[string]$Application,
3838

3939
[Parameter(Mandatory = $true)]
@@ -75,17 +75,27 @@ function Get-OSRepoAvailableVersions
7575
'PlatformServer'
7676
{
7777
$files = $files | Where-Object -FilterScript { $_ -like "PlatformServer-*" }
78-
$versions = $files -replace 'PlatformServer-', '' -replace '.exe', ''
78+
$versions = $files -replace 'PlatformServer-', '' -replace '(?<=\d+\.\d+\.\d+\.\d+)\D.*exe', ''
7979
}
80-
'ServiceStudio'
80+
'DevelopmentEnvironment'
8181
{
8282
$files = $files | Where-Object -FilterScript { $_ -like "DevelopmentEnvironment-*" }
83-
$versions = $files -replace 'DevelopmentEnvironment-', '' -replace '.exe', ''
83+
$versions = $files -replace 'DevelopmentEnvironment-', '' -replace '(?<=\d+\.\d+\.\d+\.\d+)\D.*exe', ''
8484
}
8585
'Lifetime'
8686
{
8787
$files = $files | Where-Object -FilterScript { $_ -like "LifeTimeWithPlatformServer-*" }
88-
$versions = $files -replace 'LifeTimeWithPlatformServer-', '' -replace '.exe', ''
88+
$versions = $files -replace 'LifeTimeWithPlatformServer-', '' -replace '(?<=\d+\.\d+\.\d+\.\d+)\D.*exe', ''
89+
}
90+
'IntegrationStudio'
91+
{
92+
$files = $files | Where-Object -FilterScript { $_ -like "IntegrationStudio-*" }
93+
$versions = $files -replace 'IntegrationStudio-', '' -replace '(?<=\d+\.\d+\.\d+\.\d+)\D.*exe', ''
94+
}
95+
'ServiceStudio'
96+
{
97+
$files = $files | Where-Object -FilterScript { $_ -like "ServiceStudio-*" }
98+
$versions = $files -replace 'ServiceStudio-', '' -replace '(?<=\d+\.\d+\.\d+\.\d+)\D.*exe', ''
8999
}
90100
}
91101

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
Get-Module Outsystems.SetupTools | Remove-Module -Force
2+
Import-Module $PSScriptRoot\..\..\src\Outsystems.SetupTools -Force -ArgumentList $false, '', '', $false
3+
4+
InModuleScope -ModuleName OutSystems.SetupTools {
5+
Describe 'Get-OSRepoAvailableVersions Tests' {
6+
7+
$AzRepoFiles = (
8+
'DevelopmentEnvironment-11.14.3.56735.exe',
9+
'DevelopmentEnvironment-11.14.14.59923.exe',
10+
'DevelopmentEnvironment-11.14.16.60354.exe',
11+
'IntegrationStudio-11.14.22.112.exe',
12+
'IntegrationStudio-11.14.23.119.exe',
13+
'IntegrationStudio-11.14.24.121.exe',
14+
'LifeTimeWithPlatformServer-11.10.3.1469.0.exe',
15+
'LifeTimeWithPlatformServer-11.14.0.2131..exe',
16+
'LifeTimeWithPlatformServer-11.26.2.3750.exe',
17+
'PlatformServer-11.33.1.44835.exe',
18+
'PlatformServer-11.34.0.44828.exe',
19+
'PlatformServer-11.34.1.45035.exe',
20+
'SQLServer2017-SSEI-Expr.exe',
21+
'SSMS-Setup-ENU.exe',
22+
'ServiceStudio-11.55.16.64072.exe',
23+
'ServiceStudio-11.55.17.64089.exe',
24+
'ServiceStudio-11.55.18.64106.exe',
25+
'imagebuilder.exe',
26+
'license.lic',
27+
'license10.lic'
28+
)
29+
30+
# Global mocks
31+
Mock GetAzStorageFileList { return $AzRepoFiles }
32+
33+
Context 'When getting Platform Server versions' {
34+
35+
$result = Get-OSRepoAvailableVersions -Application 'PlatformServer' -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
36+
37+
It 'Should not have errors' { $err.Count | Should Be 0 }
38+
It 'Should return at least one version' { $result.Count | Should BeGreaterThan 0 }
39+
}
40+
41+
Context 'When getting Platform Server latest version' {
42+
43+
$result = Get-OSRepoAvailableVersions -Application 'PlatformServer' -MajorVersion '11' -Latest -ErrorVariable err -ErrorAction SilentlyContinue
44+
45+
It 'Should not have errors' { $err.Count | Should Be 0 }
46+
It 'Should return exactly one version' { $result.Count | Should Be 1 }
47+
}
48+
49+
Context 'When getting Development Environment versions' {
50+
51+
$result = Get-OSRepoAvailableVersions -Application 'DevelopmentEnvironment' -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
52+
53+
It 'Should not have errors' { $err.Count | Should Be 0 }
54+
It 'Should return at least one version' { $result.Count | Should BeGreaterThan 0 }
55+
}
56+
57+
Context 'When getting Development Environment latest version' {
58+
59+
$result = Get-OSRepoAvailableVersions -Application 'DevelopmentEnvironment' -MajorVersion '11' -Latest -ErrorVariable err -ErrorAction SilentlyContinue
60+
61+
It 'Should not have errors' { $err.Count | Should Be 0 }
62+
It 'Should return exactly one version' { $result.Count | Should Be 1 }
63+
}
64+
65+
Context 'When getting Lifetime versions' {
66+
67+
$result = Get-OSRepoAvailableVersions -Application 'Lifetime' -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
68+
69+
It 'Should not have errors' { $err.Count | Should Be 0 }
70+
It 'Should return at least one version' { $result.Count | Should BeGreaterThan 0 }
71+
}
72+
73+
Context 'When getting Lifetime latest version' {
74+
75+
$result = Get-OSRepoAvailableVersions -Application 'Lifetime' -MajorVersion '11' -Latest -ErrorVariable err -ErrorAction SilentlyContinue
76+
77+
It 'Should not have errors' { $err.Count | Should Be 0 }
78+
It 'Should return exactly one version' { $result.Count | Should Be 1 }
79+
}
80+
81+
Context 'When getting Integration Studio versions' {
82+
83+
$result = Get-OSRepoAvailableVersions -Application 'IntegrationStudio' -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
84+
85+
It 'Should not have errors' { $err.Count | Should Be 0 }
86+
It 'Should return at least one version' { $result.Count | Should BeGreaterThan 0 }
87+
}
88+
89+
Context 'When getting Integration Studio latest version' {
90+
91+
$result = Get-OSRepoAvailableVersions -Application 'IntegrationStudio' -MajorVersion '11' -Latest -ErrorVariable err -ErrorAction SilentlyContinue
92+
93+
It 'Should not have errors' { $err.Count | Should Be 0 }
94+
It 'Should return exactly one version' { $result.Count | Should Be 1 }
95+
}
96+
97+
Context 'When getting Service Studio versions' {
98+
99+
$result = Get-OSRepoAvailableVersions -Application 'ServiceStudio' -MajorVersion '11' -ErrorVariable err -ErrorAction SilentlyContinue
100+
101+
It 'Should not have errors' { $err.Count | Should Be 0 }
102+
It 'Should return at least one version' { $result.Count | Should BeGreaterThan 0 }
103+
}
104+
105+
Context 'When getting Service Studio latest version' {
106+
107+
$result = Get-OSRepoAvailableVersions -Application 'ServiceStudio' -MajorVersion '11' -Latest -ErrorVariable err -ErrorAction SilentlyContinue
108+
109+
It 'Should not have errors' { $err.Count | Should Be 0 }
110+
It 'Should return exactly one version' { $result.Count | Should Be 1 }
111+
}
112+
113+
}
114+
}

0 commit comments

Comments
 (0)