Compare commits
12 Commits
c0deed4ce4
...
c23ab0cbdc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c23ab0cbdc | ||
|
|
c54167a6b4 | ||
|
|
236dfee7c0 | ||
|
|
4e534841c5 | ||
|
|
b29f2ff62d | ||
|
|
e41329588e | ||
|
|
702aaaaf50 | ||
|
|
08072f5b76 | ||
|
|
d341a6132f | ||
|
|
c9ca225d27 | ||
|
|
0c227fd524 | ||
|
|
97b5ef4319 |
58
.gitignore
vendored
58
.gitignore
vendored
@ -1,53 +1,23 @@
|
|||||||
# AgileWebs local orchestration
|
# Repository orchestration folders (local only)
|
||||||
|
.repo-tasks/
|
||||||
|
.repo-context/
|
||||||
.tasks/
|
.tasks/
|
||||||
.agile/
|
.agile/
|
||||||
|
|
||||||
# Build artifacts
|
# .NET build outputs
|
||||||
**/[Bb]in/
|
**/bin/
|
||||||
**/[Oo]bj/
|
**/obj/
|
||||||
/**/out/
|
|
||||||
/**/artifacts/
|
|
||||||
|
|
||||||
# IDE and editor files
|
|
||||||
.vs/
|
.vs/
|
||||||
.idea/
|
TestResults/
|
||||||
.vscode/
|
**/TestResults/
|
||||||
*.suo
|
|
||||||
*.user
|
*.user
|
||||||
*.userosscache
|
*.suo
|
||||||
*.sln.docstates
|
|
||||||
*.rsuser
|
*.rsuser
|
||||||
*.swp
|
|
||||||
*.swo
|
|
||||||
|
|
||||||
# NuGet
|
# IDE
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Package artifacts
|
||||||
*.nupkg
|
*.nupkg
|
||||||
*.snupkg
|
*.snupkg
|
||||||
**/packages/*
|
artifacts/
|
||||||
!**/packages/build/
|
|
||||||
|
|
||||||
# Test output
|
|
||||||
**/TestResults/
|
|
||||||
*.trx
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# Logs
|
|
||||||
*.log
|
|
||||||
logs/
|
|
||||||
|
|
||||||
# Local environment files
|
|
||||||
.env
|
|
||||||
.env.*
|
|
||||||
!.env.example
|
|
||||||
|
|
||||||
# Docker
|
|
||||||
.docker/
|
|
||||||
**/.docker/
|
|
||||||
*.pid
|
|
||||||
docker-compose.override.yml
|
|
||||||
docker-compose.*.override.yml
|
|
||||||
|
|
||||||
# OS files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
|
|||||||
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<Authors>AgileWebs</Authors>
|
||||||
|
<Company>AgileWebs</Company>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
|
<RepositoryUrl>https://gitea.dream-views.com/AgileWebs/blueprint-platform</RepositoryUrl>
|
||||||
|
<PackageProjectUrl>https://gitea.dream-views.com/AgileWebs/blueprint-platform</PackageProjectUrl>
|
||||||
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
34
docs/architecture/workspace-cross-repo-reference-guard.md
Normal file
34
docs/architecture/workspace-cross-repo-reference-guard.md
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# Workspace Cross-Repo ProjectReference Guard
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Prevent regression of cross-repo source coupling by failing fast when any `.csproj` in `greenfield/` references a project outside its own repository root.
|
||||||
|
|
||||||
|
## Script Location
|
||||||
|
|
||||||
|
- `tools/validate-no-cross-repo-projectrefs.sh`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Run from within `greenfield/blueprint-platform`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./tools/validate-no-cross-repo-projectrefs.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Run from the workspace root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
greenfield/blueprint-platform/tools/validate-no-cross-repo-projectrefs.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Behavior
|
||||||
|
|
||||||
|
- Exit code `0`: no cross-repo `ProjectReference` entries found.
|
||||||
|
- Exit code `1`: one or more violations were found and listed.
|
||||||
|
|
||||||
|
## Enforcement Guidance
|
||||||
|
|
||||||
|
- Execute this guard before merge to `development`.
|
||||||
|
- Keep only intra-repo `ProjectReference` entries.
|
||||||
|
- Use package references for cross-repo consumption.
|
||||||
62
docs/consumption/gitea-nuget-feed-validation.md
Normal file
62
docs/consumption/gitea-nuget-feed-validation.md
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
# Gitea NuGet Feed Validation
|
||||||
|
|
||||||
|
## Purpose
|
||||||
|
|
||||||
|
Validate that Gitea can be used as the package registry for cross-repo consumption in greenfield.
|
||||||
|
|
||||||
|
## Validated Environment
|
||||||
|
|
||||||
|
- Date: 2026-02-25
|
||||||
|
- Gitea URL: `https://gitea.dream-views.com`
|
||||||
|
- Organization feed: `https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json`
|
||||||
|
- Auth mode: Basic auth using Gitea login + token
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- `AGILE_GITEA_URL` is set
|
||||||
|
- `AGILE_GITEA_TOKEN` is set
|
||||||
|
- Account has package publish permissions in `AgileWebs`
|
||||||
|
|
||||||
|
## Required NuGet Source Configuration
|
||||||
|
|
||||||
|
Because the current feed is HTTP, source entries must allow insecure connections.
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<packageSources>
|
||||||
|
<clear />
|
||||||
|
<add key="gitea-org" value="https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json" allowInsecureConnections="true" />
|
||||||
|
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
<packageSourceCredentials>
|
||||||
|
<gitea-org>
|
||||||
|
<add key="Username" value="<gitea-login>" />
|
||||||
|
<add key="ClearTextPassword" value="<gitea-token>" />
|
||||||
|
</gitea-org>
|
||||||
|
</packageSourceCredentials>
|
||||||
|
```
|
||||||
|
|
||||||
|
## Smoke Test Result
|
||||||
|
|
||||||
|
The following flow was executed successfully:
|
||||||
|
|
||||||
|
1. Create temporary package `AgileWebs.Nuget.Smoke`.
|
||||||
|
2. Pack and push to org feed.
|
||||||
|
3. Create clean consumer project.
|
||||||
|
4. Restore consumer with package from Gitea feed.
|
||||||
|
|
||||||
|
Result: **PASS**
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- Error: `NuGet requires HTTPS sources`.
|
||||||
|
- Cause: HTTP feed without insecure override.
|
||||||
|
- Fix: add `allowInsecureConnections="true"` in `nuget.config`.
|
||||||
|
|
||||||
|
- Error: `401 Unauthorized` on push/restore.
|
||||||
|
- Cause: invalid token or missing package permission.
|
||||||
|
- Fix: validate token with `GET /api/v1/user` and retry.
|
||||||
|
|
||||||
|
## Operational Recommendation
|
||||||
|
|
||||||
|
- Keep this setting only while feed is HTTP.
|
||||||
|
- Move feed to HTTPS to remove insecure source exception.
|
||||||
@ -15,3 +15,22 @@
|
|||||||
- Publish packages independently from this repository.
|
- Publish packages independently from this repository.
|
||||||
- Maintain explicit package dependency on `Core.Blueprint.Common` for all feature modules.
|
- Maintain explicit package dependency on `Core.Blueprint.Common` for all feature modules.
|
||||||
- Keep package identifiers stable to protect downstream compatibility.
|
- Keep package identifiers stable to protect downstream compatibility.
|
||||||
|
- Use Gitea org feed: `https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json`.
|
||||||
|
|
||||||
|
## Stable Version Matrix
|
||||||
|
|
||||||
|
| Package | Stable Version | Published On | Feed |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| Core.Blueprint.Common | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.Logging | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.Mongo | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.Redis | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.SQLServer | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.Storage | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
| Core.Blueprint.KeyVault | 0.2.0 | 2026-02-25 | AgileWebs org NuGet feed |
|
||||||
|
|
||||||
|
## Consumer Notes
|
||||||
|
|
||||||
|
- Current feed is HTTP and requires `allowInsecureConnections="true"` in `nuget.config`.
|
||||||
|
- Blueprint packages currently target `net10.0`; consumers must use compatible target frameworks.
|
||||||
|
- Feed setup and smoke test steps are documented in `docs/consumption/gitea-nuget-feed-validation.md`.
|
||||||
|
|||||||
@ -6,6 +6,12 @@
|
|||||||
- Minor: backward-compatible contract additions.
|
- Minor: backward-compatible contract additions.
|
||||||
- Major: breaking contract changes.
|
- Major: breaking contract changes.
|
||||||
|
|
||||||
|
## Stable Baseline Policy
|
||||||
|
|
||||||
|
- Stable decoupling baseline starts at `0.2.0`.
|
||||||
|
- All blueprint package outputs in the same release wave must share the same version.
|
||||||
|
- Breaking changes after baseline require major or minor strategy review before publication.
|
||||||
|
|
||||||
## Contract Compatibility
|
## Contract Compatibility
|
||||||
|
|
||||||
- Module package contracts are represented as descriptors implementing `IBlueprintPackageContract`.
|
- Module package contracts are represented as descriptors implementing `IBlueprintPackageContract`.
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
namespace Core.Blueprint.Common;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -4,4 +4,8 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions" Version="10.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
using Core.Blueprint.Common.Runtime;
|
||||||
|
using Core.Blueprint.Common.Runtime.Health;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers baseline runtime services for blueprint platform consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintRuntimeServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds blueprint runtime core services and health checks.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintRuntimeCore(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.TryAddSingleton<IBlueprintSystemClock, BlueprintSystemClock>();
|
||||||
|
services.TryAddEnumerable(
|
||||||
|
ServiceDescriptor.Singleton<IHealthCheck, BlueprintRuntimeHealthCheck>());
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
src/Core.Blueprint.Common/Runtime/BlueprintCorrelationId.cs
Normal file
24
src/Core.Blueprint.Common/Runtime/BlueprintCorrelationId.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a correlation identifier used for cross-layer request tracing.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Value">Correlation identifier value.</param>
|
||||||
|
public readonly record struct BlueprintCorrelationId(string Value)
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a correlation identifier from incoming value or runtime clock fallback.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="incomingValue">Incoming correlation identifier.</param>
|
||||||
|
/// <param name="clock">Runtime system clock for fallback generation.</param>
|
||||||
|
/// <returns>Normalized correlation identifier.</returns>
|
||||||
|
public static BlueprintCorrelationId Create(string? incomingValue, IBlueprintSystemClock clock)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(incomingValue))
|
||||||
|
{
|
||||||
|
return new BlueprintCorrelationId(incomingValue.Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BlueprintCorrelationId($"corr-{clock.UtcNow:yyyyMMddHHmmssfff}");
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/Core.Blueprint.Common/Runtime/BlueprintSystemClock.cs
Normal file
10
src/Core.Blueprint.Common/Runtime/BlueprintSystemClock.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default runtime system clock implementation.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BlueprintSystemClock : IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public DateTimeOffset UtcNow => DateTimeOffset.UtcNow;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.Runtime.Health;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Health check for baseline blueprint runtime dependencies.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class BlueprintRuntimeHealthCheck(IBlueprintSystemClock clock) : IHealthCheck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Executes runtime health probe.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="context">Health check context.</param>
|
||||||
|
/// <param name="cancellationToken">Cancellation token.</param>
|
||||||
|
/// <returns>Healthy runtime status result.</returns>
|
||||||
|
public Task<HealthCheckResult> CheckHealthAsync(
|
||||||
|
HealthCheckContext context,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
var data = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
["checkedAtUtc"] = clock.UtcNow,
|
||||||
|
["component"] = context.Registration.Name
|
||||||
|
};
|
||||||
|
|
||||||
|
return Task.FromResult(HealthCheckResult.Healthy("Blueprint runtime registered.", data));
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/Core.Blueprint.Common/Runtime/IBlueprintSystemClock.cs
Normal file
12
src/Core.Blueprint.Common/Runtime/IBlueprintSystemClock.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
namespace Core.Blueprint.Common.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides transport-neutral UTC time for runtime components.
|
||||||
|
/// </summary>
|
||||||
|
public interface IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets current UTC timestamp.
|
||||||
|
/// </summary>
|
||||||
|
DateTimeOffset UtcNow { get; }
|
||||||
|
}
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.KeyVault;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.KeyVault.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.KeyVault.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime key vault integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintKeyVaultServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds key vault runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="vaultName">Target key vault name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintKeyVaultModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string vaultName = "default-vault")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintKeyVaultRuntimeSettings(ResolveVaultName(vaultName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveVaultName(string vaultName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(vaultName))
|
||||||
|
{
|
||||||
|
return vaultName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "default-vault";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.KeyVault.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for key vault integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="VaultName">Target key vault name.</param>
|
||||||
|
public sealed record BlueprintKeyVaultRuntimeSettings(string VaultName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Logging;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Logging.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Logging.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime logging defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintLoggingServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds blueprint logging runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="categoryPrefix">Logging category prefix.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintLoggingModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string categoryPrefix = "AgileWebs")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintLoggingRuntimeSettings(ResolveCategoryPrefix(categoryPrefix)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveCategoryPrefix(string categoryPrefix)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(categoryPrefix))
|
||||||
|
{
|
||||||
|
return categoryPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "AgileWebs";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Logging.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for blueprint logging defaults.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="CategoryPrefix">Category prefix used by logging pipelines.</param>
|
||||||
|
public sealed record BlueprintLoggingRuntimeSettings(string CategoryPrefix);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Mongo;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Mongo.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Mongo.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime mongo integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintMongoServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds mongo runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="databaseName">Target mongo database name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintMongoModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string databaseName = "agilewebs")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintMongoRuntimeSettings(ResolveDatabaseName(databaseName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveDatabaseName(string databaseName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(databaseName))
|
||||||
|
{
|
||||||
|
return databaseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "agilewebs";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Mongo.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for mongo integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="DatabaseName">Target mongo database name.</param>
|
||||||
|
public sealed record BlueprintMongoRuntimeSettings(string DatabaseName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Redis;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Redis.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Redis.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime redis integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintRedisServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds redis runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="keyPrefix">Redis key prefix.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintRedisModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string keyPrefix = "agilewebs:")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintRedisRuntimeSettings(ResolveKeyPrefix(keyPrefix)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveKeyPrefix(string keyPrefix)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(keyPrefix))
|
||||||
|
{
|
||||||
|
return keyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "agilewebs:";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Redis.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for redis integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="KeyPrefix">Redis key prefix used by platform components.</param>
|
||||||
|
public sealed record BlueprintRedisRuntimeSettings(string KeyPrefix);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.SQLServer;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.SQLServer.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.SQLServer.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime sql server integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintSqlServerServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds sql server runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="connectionName">Logical connection name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintSqlServerModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string connectionName = "DefaultConnection")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintSqlServerRuntimeSettings(ResolveConnectionName(connectionName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveConnectionName(string connectionName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(connectionName))
|
||||||
|
{
|
||||||
|
return connectionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "DefaultConnection";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.SQLServer.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for sql server integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ConnectionName">Logical connection name used by consumers.</param>
|
||||||
|
public sealed record BlueprintSqlServerRuntimeSettings(string ConnectionName);
|
||||||
@ -1,5 +0,0 @@
|
|||||||
namespace Core.Blueprint.Storage;
|
|
||||||
|
|
||||||
public class Class1
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
using Core.Blueprint.Common.DependencyInjection;
|
||||||
|
using Core.Blueprint.Storage.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Storage.DependencyInjection;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registers runtime storage integration defaults for blueprint consumers.
|
||||||
|
/// </summary>
|
||||||
|
public static class BlueprintStorageServiceCollectionExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Adds storage runtime settings and baseline runtime services.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="services">Service collection.</param>
|
||||||
|
/// <param name="containerName">Logical storage container name.</param>
|
||||||
|
/// <returns>Service collection for fluent chaining.</returns>
|
||||||
|
public static IServiceCollection AddBlueprintStorageModule(
|
||||||
|
this IServiceCollection services,
|
||||||
|
string containerName = "default")
|
||||||
|
{
|
||||||
|
services.AddBlueprintRuntimeCore();
|
||||||
|
services.TryAddSingleton(new BlueprintStorageRuntimeSettings(ResolveContainerName(containerName)));
|
||||||
|
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string ResolveContainerName(string containerName)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(containerName))
|
||||||
|
{
|
||||||
|
return containerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
namespace Core.Blueprint.Storage.Runtime;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines runtime settings for storage integration helpers.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ContainerName">Logical storage container name.</param>
|
||||||
|
public sealed record BlueprintStorageRuntimeSettings(string ContainerName);
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
using Core.Blueprint.Common.Runtime;
|
||||||
|
using Core.Blueprint.Common.Runtime.Health;
|
||||||
|
using Microsoft.Extensions.Diagnostics.HealthChecks;
|
||||||
|
|
||||||
|
namespace Core.Blueprint.Common.UnitTests;
|
||||||
|
|
||||||
|
public class BlueprintRuntimeTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Create_WhenIncomingValueProvided_ReturnsTrimmedCorrelationId()
|
||||||
|
{
|
||||||
|
var correlationId = BlueprintCorrelationId.Create(" corr-123 ", new FakeClock());
|
||||||
|
|
||||||
|
Assert.Equal("corr-123", correlationId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Create_WhenIncomingValueMissing_UsesClockFallback()
|
||||||
|
{
|
||||||
|
var correlationId = BlueprintCorrelationId.Create(string.Empty, new FakeClock());
|
||||||
|
|
||||||
|
Assert.Equal("corr-20260222120000111", correlationId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task CheckHealthAsync_WhenInvoked_ReturnsHealthyStatus()
|
||||||
|
{
|
||||||
|
var clock = new FakeClock();
|
||||||
|
var healthCheck = new BlueprintRuntimeHealthCheck(clock);
|
||||||
|
var context = new HealthCheckContext
|
||||||
|
{
|
||||||
|
Registration = new HealthCheckRegistration(
|
||||||
|
"blueprint.runtime",
|
||||||
|
healthCheck,
|
||||||
|
failureStatus: null,
|
||||||
|
tags: [])
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await healthCheck.CheckHealthAsync(context);
|
||||||
|
|
||||||
|
Assert.Equal(HealthStatus.Healthy, result.Status);
|
||||||
|
Assert.Equal(clock.UtcNow, result.Data["checkedAtUtc"]);
|
||||||
|
Assert.Equal("blueprint.runtime", result.Data["component"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class FakeClock : IBlueprintSystemClock
|
||||||
|
{
|
||||||
|
public DateTimeOffset UtcNow => new(2026, 2, 22, 12, 0, 0, 111, TimeSpan.Zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
@ -22,4 +23,4 @@
|
|||||||
<ProjectReference Include="..\..\src\Core.Blueprint.Common\Core.Blueprint.Common.csproj" />
|
<ProjectReference Include="..\..\src\Core.Blueprint.Common\Core.Blueprint.Common.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
namespace Core.Blueprint.Common.UnitTests;
|
|
||||||
|
|
||||||
public class UnitTest1
|
|
||||||
{
|
|
||||||
[Fact]
|
|
||||||
public void Test1()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.KeyVault.DependencyInjection;
|
||||||
|
using Core.Blueprint.KeyVault.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.KeyVault.UnitTests;
|
namespace Core.Blueprint.KeyVault.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintKeyVaultModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintKeyVaultModule("agile-vault");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintKeyVaultRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("agile-vault", settings.VaultName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Logging.DependencyInjection;
|
||||||
|
using Core.Blueprint.Logging.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Logging.UnitTests;
|
namespace Core.Blueprint.Logging.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintLoggingModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintLoggingModule("Core");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintLoggingRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("Core", settings.CategoryPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Mongo.DependencyInjection;
|
||||||
|
using Core.Blueprint.Mongo.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Mongo.UnitTests;
|
namespace Core.Blueprint.Mongo.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintMongoModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintMongoModule("catalog-db");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintMongoRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("catalog-db", settings.DatabaseName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Redis.DependencyInjection;
|
||||||
|
using Core.Blueprint.Redis.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Redis.UnitTests;
|
namespace Core.Blueprint.Redis.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintRedisModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintRedisModule("bb:");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintRedisRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("bb:", settings.KeyPrefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.SQLServer.DependencyInjection;
|
||||||
|
using Core.Blueprint.SQLServer.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.SQLServer.UnitTests;
|
namespace Core.Blueprint.SQLServer.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintSqlServerModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintSqlServerModule("Primary");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintSqlServerRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("Primary", settings.ConnectionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
|
|||||||
@ -1,9 +1,21 @@
|
|||||||
|
using Core.Blueprint.Storage.DependencyInjection;
|
||||||
|
using Core.Blueprint.Storage.Runtime;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Core.Blueprint.Storage.UnitTests;
|
namespace Core.Blueprint.Storage.UnitTests;
|
||||||
|
|
||||||
public class UnitTest1
|
public class UnitTest1
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Test1()
|
public void AddBlueprintStorageModule_WhenCalled_RegistersRuntimeSettings()
|
||||||
{
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddBlueprintStorageModule("media");
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var settings = provider.GetRequiredService<BlueprintStorageRuntimeSettings>();
|
||||||
|
|
||||||
|
Assert.Equal("media", settings.ContainerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
33
tools/validate-no-cross-repo-projectrefs.sh
Executable file
33
tools/validate-no-cross-repo-projectrefs.sh
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
workspace_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||||
|
greenfield_root="$workspace_root/greenfield"
|
||||||
|
|
||||||
|
python3 - "$greenfield_root" <<'PY'
|
||||||
|
import pathlib
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
greenfield = pathlib.Path(sys.argv[1]).resolve()
|
||||||
|
violations = []
|
||||||
|
|
||||||
|
for csproj in greenfield.rglob("*.csproj"):
|
||||||
|
text = csproj.read_text(encoding="utf-8")
|
||||||
|
repo_root = csproj.parents[2].resolve()
|
||||||
|
for match in re.finditer(r'<ProjectReference\s+Include="([^"]+)"', text):
|
||||||
|
include = match.group(1).replace("\\", "/")
|
||||||
|
target = (csproj.parent / include).resolve()
|
||||||
|
if not str(target).startswith(str(repo_root)):
|
||||||
|
violations.append((csproj.relative_to(greenfield), include, target))
|
||||||
|
|
||||||
|
if violations:
|
||||||
|
print(f"FAILED: found {len(violations)} cross-repo ProjectReference entries")
|
||||||
|
for src, include, target in sorted(violations):
|
||||||
|
if str(target).startswith(str(greenfield)):
|
||||||
|
target = target.relative_to(greenfield)
|
||||||
|
print(f"- {src} -> {include} -> {target}")
|
||||||
|
raise SystemExit(1)
|
||||||
|
|
||||||
|
print("PASSED: no cross-repo ProjectReference entries found")
|
||||||
|
PY
|
||||||
Loading…
Reference in New Issue
Block a user