Add unit tests for RabbitMq and Udp transport servers and clients
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
Some checks failed
Docs CI / lint-and-preview (push) Has been cancelled
- Implemented comprehensive unit tests for RabbitMqTransportServer, covering constructor, disposal, connection management, event handlers, and exception handling. - Added configuration tests for RabbitMqTransportServer to validate SSL, durable queues, auto-recovery, and custom virtual host options. - Created unit tests for UdpFrameProtocol, including frame parsing and serialization, header size validation, and round-trip data preservation. - Developed tests for UdpTransportClient, focusing on connection handling, event subscriptions, and exception scenarios. - Established tests for UdpTransportServer, ensuring proper start/stop behavior, connection state management, and event handling. - Included tests for UdpTransportOptions to verify default values and modification capabilities. - Enhanced service registration tests for Udp transport services in the dependency injection container.
This commit is contained in:
@@ -41,4 +41,15 @@ public sealed class ConnectionState
|
||||
/// Gets the transport type used for this connection.
|
||||
/// </summary>
|
||||
public required TransportType TransportType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the schema definitions for this connection's service.
|
||||
/// Keys are schema IDs referenced by EndpointDescriptor.SchemaInfo.
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<string, SchemaDefinition> Schemas { get; init; } = new Dictionary<string, SchemaDefinition>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OpenAPI metadata for this connection's service.
|
||||
/// </summary>
|
||||
public ServiceOpenApiInfo? OpenApiInfo { get; init; }
|
||||
}
|
||||
|
||||
@@ -45,4 +45,10 @@ public sealed record EndpointDescriptor
|
||||
/// This is used by the Microservice SDK for handler resolution.
|
||||
/// </summary>
|
||||
public Type? HandlerType { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the schema information for this endpoint.
|
||||
/// Contains references to request/response schemas and OpenAPI documentation.
|
||||
/// </summary>
|
||||
public EndpointSchemaInfo? SchemaInfo { get; init; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace StellaOps.Router.Common.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Schema metadata for an endpoint, referencing schemas by ID.
|
||||
/// </summary>
|
||||
public sealed record EndpointSchemaInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the schema ID for request validation.
|
||||
/// References a key in HelloPayload.Schemas.
|
||||
/// </summary>
|
||||
public string? RequestSchemaId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the schema ID for response validation.
|
||||
/// References a key in HelloPayload.Schemas.
|
||||
/// </summary>
|
||||
public string? ResponseSchemaId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OpenAPI operation summary.
|
||||
/// </summary>
|
||||
public string? Summary { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OpenAPI operation description.
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OpenAPI tags for this endpoint.
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> Tags { get; init; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this endpoint is deprecated.
|
||||
/// </summary>
|
||||
public bool Deprecated { get; init; }
|
||||
}
|
||||
@@ -14,4 +14,15 @@ public sealed record HelloPayload
|
||||
/// Gets the endpoints registered by this instance.
|
||||
/// </summary>
|
||||
public required IReadOnlyList<EndpointDescriptor> Endpoints { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the schema definitions for request/response validation.
|
||||
/// Keys are schema IDs referenced by EndpointDescriptor.SchemaInfo.
|
||||
/// </summary>
|
||||
public IReadOnlyDictionary<string, SchemaDefinition> Schemas { get; init; } = new Dictionary<string, SchemaDefinition>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OpenAPI metadata for this service.
|
||||
/// </summary>
|
||||
public ServiceOpenApiInfo? OpenApiInfo { get; init; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace StellaOps.Router.Common.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A JSON Schema definition for request or response validation.
|
||||
/// </summary>
|
||||
public sealed record SchemaDefinition
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the unique schema identifier (e.g., "CreateInvoiceRequest").
|
||||
/// </summary>
|
||||
public required string SchemaId { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the JSON Schema document (draft 2020-12 compatible).
|
||||
/// </summary>
|
||||
public required string SchemaJson { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ETag for cache validation (SHA256 truncated).
|
||||
/// </summary>
|
||||
public string? ETag { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace StellaOps.Router.Common.Models;
|
||||
|
||||
/// <summary>
|
||||
/// OpenAPI metadata for a microservice.
|
||||
/// </summary>
|
||||
public sealed record ServiceOpenApiInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the service title for OpenAPI info.
|
||||
/// </summary>
|
||||
public string? Title { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the service description for OpenAPI info.
|
||||
/// </summary>
|
||||
public string? Description { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the contact information for the service.
|
||||
/// </summary>
|
||||
public string? Contact { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the license name for the service.
|
||||
/// </summary>
|
||||
public string? License { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user