Add Authority Advisory AI and API Lifecycle Configuration
- Introduced AuthorityAdvisoryAiOptions and related classes for managing advisory AI configurations, including remote inference options and tenant-specific settings. - Added AuthorityApiLifecycleOptions to control API lifecycle settings, including legacy OAuth endpoint configurations. - Implemented validation and normalization methods for both advisory AI and API lifecycle options to ensure proper configuration. - Created AuthorityNotificationsOptions and its related classes for managing notification settings, including ack tokens, webhooks, and escalation options. - Developed IssuerDirectoryClient and related models for interacting with the issuer directory service, including caching mechanisms and HTTP client configurations. - Added support for dependency injection through ServiceCollectionExtensions for the Issuer Directory Client. - Updated project file to include necessary package references for the new Issuer Directory Client library.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using StellaOps.Scanner.Surface.FS;
|
||||
|
||||
|
||||
namespace StellaOps.Scanner.Surface.FS.Tests;
|
||||
|
||||
public sealed class FileSurfaceCacheTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task GetOrCreateAsync_PersistsValue()
|
||||
{
|
||||
var root = Directory.CreateTempSubdirectory();
|
||||
try
|
||||
{
|
||||
var options = Microsoft.Extensions.Options.Options.Create(new SurfaceCacheOptions { RootDirectory = root.FullName });
|
||||
var cache = new FileSurfaceCache(options, NullLogger<FileSurfaceCache>.Instance);
|
||||
var key = new SurfaceCacheKey("entrytrace", "tenant", "digest");
|
||||
|
||||
var result = await cache.GetOrCreateAsync(
|
||||
key,
|
||||
_ => Task.FromResult(42),
|
||||
Serialize,
|
||||
Deserialize);
|
||||
|
||||
Assert.Equal(42, result);
|
||||
|
||||
var cached = await cache.GetOrCreateAsync(
|
||||
key,
|
||||
_ => Task.FromResult(99),
|
||||
Serialize,
|
||||
Deserialize);
|
||||
|
||||
Assert.Equal(42, cached);
|
||||
}
|
||||
finally
|
||||
{
|
||||
root.Delete(true);
|
||||
}
|
||||
|
||||
static ReadOnlyMemory<byte> Serialize(int value)
|
||||
=> JsonSerializer.SerializeToUtf8Bytes(value);
|
||||
|
||||
static int Deserialize(ReadOnlyMemory<byte> payload)
|
||||
=> JsonSerializer.Deserialize<int>(payload.Span)!;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<LangVersion>preview</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<IsPackable>false</IsPackable>
|
||||
<OutputType>Exe</OutputType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.Scanner.Surface.FS/StellaOps.Scanner.Surface.FS.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user