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
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageVersion Include="Serilog.Sinks.Map" Version="1.0.2" />
<PackageVersion Include="Spectre.Console" Version="0.49.1" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.49.1" />
<PackageVersion Include="Spectre.Console" Version="0.53.0" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.53.0" />
<PackageVersion Include="Spectre.Console.Cli.Extensions.DependencyInjection" Version="0.2.0" />
<PackageVersion Include="Spectre.Console.Testing" Version="0.49.1" />
<PackageVersion Include="Spectre.Console.Testing" Version="0.53.0" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Reactive" Version="6.0.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -27,7 +28,10 @@ public ListDetectorsCommand(
}

/// <inheritdoc/>
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,7 +38,10 @@ public ScanCommand(
}

/// <inheritdoc />
public override async Task<int> ExecuteAsync(CommandContext context, ScanSettings settings)
public override async Task<int> ExecuteAsync(
CommandContext context,
ScanSettings settings,
CancellationToken cancellationToken)
{
this.fileWritingService.Init(settings.Output);
var result = await this.scanExecutionService.ExecuteScanAsync(settings);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down