diff --git a/Directory.Packages.props b/Directory.Packages.props index b5ac1e414..a922a1462 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -38,10 +38,10 @@ - - + + - + diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Commands/ListDetectorsCommand.cs b/src/Microsoft.ComponentDetection.Orchestrator/Commands/ListDetectorsCommand.cs index c2b24e730..2704e4e28 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Commands/ListDetectorsCommand.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Commands/ListDetectorsCommand.cs @@ -1,6 +1,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Commands; using System.Collections.Generic; +using System.Threading; using Microsoft.ComponentDetection.Contracts; using Spectre.Console; using Spectre.Console.Cli; @@ -27,7 +28,10 @@ public ListDetectorsCommand( } /// - public override int Execute(CommandContext context, ListDetectorsSettings settings) + public override int Execute( + CommandContext context, + ListDetectorsSettings settings, + CancellationToken cancellationToken) { var table = new Table(); table.AddColumn("Name"); diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Commands/ScanCommand.cs b/src/Microsoft.ComponentDetection.Orchestrator/Commands/ScanCommand.cs index e2d7d39e0..de4a28048 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Commands/ScanCommand.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Commands/ScanCommand.cs @@ -2,6 +2,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Commands; using System; using System.IO; +using System.Threading; using System.Threading.Tasks; using Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts.BcdeModels; @@ -37,7 +38,10 @@ public ScanCommand( } /// - public override async Task ExecuteAsync(CommandContext context, ScanSettings settings) + public override async Task ExecuteAsync( + CommandContext context, + ScanSettings settings, + CancellationToken cancellationToken) { this.fileWritingService.Init(settings.Output); var result = await this.scanExecutionService.ExecuteScanAsync(settings); diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ListDetectorCommandTests.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ListDetectorCommandTests.cs index 3a0749062..1855e7dea 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ListDetectorCommandTests.cs +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ListDetectorCommandTests.cs @@ -2,6 +2,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Tests.Commands; using System.Collections.Generic; using System.Linq; +using System.Threading; using FluentAssertions; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Orchestrator.Commands; @@ -29,7 +30,7 @@ public void ListDetectorCommands_ExecutesListDetectors() var command = new ListDetectorsCommand(mockDetectors, console); - var result = command.Execute(null, new ListDetectorsSettings()); + var result = command.Execute(null, new ListDetectorsSettings(), CancellationToken.None); result.Should().Be(0); console.Output.Should().ContainAll(fakeIds); diff --git a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ScanCommandTests.cs b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ScanCommandTests.cs index c2c8f7154..ca96692ef 100644 --- a/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ScanCommandTests.cs +++ b/test/Microsoft.ComponentDetection.Orchestrator.Tests/Commands/ScanCommandTests.cs @@ -2,6 +2,7 @@ namespace Microsoft.ComponentDetection.Orchestrator.Tests.Commands; using System; using System.IO; +using System.Threading; using System.Threading.Tasks; using FluentAssertions; using Microsoft.ComponentDetection.Common; @@ -40,7 +41,7 @@ public async Task ScanCommand_ExecutesScanAndWritesManifestAsync() { var settings = new ScanSettings { Output = "output" }; - var result = await this.command.ExecuteAsync(null, settings); + var result = await this.command.ExecuteAsync(null, settings, CancellationToken.None); this.fileWritingServiceMock.Verify(x => x.Init(settings.Output), Times.Once); this.scanExecutionServiceMock.Verify(x => x.ExecuteScanAsync(settings), Times.Once); @@ -54,7 +55,7 @@ public async Task ScanCommand_ExecutesScanAndWritesUserManifestAsync() { var settings = new ScanSettings { Output = "output", ManifestFile = new FileInfo("manifest.json") }; - var result = await this.command.ExecuteAsync(null, settings); + var result = await this.command.ExecuteAsync(null, settings, CancellationToken.None); this.fileWritingServiceMock.Verify(x => x.Init(settings.Output), Times.Once); this.scanExecutionServiceMock.Verify(x => x.ExecuteScanAsync(settings), Times.Once); @@ -71,7 +72,7 @@ public async Task ScanCommand_ExecutesScanAndPrintsManifestAsync() await using var tw = new StreamWriter(ms); Console.SetOut(tw); - var result = await this.command.ExecuteAsync(null, settings); + var result = await this.command.ExecuteAsync(null, settings, CancellationToken.None); this.fileWritingServiceMock.Verify(x => x.Init(settings.Output), Times.Once); this.scanExecutionServiceMock.Verify(x => x.ExecuteScanAsync(settings), Times.Once);