Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build/update-docs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ $path = "$PSScriptRoot\.."

Import-Module "$path\d365fo.tools" -Force

Remove-Item -Path "$path\docs\*.md"
Remove-Item -Path "$path\docs\*.md" -Exclude "AGENTS.md"
$null = New-MarkdownHelp -Module d365fo.tools -OutputFolder "$path\docs" -Force

Get-ChildItem -Path "$path\docs" -Recurse -File | Set-PSMDEncoding
Get-ChildItem -Path "$path\docs" -Recurse -File -Exclude "AGENTS.md" | Set-PSMDEncoding
2 changes: 1 addition & 1 deletion build/vsts-prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Write-Host "The user running is: $($env:UserName)"

# $modules = @("PSFramework", "Az.Storage", "AzureAd", "PSNotification", "PSOAuthHelper", "PowerShellGet", "PackageManagement","ImportExcel","PSScriptAnalyzer")
$modules = @("PSFramework", "PSScriptAnalyzer", "Az.Storage", "PSOAuthHelper", "ImportExcel")
$modules = @("PSFramework", "PSScriptAnalyzer", "Az.Storage", "PSOAuthHelper", "ImportExcel", "PSModuleDevelopment", "platyPS")

Write-Host "Installing Pester, maximum version 4.99.99" -ForegroundColor Cyan
Install-Module "Pester" -MaximumVersion 4.99.99 -Force -Confirm:$false -Scope CurrentUser -AllowClobber -SkipPublisherCheck
Expand Down
14 changes: 13 additions & 1 deletion d365fo.tools/functions/get-d365environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Batch
Financial Reporter
DMF
DocumentRouting

.PARAMETER Aos
Instruct the cmdlet to query the AOS (IIS) service
Expand All @@ -29,6 +30,9 @@

.PARAMETER DMF
Instruct the cmdlet query the DMF service

.PARAMETER DocumentRouting
Instruct the cmdlet query the document routing service

.PARAMETER OnlyStartTypeAutomatic
Instruct the cmdlet to filter out services that are set to manual start or disabled
Expand Down Expand Up @@ -67,6 +71,11 @@

Will query the FinancialReporter & DMF services on the machine.

.EXAMPLE
PS C:\> Get-D365Environment -DocumentRouting

Will query the DocumentRouting service on the machine.

.EXAMPLE
PS C:\> Get-D365Environment -OutputServiceDetailsOnly

Expand Down Expand Up @@ -108,6 +117,9 @@ function Get-D365Environment {
[Parameter(Mandatory = $false, ParameterSetName = 'Specific')]
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific')]
[switch] $DocumentRouting,

[switch] $OnlyStartTypeAutomatic,

[switch] $OutputServiceDetailsOnly
Expand All @@ -117,7 +129,7 @@ function Get-D365Environment {
$All = $false
}

if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) {
if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF)) -and (-not ($DocumentRouting))) {
Write-PSFMessage -Level Host -Message "You have to use at least one switch when running this cmdlet. Please run the cmdlet again."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand Down
12 changes: 12 additions & 0 deletions d365fo.tools/functions/restart-d365environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Batch
Financial Reporter
DMF
DocumentRouting

.PARAMETER Aos
Instructs the cmdlet to work against the AOS (IIS) service
Expand All @@ -29,6 +30,9 @@

.PARAMETER DMF
Instructs the cmdlet to work against the DMF service

.PARAMETER DocumentRouting
Instructs the cmdlet to work against the Document Routing service

.PARAMETER Kill
Instructs the cmdlet to kill the service(s) that you want to restart
Expand Down Expand Up @@ -66,6 +70,11 @@

This will stop the FinancialReporter and DMF services and then start the FinancialReporter and DMF services again.

.EXAMPLE
PS C:\> Restart-D365Environment -DocumentRouting

This will stop the DocumentRouting service and then start the DocumentRouting service again.

.EXAMPLE
PS C:\> Restart-D365Environment -All -Kill

Expand Down Expand Up @@ -103,6 +112,9 @@ function Restart-D365Environment {
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 5 )]
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 6 )]
[switch] $DocumentRouting,

[switch] $Kill,

[Parameter(Mandatory = $False)]
Expand Down
15 changes: 14 additions & 1 deletion d365fo.tools/functions/start-d365environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Aos
Batch
Financial Reporter
DMF
DocumentRouting

.PARAMETER Aos
Start the Aos (iis) service
Expand All @@ -28,6 +30,9 @@

.PARAMETER DMF
Start the Data Management Framework service

.PARAMETER DocumentRouting
Start the Document Routing service

.PARAMETER OnlyStartTypeAutomatic
Instruct the cmdlet to filter out services that are set to manual start or disabled
Expand Down Expand Up @@ -73,6 +78,11 @@

This will start the FinancialReporter and DMF services on the machine.

.EXAMPLE
PS C:\> Start-D365Environment -DocumentRouting

This will start the DocumentRouting service on the machine.

.NOTES
Author: Mötz Jensen (@Splaxi)

Expand Down Expand Up @@ -102,6 +112,9 @@ function Start-D365Environment {
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 5 )]
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 6 )]
[switch] $DocumentRouting,

[switch] $OnlyStartTypeAutomatic,

[switch] $ShowOriginalProgress
Expand All @@ -113,7 +126,7 @@ function Start-D365Environment {
$All = $false
}

if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) {
if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF)) -and (-not ($DocumentRouting))) {
Write-PSFMessage -Level Host -Message "You have to use at least <c='em'>one switch</c> when running this cmdlet. Please run the cmdlet again."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand Down
13 changes: 12 additions & 1 deletion d365fo.tools/functions/start-d365environmentv2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

.PARAMETER DMF
Start the Data Management Framework service

.PARAMETER DocumentRouting
Start the Document Routing service

.PARAMETER OnlyStartTypeAutomatic
Instruct the cmdlet to filter out services that are set to manual start or disabled
Expand Down Expand Up @@ -71,6 +74,11 @@

This will start the FinancialReporter and DMF services on the machine.

.EXAMPLE
PS C:\> Start-D365EnvironmentV2 -DocumentRouting

This will start the DocumentRouting service on the machine.

.EXAMPLE
PS C:\> Enable-D365Exception
PS C:\> Start-D365EnvironmentV2
Expand Down Expand Up @@ -105,6 +113,9 @@ function Start-D365EnvironmentV2 {
[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 4 )]
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 5 )]
[switch] $DocumentRouting,

[switch] $OnlyStartTypeAutomatic,

[switch] $ShowOriginalProgress
Expand All @@ -116,7 +127,7 @@ function Start-D365EnvironmentV2 {
$All = $false
}

if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) {
if ( (-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF)) -and (-not ($DocumentRouting))) {
Write-PSFMessage -Level Host -Message "You have to use at least <c='em'>one switch</c> when running this cmdlet. Please run the cmdlet again."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand Down
19 changes: 16 additions & 3 deletions d365fo.tools/functions/stop-d365environment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Aos
Batch
Financial Reporter
DMF
DocumentRouting

.PARAMETER Aos
Stop the Aos (iis) service
Expand All @@ -28,6 +30,9 @@

.PARAMETER DMF
Start the Data Management Framework service

.PARAMETER DocumentRouting
Stop the Document Routing service

.PARAMETER Kill
Instructs the cmdlet to kill the service(s) that you want to stop
Expand Down Expand Up @@ -67,6 +72,11 @@

This will stop the FinancialReporter and DMF services on the machine.

.EXAMPLE
PS C:\> Stop-D365Environment -DocumentRouting

This will stop the DocumentRouting service on the machine.

.EXAMPLE
PS C:\> Stop-D365Environment -All -Kill

Expand Down Expand Up @@ -103,19 +113,22 @@ function Stop-D365Environment {
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 6 )]
[Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 6 )]
[switch] $Kill,
[switch] $DocumentRouting,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 7 )]
[Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 7 )]
[switch] $Kill,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 8 )]
[Parameter(Mandatory = $false, ParameterSetName = 'Default', Position = 8 )]
[switch] $ShowOriginalProgress
)

if ($PSCmdlet.ParameterSetName -eq "Specific") {
$All = $false
}

if ((-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF))) {
if ((-not ($All)) -and (-not ($Aos)) -and (-not ($Batch)) -and (-not ($FinancialReporter)) -and (-not ($DMF)) -and (-not ($DocumentRouting))) {
Write-PSFMessage -Level Host -Message "You have to use at least <c='em'>one switch</c> when running this cmdlet. Please run the cmdlet again."
Stop-PSFFunction -Message "Stopping because of missing parameters"
return
Expand Down
14 changes: 12 additions & 2 deletions d365fo.tools/internal/functions/get-servicelist.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

.PARAMETER DMF
Switch to instruct the cmdlet to output the data management service name

.PARAMETER DocumentRouting
Switch to instruct the cmdlet to output the document routing service name

.EXAMPLE
PS C:\> Get-ServiceList -All
Expand Down Expand Up @@ -48,7 +51,10 @@ Function Get-ServiceList {
[switch] $FinancialReporter,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 5 )]
[switch] $DMF
[switch] $DMF,

[Parameter(Mandatory = $false, ParameterSetName = 'Specific', Position = 6 )]
[switch] $DocumentRouting
)

if ($PSCmdlet.ParameterSetName -eq "Specific") {
Expand All @@ -61,11 +67,12 @@ Function Get-ServiceList {
$batchname = "DynamicsAxBatch"
$financialname = "MR2012ProcessService"
$dmfname = "Microsoft.Dynamics.AX.Framework.Tools.DMF.SSISHelperService.exe"
$documentroutingname = "DocumentRoutingService"

[System.Collections.ArrayList]$Services = New-Object -TypeName "System.Collections.ArrayList"

if ($All) {
$null = $Services.AddRange(@($aosname, $batchname, $financialname, $dmfname))
$null = $Services.AddRange(@($aosname, $batchname, $financialname, $dmfname, $documentroutingname))
}
else {
if ($Aos) {
Expand All @@ -80,6 +87,9 @@ Function Get-ServiceList {
if ($DMF) {
$null = $Services.Add($dmfname)
}
if ($DocumentRouting) {
$null = $Services.Add($documentroutingname)
}
}

$Services.ToArray()
Expand Down
13 changes: 13 additions & 0 deletions d365fo.tools/tests/functions/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Unit Tests for Public Functions

Do not hand-edit `*.Tests.ps1` files here. They are generated.

To generate / update all parameter unit tests after adding or changing a public function, run from the repo root with PowerShell 5:

```powershell
pwsh -NoProfile -File ./build/generate-parameterunittests.ps1
```

The script takes no parameters. It deletes and regenerates every `*.Tests.ps1` file in this folder, so always run it after a parameter signature change and include the full regeneration in your commit.

Requires `PSModuleDevelopment` (`Invoke-PSMDTemplate`). Install prerequisites with `build/vsts-prerequisites.ps1` if the template command is missing.
15 changes: 14 additions & 1 deletion d365fo.tools/tests/functions/Get-D365Environment.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@
$parameter.ParameterSets['Specific'].ValueFromPipelineByPropertyName | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromRemainingArguments | Should -Be $False
}
It 'Should have the expected parameter DocumentRouting' {
$parameter = (Get-Command Get-D365Environment).Parameters['DocumentRouting']
$parameter.Name | Should -Be 'DocumentRouting'
$parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
$parameter.IsDynamic | Should -Be $False
$parameter.ParameterSets.Keys | Should -Be 'Specific'
$parameter.ParameterSets.Keys | Should -Contain 'Specific'
$parameter.ParameterSets['Specific'].IsMandatory | Should -Be $False
$parameter.ParameterSets['Specific'].Position | Should -Be -2147483648
$parameter.ParameterSets['Specific'].ValueFromPipeline | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromPipelineByPropertyName | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromRemainingArguments | Should -Be $False
}
It 'Should have the expected parameter OnlyStartTypeAutomatic' {
$parameter = (Get-Command Get-D365Environment).Parameters['OnlyStartTypeAutomatic']
$parameter.Name | Should -Be 'OnlyStartTypeAutomatic'
Expand Down Expand Up @@ -132,7 +145,7 @@
Describe "Testing parameterset Specific" {
<#
Specific -
Specific -ComputerName -Aos -Batch -FinancialReporter -DMF -OnlyStartTypeAutomatic -OutputServiceDetailsOnly
Specific -ComputerName -Aos -Batch -FinancialReporter -DMF -DocumentRouting -OnlyStartTypeAutomatic -OutputServiceDetailsOnly
#>
}

Expand Down
4 changes: 2 additions & 2 deletions d365fo.tools/tests/functions/Invoke-D365ModuleBuild.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Describe "Invoke-D365ModuleBuild Unit Tests" -Tag "Unit" {
Describe "Invoke-D365ModuleBuild Unit Tests" -Tag "Unit" {
BeforeAll {
# Place here all things needed to prepare for the tests
}
Expand Down Expand Up @@ -146,7 +146,7 @@ Describe "Invoke-D365ModuleBuild Unit Tests" -Tag "Unit" {
Describe "Testing parameterset __AllParameterSets" {
<#
__AllParameterSets -Module
__AllParameterSets -Module -OutputDir -LogPath -MetaDataDir -ReferenceDir -BinDir -IncludeReports -ShowOriginalProgress -OutputCommandOnly -Verbosity -Verbosity
__AllParameterSets -Module -OutputDir -LogPath -MetaDataDir -ReferenceDir -BinDir -IncludeReports -ShowOriginalProgress -OutputCommandOnly -Verbosity
#>
}

Expand Down
15 changes: 14 additions & 1 deletion d365fo.tools/tests/functions/Restart-D365Environment.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@
$parameter.ParameterSets['Specific'].ValueFromPipelineByPropertyName | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromRemainingArguments | Should -Be $False
}
It 'Should have the expected parameter DocumentRouting' {
$parameter = (Get-Command Restart-D365Environment).Parameters['DocumentRouting']
$parameter.Name | Should -Be 'DocumentRouting'
$parameter.ParameterType.ToString() | Should -Be System.Management.Automation.SwitchParameter
$parameter.IsDynamic | Should -Be $False
$parameter.ParameterSets.Keys | Should -Be 'Specific'
$parameter.ParameterSets.Keys | Should -Contain 'Specific'
$parameter.ParameterSets['Specific'].IsMandatory | Should -Be $False
$parameter.ParameterSets['Specific'].Position | Should -Be 6
$parameter.ParameterSets['Specific'].ValueFromPipeline | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromPipelineByPropertyName | Should -Be $False
$parameter.ParameterSets['Specific'].ValueFromRemainingArguments | Should -Be $False
}
It 'Should have the expected parameter Kill' {
$parameter = (Get-Command Restart-D365Environment).Parameters['Kill']
$parameter.Name | Should -Be 'Kill'
Expand Down Expand Up @@ -132,7 +145,7 @@
Describe "Testing parameterset Specific" {
<#
Specific -
Specific -ComputerName -Aos -Batch -FinancialReporter -DMF -Kill -ShowOriginalProgress
Specific -ComputerName -Aos -Batch -FinancialReporter -DMF -DocumentRouting -Kill -ShowOriginalProgress
#>
}

Expand Down
Loading
Loading