From 09e7979d474c1668a9ded1835381f136f464904c Mon Sep 17 00:00:00 2001 From: Tobias Looker Date: Wed, 3 Apr 2019 12:04:05 +1300 Subject: [PATCH] Minor service updates (#132) * Minor updates to the connection service processing request logic. Marked several methods that weren't previously marked as virtual so they can be overriden. * Bump version of the other related packages. --- .../AgentFramework.AspNetCore.csproj | 6 +++--- .../AgentFramework.Core.Handlers.csproj | 6 +++--- .../AgentFramework.Core.csproj | 6 +++--- .../Runtime/DefaultConnectionService.cs | 17 ++++++++++------- .../Runtime/DefaultMessageService.cs | 2 +- .../Runtime/DefaultPoolService.cs | 2 +- .../Runtime/DefaultProvisioningService.cs | 4 ++-- .../Runtime/DefaultTailsService.cs | 6 +++--- .../AgentFramework.TestHarness.csproj | 6 +++--- 9 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/AgentFramework.AspNetCore/AgentFramework.AspNetCore.csproj b/src/AgentFramework.AspNetCore/AgentFramework.AspNetCore.csproj index 617e0652..10dd6a4c 100644 --- a/src/AgentFramework.AspNetCore/AgentFramework.AspNetCore.csproj +++ b/src/AgentFramework.AspNetCore/AgentFramework.AspNetCore.csproj @@ -3,9 +3,9 @@ netstandard2.0 true - 3.0.0 - 3.0.0 - 3.0.0 + 3.0.1 + 3.0.1 + 3.0.1 ASP.NET Core support for Agent Framework bin\$(Configuration)\$(TargetFramework)\AgentFramework.AspNetCore.xml $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb diff --git a/src/AgentFramework.Core.Handlers/AgentFramework.Core.Handlers.csproj b/src/AgentFramework.Core.Handlers/AgentFramework.Core.Handlers.csproj index f934054e..b995ab51 100644 --- a/src/AgentFramework.Core.Handlers/AgentFramework.Core.Handlers.csproj +++ b/src/AgentFramework.Core.Handlers/AgentFramework.Core.Handlers.csproj @@ -8,9 +8,9 @@ true - 3.0.0 - 3.0.0 - 3.0.0 + 3.0.1 + 3.0.1 + 3.0.1 Support for extending AgentFramework using message handlers bin\$(Configuration)\$(TargetFramework)\AgentFramework.Core.Handlers.xml $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb diff --git a/src/AgentFramework.Core/AgentFramework.Core.csproj b/src/AgentFramework.Core/AgentFramework.Core.csproj index fb7fedcb..558c6bc3 100644 --- a/src/AgentFramework.Core/AgentFramework.Core.csproj +++ b/src/AgentFramework.Core/AgentFramework.Core.csproj @@ -9,9 +9,9 @@ true .NET Core tools for building agent services - 3.0.0 - 3.0.0 - 3.0.0 + 3.0.1 + 3.0.1 + 3.0.1 bin\$(Configuration)\$(TargetFramework)\AgentFramework.Core.xml $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb diff --git a/src/AgentFramework.Core/Runtime/DefaultConnectionService.cs b/src/AgentFramework.Core/Runtime/DefaultConnectionService.cs index 54eddb40..f7804984 100644 --- a/src/AgentFramework.Core/Runtime/DefaultConnectionService.cs +++ b/src/AgentFramework.Core/Runtime/DefaultConnectionService.cs @@ -177,7 +177,7 @@ public async Task RevokeInvitationAsync(IAgentContext agentContext, string invit } /// - public async Task ProcessRequestAsync(IAgentContext agentContext, ConnectionRequestMessage request) + public virtual async Task ProcessRequestAsync(IAgentContext agentContext, ConnectionRequestMessage request) { Logger.LogInformation(LoggingEvents.ProcessConnectionRequest, "Did {0}", request.Connection.Did); @@ -197,12 +197,15 @@ public async Task ProcessRequestAsync(IAgentContext agentContext, Connec agentContext.Connection.SetTag(TagConstants.LastThreadId, request.Id); - agentContext.Connection.Alias = new ConnectionAlias - { - Name = request.Label, - ImageUrl = request.ImageUrl - }; + if (agentContext.Connection.Alias == null) + agentContext.Connection.Alias = new ConnectionAlias(); + if (!string.IsNullOrEmpty(request.Label) && string.IsNullOrEmpty(agentContext.Connection.Alias.Name)) + agentContext.Connection.Alias.Name = request.Label; + + if (!string.IsNullOrEmpty(request.ImageUrl) && string.IsNullOrEmpty(agentContext.Connection.Alias.ImageUrl)) + agentContext.Connection.Alias.ImageUrl = request.ImageUrl; + if (!agentContext.Connection.MultiPartyInvitation) { await agentContext.Connection.TriggerAsync(ConnectionTrigger.InvitationAccept); @@ -237,7 +240,7 @@ public async Task ProcessRequestAsync(IAgentContext agentContext, Connec } /// - public async Task ProcessResponseAsync(IAgentContext agentContext, ConnectionResponseMessage response) + public virtual async Task ProcessResponseAsync(IAgentContext agentContext, ConnectionResponseMessage response) { Logger.LogInformation(LoggingEvents.AcceptConnectionResponse, "To {1}", agentContext.Connection.MyDid); diff --git a/src/AgentFramework.Core/Runtime/DefaultMessageService.cs b/src/AgentFramework.Core/Runtime/DefaultMessageService.cs index 79c3bdc6..203d73cf 100644 --- a/src/AgentFramework.Core/Runtime/DefaultMessageService.cs +++ b/src/AgentFramework.Core/Runtime/DefaultMessageService.cs @@ -42,7 +42,7 @@ public DefaultMessageService( } /// - public async Task PrepareAsync(Wallet wallet, AgentMessage message, string recipientKey, string[] routingKeys = null, string senderKey = null) + public virtual async Task PrepareAsync(Wallet wallet, AgentMessage message, string recipientKey, string[] routingKeys = null, string senderKey = null) { if (message == null) throw new ArgumentNullException(nameof(message)); if (senderKey == null) throw new ArgumentNullException(nameof(senderKey)); diff --git a/src/AgentFramework.Core/Runtime/DefaultPoolService.cs b/src/AgentFramework.Core/Runtime/DefaultPoolService.cs index d1b5a207..1f43afc8 100644 --- a/src/AgentFramework.Core/Runtime/DefaultPoolService.cs +++ b/src/AgentFramework.Core/Runtime/DefaultPoolService.cs @@ -22,7 +22,7 @@ public virtual async Task GetPoolAsync(string poolName, int protocolVersio } /// - public async Task GetPoolAsync(string poolName) + public virtual async Task GetPoolAsync(string poolName) { if (Pools.TryGetValue(poolName, out var pool)) { diff --git a/src/AgentFramework.Core/Runtime/DefaultProvisioningService.cs b/src/AgentFramework.Core/Runtime/DefaultProvisioningService.cs index 373d6c7e..a63c2b74 100644 --- a/src/AgentFramework.Core/Runtime/DefaultProvisioningService.cs +++ b/src/AgentFramework.Core/Runtime/DefaultProvisioningService.cs @@ -104,7 +104,7 @@ record = await GetProvisioningAsync(wallet); } /// - public async Task ProvisionAgentAsync(ProvisioningConfiguration configuration) + public virtual async Task ProvisionAgentAsync(ProvisioningConfiguration configuration) { if (configuration == null) throw new ArgumentNullException(nameof(configuration)); @@ -175,7 +175,7 @@ public async Task ProvisionAgentAsync(ProvisioningConfiguration configuration) } /// - public async Task UpdateEndpointAsync(Wallet wallet, AgentEndpoint endpoint) + public virtual async Task UpdateEndpointAsync(Wallet wallet, AgentEndpoint endpoint) { var record = await GetProvisioningAsync(wallet); record.Endpoint = endpoint; diff --git a/src/AgentFramework.Core/Runtime/DefaultTailsService.cs b/src/AgentFramework.Core/Runtime/DefaultTailsService.cs index a8a35bd6..2e457492 100644 --- a/src/AgentFramework.Core/Runtime/DefaultTailsService.cs +++ b/src/AgentFramework.Core/Runtime/DefaultTailsService.cs @@ -40,7 +40,7 @@ public DefaultTailsService( } /// - public async Task OpenTailsAsync(string filename) + public virtual async Task OpenTailsAsync(string filename) { var baseDir = EnvironmentUtils.GetTailsPath(); @@ -62,7 +62,7 @@ public async Task OpenTailsAsync(string filename) } /// - public async Task CreateTailsAsync() + public virtual async Task CreateTailsAsync() { var tailsWriterConfig = new { @@ -75,7 +75,7 @@ public async Task CreateTailsAsync() } /// - public async Task EnsureTailsExistsAsync(Pool pool, string revocationRegistryId) + public virtual async Task EnsureTailsExistsAsync(Pool pool, string revocationRegistryId) { var revocationRegistry = await LedgerService.LookupRevocationRegistryDefinitionAsync(pool, revocationRegistryId); diff --git a/src/AgentFramework.TestHarness/AgentFramework.TestHarness.csproj b/src/AgentFramework.TestHarness/AgentFramework.TestHarness.csproj index 32aedc5c..208c025f 100644 --- a/src/AgentFramework.TestHarness/AgentFramework.TestHarness.csproj +++ b/src/AgentFramework.TestHarness/AgentFramework.TestHarness.csproj @@ -5,9 +5,9 @@ true true A Test Harness for testing AgentFramework - 3.0.0 - 3.0.0 - 3.0.0 + 3.0.1 + 3.0.1 + 3.0.1