78 instantiations of ConfigSource
aspire (6)
Configuration\ConfigSourceService.cs (6)
177
var source = new
ConfigSource
216
return _creationSource = new
ConfigSource
{ OptOut = true };
330
var source = new
ConfigSource
417
var binding = new
ConfigSource
612
var identity = new
ConfigSource
720
var identity = new
ConfigSource
Aspire.Cli.Tests (72)
Backchannel\AppHostConnectionResolverTests.cs (1)
30
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
Commands\AgentInitCommandTests.cs (1)
382
new
ConfigSource
{ Repository = "https://git.example/configuration", Path = "aspire.config.json", AppliedVersion = "version-1" },
Commands\ConfigSourceCommandTests.cs (16)
28
private static readonly ConfigSource s_source =
new
()
43
var source = new
ConfigSource
100
var source = new
ConfigSource
361
var source = new
ConfigSource
491
await TestConfigSourceServices.SaveBindingAsync(
new
()
678
new
ConfigSource
{ Repository = "https://parent.example/configuration", Path = "parent.json", AppliedVersion = "parent-version" },
703
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
{ OptOut = true }, workspace.WorkspaceRoot, CancellationToken.None);
829
? new
ConfigSource
835
: new
ConfigSource
{ OptOut = true };
941
var selectedSource = new
ConfigSource
{ Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
1028
var selectedSource = new
ConfigSource
{ Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
1068
var selectedSource = new
ConfigSource
1200
Assert.Equivalent(accepted ? s_source : new
ConfigSource
{ OptOut = true }, AspireConfigFile.Load(output)?.ConfigSource, strict: true);
1221
Assert.Equivalent(accepted ? s_source : new
ConfigSource
{ OptOut = true }, AspireConfigFile.Load(workspace.Path)!.ConfigSource, strict: true);
1275
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
1465
? new
ConfigSource
Commands\NewCommandLocalTemplateTests.InitConfig.cs (1)
143
var listed = await store.ListAsync(new
ConfigSource
Commands\NewCommandLocalTemplateTests.SourceListGit.cs (1)
315
var source = new
ConfigSource
{ Repository = repository.FullName, Path = "teams/platform.json", Ref = "config-preview" };
Configuration\ConfigSourceServiceGitTests.cs (17)
51
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
94
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
148
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
175
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
389
var source = new
ConfigSource
{ Repository = workspace.Path, Path = path };
413
var source = new
ConfigSource
{ Repository = repository.FullName, Path = path };
441
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
475
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName },
506
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
516
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
537
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
555
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = expectedCommit },
567
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
587
var pinned = await client.CheckAsync(
new
() { Repository = source.Repository, Path = source.Path, Ref = original.Commit },
613
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
636
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
667
var source = new
ConfigSource
Configuration\ConfigSourceServiceTests.cs (33)
162
Assert.False(Directory.Exists(service.GetCacheDirectory(new
ConfigSource
233
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
299
var globalSource = new
ConfigSource
306
var ignoredSource = new
ConfigSource
{ Repository = s_appliedSource.Repository, Path = "ignored.json", AppliedVersion = "ignored-version" };
393
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
402
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
475
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
638
private static readonly ConfigSource s_source =
new
()
643
private static readonly ConfigSource s_appliedSource =
new
()
714
var source = new
ConfigSource
732
new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate();
741
new
ConfigSource
{ Repository = repository.FullName, Path = s_source.Path }.Validate();
760
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate());
769
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate());
783
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = s_source.Repository, Path = path }.Validate());
795
new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, Ref = reference }.Validate();
814
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, Ref = reference }.Validate()).Message);
827
var expected = new
ConfigSource
{ Repository = s_source.Repository, Path = path ?? AspireConfigFile.FileName, Ref = "preview" };
861
Assert.Equivalent(detected ? new
ConfigSource
{ Repository = ConfigSourceService.MicrosoftRepository, Path = AspireConfigFile.FileName } : null,
1095
Assert.Equivalent(accepted ? new
ConfigSource
{ Repository = ConfigSourceService.MicrosoftRepository, Path = AspireConfigFile.FileName } : new
ConfigSource
{ OptOut = true },
1143
await service.MaterializeAsync(new
ConfigSource
{ OptOut = true }, workspace.WorkspaceRoot, CancellationToken.None);
1166
service.MaterializeAsync(optOut ? new
ConfigSource
{ OptOut = true } : s_source,
1601
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
1644
new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, AppliedVersion = "version-2" },
1730
var source = new
ConfigSource
{ Repository = repository, Path = AspireConfigFile.FileName };
1796
await TestConfigSourceServices.SaveBindingAsync(
new
()
1910
var changed = new
ConfigSource
2054
var invalid = new
ConfigSource
{ Repository = repository, Path = s_source.Path, Ref = gitRef, AppliedVersion = "version-1" };
2232
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = "other.json" }));
2234
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" }));
2236
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" }),
2237
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "main" }));
TestServices\TestConfigSourceServices.cs (2)
52
await SaveBindingAsync(new
ConfigSource
119
var source = new
ConfigSource
120 references to ConfigSource
aspire (50)
Commands\InitCommand.cs (1)
163
var
configSource = await ConfigSources.SelectForInitializationAsync(configurationDirectory, parseResult, cancellationToken);
Commands\NewCommand.cs (4)
590
var
configSource = await ConfigSources.ResolveAndAcquireConfigSourceAsync(parseResult, ConfigSourceStrings.NewUseSourcePrompt, cancellationToken);
731
private async Task<CommandResult> CreateFromSourceAsync(TemplateSource source,
ConfigSource
? configSource, ParseResult parseResult, CancellationToken cancellationToken)
766
ITemplate template,
ConfigSource
? configSource, ParseResult parseResult, CancellationToken cancellationToken)
793
private async Task<CommandResult> CompleteTemplateAsync(TemplateResult templateResult,
ConfigSource
? configSource, ParseResult parseResult, CancellationToken cancellationToken)
Commands\TemplateManagementCommand.cs (1)
97
var
source = !json || parseResult.GetValue(ConfigSourceService.s_useSourceOption) is true
Configuration\AspireConfigFile.cs (2)
68
[JsonPropertyName(
ConfigSource
.SectionName)]
71
public
ConfigSource
? ConfigSource { get; set; }
Configuration\ConfigSource.cs (4)
43
public static bool HasSameIdentity(
ConfigSource
first,
ConfigSource
second)
74
internal sealed record ConfigSourceMetadata(
ConfigSource
Source, string Commit, string Version, DateTimeOffset FetchedAt);
77
ConfigSource
Source, string Commit, string Version, DateTimeOffset CheckedAt, string? ComparedAppliedVersion);
Configuration\ConfigSourceService.cs (36)
45
private
ConfigSource
? _creationSource;
154
public Task<
ConfigSource
?> ResolveAndAcquireConfigSourceAsync(ParseResult parseResult, string consentPrompt, CancellationToken cancellationToken) =>
157
internal async Task<
ConfigSource
?> ResolveAndAcquireConfigSourceAsync(
177
var
source = new ConfigSource
223
private void DisplayConfigSourceDetails(
ConfigSource
source, string origin)
242
private string? GetReadmeUrl(
ConfigSource
source) =>
246
public async Task<
ConfigSource
?> SelectForInitializationAsync(
252
if (configuration is not null && configuration.ContainsKey(GetKey(configuration,
ConfigSource
.SectionName)))
261
public async Task MaterializeAsync(
ConfigSource
source, DirectoryInfo projectDirectory, CancellationToken cancellationToken)
273
if (configuration is not null && configuration.ContainsKey(GetKey(configuration,
ConfigSource
.SectionName)))
285
var
source = await ResolveAndAcquireConfigSourceAsync(parseResult, ConfigSourceStrings.UpdateUseSourcePrompt, cancellationToken);
292
private async Task ApplySourceAsync(
ConfigSource
source, string path, CancellationToken cancellationToken)
304
configuration[GetKey(configuration,
ConfigSource
.SectionName)] = new JsonObject { ["optOut"] = true };
330
var
source = new ConfigSource
339
internal async Task<JsonObject> GetTemplateSourcesAsync(
ConfigSource
source, CancellationToken cancellationToken)
376
private async Task<bool> ApplySnapshotAsync(
ConfigSource
source, ConfigSourceSnapshot snapshot, string path, CancellationToken cancellationToken)
387
if (ReadBinding(configuration) is { } current && !
ConfigSource
.HasSameIdentity(current, source))
417
var
binding = new ConfigSource
424
configuration[GetKey(configuration,
ConfigSource
.SectionName)] = JsonSerializer.SerializeToNode(binding, JsonSourceGenerationContext.Default.ConfigSource);
469
var
source = configPath is null ? null : await ReadBindingAsync(configPath, cancellationToken);
516
internal async Task<
ConfigSource
?> ReadBindingAsync(string configPath, CancellationToken cancellationToken)
545
private static
ConfigSource
? ReadBinding(JsonObject? config)
551
var sourceProperty = config.FirstOrDefault(p => p.Key.Equals(
ConfigSource
.SectionName, StringComparison.OrdinalIgnoreCase));
577
internal string GetCacheDirectory(
ConfigSource
source)
583
internal Task<ConfigSourceSnapshot> AcquireAsync(
ConfigSource
source, bool force, CancellationToken cancellationToken) =>
587
ConfigSource
source, bool force, bool allowInteractiveInput, CancellationToken cancellationToken)
612
var
identity = new ConfigSource
682
private async Task<ConfigSourceCheckMetadata> CheckVersionAsync(
ConfigSource
source, CancellationToken cancellationToken)
701
if (previous is null || previous.Source is null || !
ConfigSource
.HasSameIdentity(previous.Source, source)
720
var
identity = new ConfigSource
739
ConfigSource
source, string directory, bool allowInteractiveInput, CancellationToken cancellationToken)
755
if (configuration.Any(p => p.Key.Equals(
ConfigSource
.SectionName, StringComparison.OrdinalIgnoreCase)
756
|| p.Key.StartsWith(
ConfigSource
.SectionName + ":", StringComparison.OrdinalIgnoreCase)
757
|| p.Key.StartsWith(
ConfigSource
.SectionName + ".", StringComparison.OrdinalIgnoreCase)))
788
private async Task<(string Commit, string Version)> CheckRepositoryAsync(
ConfigSource
source, string directory, CancellationToken cancellationToken)
814
IGitClient client,
ConfigSource
source, string directory, bool allowInteractive, CancellationToken cancellationToken)
JsonSourceGenerationContext.cs (1)
40
[JsonSerializable(typeof(
ConfigSource
))]
Templating\TemplateSourceStore.cs (1)
19
public async Task<JsonObject> ListAsync(
ConfigSource
? configSource, CancellationToken cancellationToken)
Aspire.Cli.Tests (70)
Commands\ConfigSourceCommandTests.cs (15)
28
private static readonly
ConfigSource
s_source = new()
43
var
source = new ConfigSource
100
var
source = new ConfigSource
361
var
source = new ConfigSource
828
var
expectedSource = accepted
941
var
selectedSource = new ConfigSource { Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
962
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source) ||
ConfigSource
.HasSameIdentity(s_source, source));
1028
var
selectedSource = new ConfigSource { Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
1036
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source));
1068
var
selectedSource = new ConfigSource
1092
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source));
1344
ConfigSource
? checkedSource = null;
1376
Assert.True(
ConfigSource
.HasSameIdentity(s_source, checkedSource));
1388
Assert.True(
ConfigSource
.HasSameIdentity(s_source, source));
Commands\NewCommandLocalTemplateTests.SourceListGit.cs (3)
288
TemporaryWorkspace workspace, TestInteractionService interaction, TestGitCommandRunner recording,
ConfigSource
source)
310
private async Task<(
ConfigSource
Source, string Commit, string Version)> CreateTemplateSourceConfigurationRepositoryAsync(
315
var
source = new ConfigSource { Repository = repository.FullName, Path = "teams/platform.json", Ref = "config-preview" };
Configuration\ConfigSourceServiceGitTests.cs (10)
51
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
94
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
148
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
173
TemporaryWorkspace workspace, IGitClient git,
ConfigSource
source, TimeProvider clock, CancellationToken token)
389
var
source = new ConfigSource { Repository = workspace.Path, Path = path };
413
var
source = new ConfigSource { Repository = repository.FullName, Path = path };
441
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
567
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
636
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
667
var
source = new ConfigSource
Configuration\ConfigSourceServiceTests.cs (30)
142
var
source = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(consent), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
157
Assert.True(Assert.IsType<
ConfigSource
>(source).OptOut);
299
var
globalSource = new ConfigSource
306
var
ignoredSource = new ConfigSource { Repository = s_appliedSource.Repository, Path = "ignored.json", AppliedVersion = "ignored-version" };
328
var operations = new ConcurrentQueue<
ConfigSource
>();
345
Assert.True(
ConfigSource
.HasSameIdentity(s_appliedSource, Assert.Single(operations)));
415
void Record(
ConfigSource
source)
638
private static readonly
ConfigSource
s_source = new()
643
private static readonly
ConfigSource
s_appliedSource = new()
714
var
source = new ConfigSource
722
Assert.Equal(equal,
ConfigSource
.HasSameIdentity(s_appliedSource, source));
723
Assert.Equal(equal,
ConfigSource
.HasSameIdentity(source, s_appliedSource));
827
var
expected = new ConfigSource { Repository = s_source.Repository, Path = path ?? AspireConfigFile.FileName, Ref = "preview" };
859
var
selected = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(detected ? true : null), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
923
var
source = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(null), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
926
Assert.True(Assert.IsType<
ConfigSource
>(source).OptOut);
947
var
source = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(false), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
949
Assert.True(Assert.IsType<
ConfigSource
>(source).OptOut);
1039
var
source = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(consent), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
1110
var
source = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(null), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
1112
Assert.False(Assert.IsType<
ConfigSource
>(source).OptOut);
1290
var
source = Assert.IsType<
ConfigSource
>(
1730
var
source = new ConfigSource { Repository = repository, Path = AspireConfigFile.FileName };
1776
var
initialSource = hasAppliedVersion ? s_appliedSource : s_source;
1782
Assert.True(
ConfigSource
.HasSameIdentity(s_appliedSource, second.Metadata.Source));
1910
var
changed = new ConfigSource
2040
var
source = await service.SelectForInitializationAsync(project, ParseConsent(true), CancellationToken.None);
2043
Assert.True(
ConfigSource
.HasSameIdentity(s_source, source));
2054
var
invalid = new ConfigSource { Repository = repository, Path = s_source.Path, Ref = gitRef, AppliedVersion = "version-1" };
Interaction\ConsoleInteractionServiceTests.cs (6)
254
var
source = await service.ResolveAndAcquireConfigSourceAsync(command.Parse("--use-config-source false"), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
256
Assert.True(Assert.IsType<
ConfigSource
>(source).OptOut);
292
var
source = await service.ResolveAndAcquireConfigSourceAsync(command.Parse("--use-config-source"), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
294
Assert.False(Assert.IsType<
ConfigSource
>(source).OptOut);
329
var
source = await service.ResolveAndAcquireConfigSourceAsync(command.Parse("--use-config-source false"), ConfigSourceStrings.NewUseSourcePrompt, CancellationToken.None);
331
Assert.True(Assert.IsType<
ConfigSource
>(source).OptOut);
TestServices\TestConfigSourceServices.cs (6)
20
public static async Task SaveBindingAsync(
ConfigSource
source, DirectoryInfo projectDirectory, CancellationToken cancellationToken)
41
this IGitClient git,
ConfigSource
source, string directory, CancellationToken cancellationToken, TimeProvider? clock = null)
49
this IGitClient git,
ConfigSource
source, string directory, CancellationToken cancellationToken, TimeProvider? clock = null)
98
public Func<
ConfigSource
, CancellationToken, Task<(string Version, JsonObject Configuration)>> ReadConfiguration { get; set; }
100
public Func<
ConfigSource
, CancellationToken, Task<string>> InspectConfiguration { get; set; }
119
var
source = new ConfigSource