Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.1 #2

Merged
merged 22 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/unit-test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Dot Net Test Reporter"

on:
pull_request_target:
types: [ opened, synchronize ]

permissions:
pull-requests: write
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
8.0.x
- name: Restore dependencies
run: dotnet restore -p:TargetFramework=net8.0 AutomatedTesting
- name: Build-8.0
run: dotnet build --framework net8.0 --no-restore AutomatedTesting
- name: Test-8.0
run: dotnet test --framework net8.0 --no-build --verbosity normal AutomatedTesting
- name: report results
uses: bibipkins/dotnet-test-reporter@v1.4.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-title: 'Unit Test Results'
results-path: ./**/*.trx
coverage-path: ./**/coverage.xml
coverage-threshold: 90
16 changes: 2 additions & 14 deletions Abstractions/Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="../Shared.props" />

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>MQContract.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>MQContract</RootNamespace>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationMarkdown>$(MSBuildProjectDirectory)\Readme.md</DocumentationMarkdown>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Authors>roger-castaldo</Authors>
<Title>Abstractions for MQContract</Title>
<Company>$(AssemblyName)</Company>
<PackageProjectUrl>https://github.com/roger-castaldo/MQContract</PackageProjectUrl>
<PackageReadmeFile>Readme.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/roger-castaldo/MQContract</RepositoryUrl>
<PackageTags>Message Queue MQ Contract</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<IncludeSymbols>True</IncludeSymbols>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 5 additions & 0 deletions Abstractions/Attributes/MessageResponseTimeoutAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ public class MessageResponseTimeoutAttribute(int value) : Attribute
/// The number of milliseconds for the timeout to trigger for this RPC call class
/// </summary>
public int Value => value;

/// <summary>
/// The converted TimeSpan value from the supplied milliseconds value in the constructor
/// </summary>
public TimeSpan TimeSpanValue => TimeSpan.FromMilliseconds(value);
}
}
16 changes: 16 additions & 0 deletions Abstractions/Attributes/QueryResponseChannelAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace MQContract.Attributes
{
/// <summary>
/// Used to allow the specification of a response channel to be used without supplying it to the contract calls.
/// IMPORTANT: This particular attribute and the response channel argument are only used when the underlying connection does not support QueryResponse messaging.
/// </summary>
/// <param name="name">The name of the channel to use for responses</param>
[AttributeUsage(AttributeTargets.Class)]
public class QueryResponseChannelAttribute(string name) : Attribute
{
/// <summary>
/// The Name of the response channel
/// </summary>
public string Name => name;
}
}
67 changes: 0 additions & 67 deletions Abstractions/Exceptions.cs

This file was deleted.

6 changes: 3 additions & 3 deletions Abstractions/Interfaces/Conversion/IMessageConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
{
/// <summary>
/// Used to define a message converter. These are called upon if a
/// message is recieved on a channel of type T but it is waiting for
/// message is received on a channel of type T but it is waiting for
/// message of type V
/// </summary>
/// <typeparam name="T">The source message type</typeparam>
/// <typeparam name="V">The destination message type</typeparam>
public interface IMessageConverter<in T, out V>
public interface IMessageConverter<in T, V>
{
/// <summary>
/// Called to convert a message from type T to type V
/// </summary>
/// <param name="source">The message to convert</param>
/// <returns>The source message converted to the destination type V</returns>
V Convert(T source);
ValueTask<V> ConvertAsync(T source);
}
}
4 changes: 2 additions & 2 deletions Abstractions/Interfaces/Encoding/IMessageEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public interface IMessageEncoder
/// <typeparam name="T">The type of message being encoded</typeparam>
/// <param name="message">The message being encoded</param>
/// <returns>A byte array of the message in it's encoded form that will be transmitted</returns>
byte[] Encode<T>(T message);
ValueTask<byte[]> EncodeAsync<T>(T message);

/// <summary>
/// Called to decode a message from a byte array
/// </summary>
/// <typeparam name="T">The type of message being decoded</typeparam>
/// <param name="stream">A stream representing the byte array data that was transmitted as the message body in KubeMQ</param>
/// <returns>Null when fails or the value of T that was encoded inside the stream</returns>
T? Decode<T>(Stream stream);
ValueTask<T?> DecodeAsync<T>(Stream stream);
}
}
4 changes: 2 additions & 2 deletions Abstractions/Interfaces/Encoding/IMessageTypeEncoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ public interface IMessageTypeEncoder<T>
/// </summary>
/// <param name="message">The message value to encode</param>
/// <returns>The message encoded as a byte array</returns>
byte[] Encode(T message);
ValueTask<byte[]> EncodeAsync(T message);
/// <summary>
/// Called to decode the message from a byte stream into the specified type
/// </summary>
/// <param name="stream">The byte stream containing the encoded message</param>
/// <returns>null if the Decode fails, otherwise an instance of the message decoded from the stream</returns>
T? Decode(Stream stream);
ValueTask<T?> DecodeAsync(Stream stream);
}
}
6 changes: 3 additions & 3 deletions Abstractions/Interfaces/Encrypting/IMessageEncryptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ namespace MQContract.Interfaces.Encrypting
public interface IMessageEncryptor
{
/// <summary>
/// Called to decrypt the message body stream recieved as a message
/// Called to decrypt the message body stream received as a message
/// </summary>
/// <param name="stream">The stream representing the message body binary data</param>
/// <param name="headers">The message headers that were provided by the message</param>
/// <returns>A decrypted stream of the message body</returns>
Stream Decrypt(Stream stream, MessageHeader headers);
ValueTask<Stream> DecryptAsync(Stream stream, MessageHeader headers);

/// <summary>
/// Called to encrypt the message body prior to transmitting a message
/// </summary>
/// <param name="data">The original unencrypted body data</param>
/// <param name="headers">The headers that are desired to attache to the message if needed</param>
/// <returns>An encrypted byte array of the message body</returns>
byte[] Encrypt(byte[] data, out Dictionary<string, string?> headers);
ValueTask<byte[]> EncryptAsync(byte[] data, out Dictionary<string, string?> headers);
}
}
Loading
Loading