Skip to content

Commit

Permalink
fix(namespaces) - Fixing merge conflicts, resolved ResolverUI vs Reso…
Browse files Browse the repository at this point in the history
…lverUi
  • Loading branch information
lilla28 committed Jun 25, 2024
1 parent 8b76d7c commit 08c3b0c
Show file tree
Hide file tree
Showing 28 changed files with 332 additions and 331 deletions.
21 changes: 0 additions & 21 deletions examples/fdc3-appdirectory/apps-with-intents.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
"interop": {
"intents": {
"listensFor": {
"ViewChart": {
"name": "ViewChart",
"displayName": "ViewChart",
"contexts": [
"fdc3.instrument"
]
}
}
}
}
Expand Down Expand Up @@ -51,13 +44,6 @@
"contexts": [
"fdc3.nothing"
]
},
"ViewChart": {
"name": "ViewChart",
"displayName": "ViewChart",
"contexts": [
"fdc3.instrument"
]
}
},
"raises": {}
Expand Down Expand Up @@ -87,13 +73,6 @@
"contexts": [
"fdc3.testContext"
]
},
"ViewChart": {
"name": "ViewChart",
"displayName": "ViewChart",
"contexts": [
"fdc3.instrument"
]
}
},
"raises": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using MorganStanley.ComposeUI.Fdc3.DesktopAgent.Contracts;
using MorganStanley.ComposeUI.Fdc3.DesktopAgent.Converters;
using MorganStanley.ComposeUI.Fdc3.DesktopAgent.Infrastructure.Internal;
using MorganStanley.ComposeUI.Messaging.Abstractions;
using AppMetadata = MorganStanley.ComposeUI.Fdc3.DesktopAgent.Protocol.AppMetadata;

namespace MorganStanley.ComposeUI.Fdc3.DesktopAgent.Tests.Infrastructure.Internal;
Expand Down Expand Up @@ -57,7 +58,7 @@ public async Task SendResolverUIRequest_will_return_response()
It.IsAny<MessageBuffer>(),
It.IsAny<InvokeOptions>(),
It.IsAny<CancellationToken>()))
.Returns(ValueTask.FromResult<MessageBuffer?>(
.Returns(ValueTask.FromResult<IMessageBuffer?>(
MessageBuffer.Factory.CreateJson(new ResolverUIResponse()
{
AppMetadata = new AppMetadata(){ AppId = "testAppId" }
Expand Down
29 changes: 14 additions & 15 deletions src/messaging/dotnet/src/Abstractions/IMessageBuffer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

namespace MorganStanley.ComposeUI.Messaging.Abstractions
namespace MorganStanley.ComposeUI.Messaging.Abstractions;

public interface IMessageBuffer
{
public interface IMessageBuffer
{
/// <summary>
/// Gets the bytes of the underlying buffer as a <see cref="ReadOnlySpan{T}" />
/// </summary>
/// <returns></returns>
ReadOnlySpan<byte> GetSpan();
/// <summary>
/// Gets the bytes of the underlying buffer as a <see cref="ReadOnlySpan{T}" />
/// </summary>
/// <returns></returns>
ReadOnlySpan<byte> GetSpan();

/// <summary>
/// Gets the string value of the buffer.
/// </summary>
/// <returns></returns>
string GetString();
}
}
/// <summary>
/// Gets the string value of the buffer.
/// </summary>
/// <returns></returns>
string GetString();
}
147 changes: 73 additions & 74 deletions src/messaging/dotnet/src/Abstractions/IMessagingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,84 +10,83 @@
// or implied. See the License for the specific language governing permissions
// and limitations under the License.

namespace MorganStanley.ComposeUI.Messaging.Abstractions
namespace MorganStanley.ComposeUI.Messaging.Abstractions;

public interface IMessagingService : IAsyncDisposable
{
public interface IMessagingService : IAsyncDisposable
{
/// <summary>
/// Gets the client ID of the current connection.
/// </summary>
/// <remarks>
/// The returned value will be <value>null</value> if the client is not connected.
/// </remarks>
string? ClientId { get; }
/// <summary>
/// Gets the client ID of the current connection.
/// </summary>
/// <remarks>
/// The returned value will be <value>null</value> if the client is not connected.
/// </remarks>
string? ClientId { get; }

/// <summary>
/// Asynchronously connects to the Message Router server endpoint.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <remarks>
/// Clients don't need to call this method before calling other methods on this type.
/// The client should automatically establish a connection when needed.
/// </remarks>
ValueTask ConnectAsync(CancellationToken cancellationToken = default);
/// <summary>
/// Asynchronously connects to the Message Router server endpoint.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <remarks>
/// Clients don't need to call this method before calling other methods on this type.
/// The client should automatically establish a connection when needed.
/// </remarks>
ValueTask ConnectAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Gets an observable that represents a topic.
/// </summary>
/// <param name="topic"></param>
/// <param name="subscriber"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask<IAsyncDisposable> SubscribeAsync(string topic,
Func<IMessageBuffer, ValueTask> subscriber,
CancellationToken cancellationToken = default);
/// <summary>
/// Gets an observable that represents a topic.
/// </summary>
/// <param name="topic"></param>
/// <param name="subscriber"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask<IAsyncDisposable> SubscribeAsync(string topic,
Func<IMessageBuffer, ValueTask> subscriber,
CancellationToken cancellationToken = default);

/// <summary>
/// Publishes a message to a topic.
/// </summary>
/// <param name="topic"></param>
/// <param name="payload"></param>
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask PublishAsync(string topic,
IMessageBuffer? message = null,
PublishOptions optinos = default,
CancellationToken cancellationToken = default);
/// <summary>
/// Publishes a message to a topic.
/// </summary>
/// <param name="topic"></param>
/// <param name="payload"></param>
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask PublishAsync(string topic,
IMessageBuffer? message = null,
PublishOptions optinos = default,
CancellationToken cancellationToken = default);

/// <summary>
/// Registers a service by providing a name and handler.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="subscriber"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask RegisterServiceAsync(string endpoint,
Func<string, IMessageBuffer?, MessageContext?, ValueTask<IMessageBuffer?>> subscriber,
CancellationToken cancellationToken = default);
/// <summary>
/// Registers a service by providing a name and handler.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="subscriber"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask RegisterServiceAsync(string endpoint,
Func<string, IMessageBuffer?, MessageContext?, ValueTask<IMessageBuffer?>> subscriber,
CancellationToken cancellationToken = default);

/// <summary>
/// Removes a service registration.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask UnregisterServiceAsync(string endpoint, CancellationToken cancellationToken = default);
/// <summary>
/// Removes a service registration.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask UnregisterServiceAsync(string endpoint, CancellationToken cancellationToken = default);

/// <summary>
/// Invokes a named service.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="payload"></param>
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask<IMessageBuffer?> InvokeAsync(
string endpoint,
IMessageBuffer? payload = null,
InvokeOptions options = default,
CancellationToken cancellationToken = default);
}
}
/// <summary>
/// Invokes a named service.
/// </summary>
/// <param name="endpoint"></param>
/// <param name="payload"></param>
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
ValueTask<IMessageBuffer?> InvokeAsync(
string endpoint,
IMessageBuffer? payload = null,
InvokeOptions options = default,
CancellationToken cancellationToken = default);
}
7 changes: 7 additions & 0 deletions src/shell/dotnet/Shell.sln
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{1944F009-EA2D-4D
README.md = README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MorganStanley.ComposeUI.Messaging.Abstractions", "..\..\messaging\dotnet\src\Abstractions\MorganStanley.ComposeUI.Messaging.Abstractions.csproj", "{F90449AE-B26E-42E0-873B-4F0CAE6FCD98}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -107,6 +109,10 @@ Global
{24E64AFE-D2C5-487D-85F3-B0CE5AC0A128}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24E64AFE-D2C5-487D-85F3-B0CE5AC0A128}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24E64AFE-D2C5-487D-85F3-B0CE5AC0A128}.Release|Any CPU.Build.0 = Release|Any CPU
{F90449AE-B26E-42E0-873B-4F0CAE6FCD98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F90449AE-B26E-42E0-873B-4F0CAE6FCD98}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F90449AE-B26E-42E0-873B-4F0CAE6FCD98}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F90449AE-B26E-42E0-873B-4F0CAE6FCD98}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -125,6 +131,7 @@ Global
{24E64AFE-D2C5-487D-85F3-B0CE5AC0A128} = {DA1A43C4-F758-47E2-870A-7E5BBB946671}
{B7A04459-C612-447F-9245-75DFAF23C31D} = {DA1A43C4-F758-47E2-870A-7E5BBB946671}
{56F41D4A-5A4C-4F41-86CA-1B003992F083} = {DA1A43C4-F758-47E2-870A-7E5BBB946671}
{F90449AE-B26E-42E0-873B-4F0CAE6FCD98} = {E7A2C581-4BF4-47A5-8A11-59B2DEBADCA7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4C901E6C-4B9A-48C2-AB16-461040DC57B4}
Expand Down
2 changes: 1 addition & 1 deletion src/shell/dotnet/Shell/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void ConfigureFdc3()
services.AddFdc3AppDirectory();
services.AddSingleton<Fdc3ResolverUIWindow>();
services.AddSingleton<IResolverUIProjector>(p => p.GetRequiredService<Fdc3ResolverUIWindow>());
services.AddHostedService<Fdc3ResolverUIService>();
services.AddHostedService<ResolverUIService>();

Check warning on line 204 in src/shell/dotnet/Shell/App.xaml.cs

View check run for this annotation

Codecov / codecov/patch

src/shell/dotnet/Shell/App.xaml.cs#L202-L204

Added lines #L202 - L204 were not covered by tests
services.Configure<Fdc3Options>(fdc3ConfigurationSection);
services.Configure<Fdc3DesktopAgentOptions>(
fdc3ConfigurationSection.GetSection(nameof(fdc3Options.DesktopAgent)));
Expand Down
Loading

0 comments on commit 08c3b0c

Please sign in to comment.