60 instantiations of ConfigSource
aspire (4)
Configuration\ConfigSourceService.cs (4)
164
var source = new
ConfigSource
246
var binding = new
ConfigSource
445
var identity = new
ConfigSource
537
var identity = new
ConfigSource
Aspire.Cli.Tests (56)
Backchannel\AppHostConnectionResolverTests.cs (1)
27
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
Commands\AgentInitCommandTests.cs (1)
265
new
ConfigSource
{ Repository = "https://git.example/configuration", Path = "aspire.config.json", AppliedVersion = "version-1" },
Commands\ConfigSourceCommandTests.cs (7)
27
private static readonly ConfigSource s_source =
new
()
303
await TestConfigSourceServices.SaveBindingAsync(
new
()
489
new
ConfigSource
{ Repository = "https://parent.example/configuration", Path = "parent.json", AppliedVersion = "parent-version" },
570
var selectedSource = new
ConfigSource
{ Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
657
var selectedSource = new
ConfigSource
{ Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
697
var selectedSource = new
ConfigSource
899
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
Configuration\ConfigSourceServiceGitTests.cs (18)
49
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
90
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
143
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
170
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
384
var source = new
ConfigSource
{ Repository = workspace.Path, Path = path };
408
var source = new
ConfigSource
{ Repository = repository.FullName, Path = path };
436
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
468
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName },
499
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
509
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
523
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
554
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
572
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = expectedCommit },
584
var source = new
ConfigSource
{ Repository = workspace.Path, Path = AspireConfigFile.FileName };
604
var pinned = await client.CheckAsync(
new
() { Repository = source.Repository, Path = source.Path, Ref = original.Commit },
630
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName, Ref = reference },
651
new
() { Repository = workspace.Path, Path = AspireConfigFile.FileName }, workspace.CreateDirectory("cache").FullName, TestContext.Current.CancellationToken));
671
var source = new
ConfigSource
Configuration\ConfigSourceServiceTests.cs (27)
46
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
137
var globalSource = new
ConfigSource
144
var ignoredSource = new
ConfigSource
{ Repository = s_appliedSource.Repository, Path = "ignored.json", AppliedVersion = "ignored-version" };
254
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
339
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
502
private static readonly ConfigSource s_source =
new
()
507
private static readonly ConfigSource s_appliedSource =
new
()
578
var source = new
ConfigSource
596
new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate();
605
new
ConfigSource
{ Repository = repository.FullName, Path = s_source.Path }.Validate();
624
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate());
633
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = repository, Path = s_source.Path }.Validate());
647
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = s_source.Repository, Path = path }.Validate());
659
new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, Ref = reference }.Validate();
678
Assert.Throws<ConfigSourceException>(() => new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, Ref = reference }.Validate()).Message);
689
var expected = new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" };
723
Assert.Equivalent(detected ? new
ConfigSource
{ Repository = ConfigSourceService.MicrosoftRepository, Path = AspireConfigFile.FileName } : null,
785
Assert.Equivalent(accepted ? new
ConfigSource
{ Repository = ConfigSourceService.MicrosoftRepository, Path = AspireConfigFile.FileName } : null,
1041
await TestConfigSourceServices.SaveBindingAsync(new
ConfigSource
1084
new
ConfigSource
{ Repository = s_source.Repository, Path = s_source.Path, AppliedVersion = "version-2" },
1181
await TestConfigSourceServices.SaveBindingAsync(
new
()
1295
var changed = new
ConfigSource
1439
var invalid = new
ConfigSource
{ Repository = repository, Path = s_source.Path, Ref = gitRef, AppliedVersion = "version-1" };
1585
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = "other.json" }));
1587
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" }));
1589
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" }),
1590
service.GetCacheDirectory(
new
() { Repository = s_source.Repository, Path = s_source.Path, Ref = "main" }));
TestServices\TestConfigSourceServices.cs (2)
55
await SaveBindingAsync(new
ConfigSource
116
var source = new
ConfigSource
85 references to ConfigSource
aspire (38)
Commands\InitCommand.cs (1)
162
var
configSource = await ConfigSources.SelectForInitializationAsync(configurationDirectory, parseResult, cancellationToken);
Commands\NewCommand.cs (3)
528
var
configSource = await ConfigSources.ResolveAndAcquireConfigSourceAsync(parseResult, cancellationToken);
647
private async Task<CommandResult> CreateFromSourceAsync(TemplateSource source,
ConfigSource
? configSource, ParseResult parseResult, CancellationToken cancellationToken)
685
private async Task<CommandResult> CompleteTemplateAsync(TemplateResult templateResult,
ConfigSource
? configSource, ParseResult parseResult, CancellationToken cancellationToken)
Configuration\AspireConfigFile.cs (2)
65
[JsonPropertyName(
ConfigSource
.SectionName)]
68
public
ConfigSource
? ConfigSource { get; set; }
Configuration\ConfigSource.cs (4)
38
public static bool HasSameIdentity(
ConfigSource
first,
ConfigSource
second)
103
internal sealed record ConfigSourceMetadata(
ConfigSource
Source, string Commit, string Version, DateTimeOffset FetchedAt);
106
ConfigSource
Source, string Commit, string Version, DateTimeOffset CheckedAt, string[]? ComparedAppliedVersions);
Configuration\ConfigSourceService.cs (27)
145
public async Task<
ConfigSource
?> ResolveAndAcquireConfigSourceAsync(ParseResult parseResult, CancellationToken cancellationToken)
164
var
source = new ConfigSource
200
public async Task<
ConfigSource
?> SelectForInitializationAsync(
206
if (configuration is not null && TryGetValue(configuration, [
ConfigSource
.SectionName], out _))
215
public async Task MaterializeAsync(
ConfigSource
source, DirectoryInfo projectDirectory, CancellationToken cancellationToken)
222
private async Task ApplySnapshotAsync(
ConfigSource
source, ConfigSourceSnapshot snapshot, string path, CancellationToken cancellationToken)
233
if (ReadBinding(configuration) is { } current && !
ConfigSource
.HasSameIdentity(current, source))
246
var
binding = new ConfigSource
253
configuration[GetKey(configuration,
ConfigSource
.SectionName)] = JsonSerializer.SerializeToNode(binding, JsonSourceGenerationContext.Default.ConfigSource);
302
var sources = new List<
ConfigSource
>();
313
var
source = await ReadBindingAsync(configPath, cancellationToken);
366
internal async Task<
ConfigSource
?> ReadBindingAsync(string configPath, CancellationToken cancellationToken)
387
private static
ConfigSource
? ReadBinding(JsonObject? config)
393
var sourceProperty = config.FirstOrDefault(p => p.Key.Equals(
ConfigSource
.SectionName, StringComparison.OrdinalIgnoreCase));
415
internal string GetCacheDirectory(
ConfigSource
source)
421
internal async Task<ConfigSourceSnapshot> AcquireAsync(
ConfigSource
source, bool force, CancellationToken cancellationToken)
445
var
identity = new ConfigSource
498
private async Task<ConfigSourceCheckMetadata> CheckVersionAsync(IReadOnlyList<
ConfigSource
> sources, CancellationToken cancellationToken)
500
var
source = sources[0];
518
if (previous is null || previous.Source is null || !
ConfigSource
.HasSameIdentity(previous.Source, source)
537
var
identity = new ConfigSource
555
private async Task<(string Commit, string Version, JsonObject Configuration)> AcquireRepositoryAsync(
ConfigSource
source, string directory, CancellationToken cancellationToken)
575
if (configuration.Any(p => p.Key.Equals(
ConfigSource
.SectionName, StringComparison.OrdinalIgnoreCase)
576
|| p.Key.StartsWith(
ConfigSource
.SectionName + ":", StringComparison.OrdinalIgnoreCase)
577
|| p.Key.StartsWith(
ConfigSource
.SectionName + ".", StringComparison.OrdinalIgnoreCase)))
608
private async Task<(string Commit, string Version)> CheckRepositoryAsync(
ConfigSource
source, string directory, CancellationToken cancellationToken)
631
ConfigSource
source, string directory, bool allowInteractive, CancellationToken cancellationToken)
JsonSourceGenerationContext.cs (1)
40
[JsonSerializable(typeof(
ConfigSource
))]
Aspire.Cli.Tests (47)
Commands\ConfigSourceCommandTests.cs (11)
27
private static readonly
ConfigSource
s_source = new()
570
var
selectedSource = new ConfigSource { Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
591
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source) ||
ConfigSource
.HasSameIdentity(s_source, source));
657
var
selectedSource = new ConfigSource { Repository = s_source.Repository, Path = "selected.json", AppliedVersion = s_source.AppliedVersion };
665
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source));
697
var
selectedSource = new ConfigSource
721
Assert.True(
ConfigSource
.HasSameIdentity(selectedSource, source));
968
ConfigSource
? checkedSource = null;
1000
Assert.True(
ConfigSource
.HasSameIdentity(s_source, checkedSource));
1012
Assert.True(
ConfigSource
.HasSameIdentity(s_source, source));
Configuration\ConfigSourceServiceGitTests.cs (10)
49
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
90
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
143
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
168
TemporaryWorkspace workspace, IGitClient git,
ConfigSource
source, TimeProvider clock, CancellationToken token)
384
var
source = new ConfigSource { Repository = workspace.Path, Path = path };
408
var
source = new ConfigSource { Repository = repository.FullName, Path = path };
436
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
523
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
584
var
source = new ConfigSource { Repository = workspace.Path, Path = AspireConfigFile.FileName };
671
var
source = new ConfigSource
Configuration\ConfigSourceServiceTests.cs (20)
58
Assert.True(
ConfigSource
.HasSameIdentity(s_appliedSource, source));
63
Assert.True(
ConfigSource
.HasSameIdentity(s_appliedSource, source));
137
var
globalSource = new ConfigSource
144
var
ignoredSource = new ConfigSource { Repository = s_appliedSource.Repository, Path = "ignored.json", AppliedVersion = "ignored-version" };
159
var operations = new ConcurrentQueue<
ConfigSource
>();
163
async Task RecordAsync(
ConfigSource
source, CancellationToken token)
213
Assert.True(expectedSources.Zip(operations).All(pair =>
ConfigSource
.HasSameIdentity(pair.First, pair.Second)));
267
void Record(
ConfigSource
source)
502
private static readonly
ConfigSource
s_source = new()
507
private static readonly
ConfigSource
s_appliedSource = new()
578
var
source = new ConfigSource
586
Assert.Equal(equal,
ConfigSource
.HasSameIdentity(s_appliedSource, source));
587
Assert.Equal(equal,
ConfigSource
.HasSameIdentity(source, s_appliedSource));
689
var
expected = new ConfigSource { Repository = s_source.Repository, Path = s_source.Path, Ref = "preview" };
721
var
selected = await service.ResolveAndAcquireConfigSourceAsync(ParseConsent(detected ? true : null), CancellationToken.None);
1171
Assert.True(
ConfigSource
.HasSameIdentity(s_appliedSource, second.Metadata.Source));
1295
var
changed = new ConfigSource
1425
var
source = await service.SelectForInitializationAsync(project, ParseConsent(true), CancellationToken.None);
1428
Assert.True(
ConfigSource
.HasSameIdentity(s_source, source));
1439
var
invalid = new ConfigSource { Repository = repository, Path = s_source.Path, Ref = gitRef, AppliedVersion = "version-1" };
TestServices\TestConfigSourceServices.cs (6)
19
public static async Task SaveBindingAsync(
ConfigSource
source, DirectoryInfo projectDirectory, CancellationToken cancellationToken)
44
this IGitClient git,
ConfigSource
source, string directory, CancellationToken cancellationToken, TimeProvider? clock = null)
52
this IGitClient git,
ConfigSource
source, string directory, CancellationToken cancellationToken, TimeProvider? clock = null)
96
public Func<
ConfigSource
, CancellationToken, Task<(string Version, JsonObject Configuration)>> ReadConfiguration { get; set; }
98
public Func<
ConfigSource
, CancellationToken, Task<string>> InspectConfiguration { get; set; }
116
var
source = new ConfigSource