Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
85dbcf0
Added null check - the proto suggests this shouldn't ever be null, bu…
WhitWaldo Nov 28, 2024
054f6d9
Removed the Task.WhenAll making the operation non-blocking
WhitWaldo Nov 28, 2024
2eb6b5d
Added unit test to validate that the subscription is no longer blocking
WhitWaldo Nov 28, 2024
8593d8a
Removed unused line from previous test, added another test
WhitWaldo Nov 28, 2024
6465ad1
Added another test
WhitWaldo Nov 28, 2024
c92e46a
More unit tests
WhitWaldo Nov 28, 2024
0ccda6b
Added more unit tests
WhitWaldo Nov 28, 2024
09bec43
Updated to make DaprPublishSubscribeClientBuilder configurable via a …
WhitWaldo Nov 28, 2024
7900b0c
Added missing copyright statements
WhitWaldo Nov 28, 2024
0ae4919
Merge branch 'master' into pubsub-fix
WhitWaldo Nov 28, 2024
560aa2a
Added missing package reference
WhitWaldo Nov 28, 2024
95b102d
Merge remote-tracking branch 'origin/pubsub-fix' into pubsub-fix
WhitWaldo Nov 28, 2024
f864511
Fixed bad reference (missed in merge)
WhitWaldo Nov 28, 2024
51782b0
Fixed failing unit test
WhitWaldo Nov 28, 2024
e0b7de2
Tweak to only pass along EventMessage payloads to developers as it's …
WhitWaldo Nov 30, 2024
3e1df92
Merge branch 'master' into pubsub-fix
WhitWaldo Nov 30, 2024
1fce6b5
Was missing assignment of the Data property in the TopicMessage. Shou…
WhitWaldo Nov 30, 2024
4e71535
Merge remote-tracking branch 'origin/pubsub-fix' into pubsub-fix
WhitWaldo Nov 30, 2024
b2ab6ea
Fix - return would be bad. Continue is the right move.
WhitWaldo Nov 30, 2024
d48a85e
Added a simple test
WhitWaldo Dec 3, 2024
eea8546
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 3, 2024
fd2332c
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 4, 2024
b11cf16
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 4, 2024
be5a8a1
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 5, 2024
738f8be
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 10, 2024
35b8aca
Fixed unit tests
WhitWaldo Dec 11, 2024
31724b2
Merged in tweaks from #1422
WhitWaldo Dec 11, 2024
a08b7e8
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 11, 2024
b2ccb78
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 11, 2024
8fb65dd
Merge branch 'master' into pubsub-fix
WhitWaldo Dec 11, 2024
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
Prev Previous commit
Next Next commit
Merge branch 'master' into pubsub-fix
Signed-off-by: Whit Waldo <whit.waldo@innovian.net>
  • Loading branch information
WhitWaldo authored Nov 28, 2024
commit 0ae4919100111c2614e9f781e6990cbc7ba61774
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Copyright 2024 The Dapr Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -18,15 +18,12 @@

namespace Dapr.Messaging.Test.Extensions;

public class PublishSubscribeServiceCollectionExtensionsTests
public sealed class PublishSubscribeServiceCollectionExtensionsTests
{
[Fact]
public void AddDaprPubSubClient_RegistersServicesCorrectly()
public void AddDaprPubSubClient_RegistersIHttpClientFactory()
{
var services = new ServiceCollection();
var httpClientFactoryMock = new Mock<IHttpClientFactory>();
services.AddSingleton(httpClientFactoryMock.Object);

services.AddDaprPubSubClient();

var serviceProvider = services.BuildServiceProvider();
Expand Down Expand Up @@ -56,4 +53,70 @@ void Configure(IServiceProvider sp, DaprPublishSubscribeClientBuilder builder)
configureCalled = true;
}
}

[Fact]
public void AddDaprPubSubClient_RegistersServicesCorrectly()
{
var services = new ServiceCollection();
var httpClientFactoryMock = new Mock<IHttpClientFactory>();
services.AddSingleton(httpClientFactoryMock.Object);

var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
Assert.NotNull(httpClientFactory);

var daprPubSubClient = serviceProvider.GetService<DaprPublishSubscribeClient>();
Assert.NotNull(daprPubSubClient);
}

[Fact]
public void RegisterPubsubClient_ShouldRegisterSingleton_WhenLifetimeIsSingleton()
{
var services = new ServiceCollection();

services.AddDaprPubSubClient(lifetime: ServiceLifetime.Singleton);
var serviceProvider = services.BuildServiceProvider();

var daprPubSubClient1 = serviceProvider.GetService<DaprPublishSubscribeClient>();
var daprPubSubClient2 = serviceProvider.GetService<DaprPublishSubscribeClient>();

Assert.NotNull(daprPubSubClient1);
Assert.NotNull(daprPubSubClient2);

Assert.Same(daprPubSubClient1, daprPubSubClient2);
}

[Fact]
public async Task RegisterPubsubClient_ShouldRegisterScoped_WhenLifetimeIsScoped()
{
var services = new ServiceCollection();

services.AddDaprPubSubClient(lifetime: ServiceLifetime.Scoped);
var serviceProvider = services.BuildServiceProvider();

await using var scope1 = serviceProvider.CreateAsyncScope();
var daprPubSubClient1 = scope1.ServiceProvider.GetService<DaprPublishSubscribeClient>();

await using var scope2 = serviceProvider.CreateAsyncScope();
var daprPubSubClient2 = scope2.ServiceProvider.GetService<DaprPublishSubscribeClient>();

Assert.NotNull(daprPubSubClient1);
Assert.NotNull(daprPubSubClient2);
Assert.NotSame(daprPubSubClient1, daprPubSubClient2);
}

[Fact]
public void RegisterPubsubClient_ShouldRegisterTransient_WhenLifetimeIsTransient()
{
var services = new ServiceCollection();

services.AddDaprPubSubClient(lifetime: ServiceLifetime.Transient);
var serviceProvider = services.BuildServiceProvider();

var daprPubSubClient1 = serviceProvider.GetService<DaprPublishSubscribeClient>();
var daprPubSubClient2 = serviceProvider.GetService<DaprPublishSubscribeClient>();

Assert.NotNull(daprPubSubClient1);
Assert.NotNull(daprPubSubClient2);
Assert.NotSame(daprPubSubClient1, daprPubSubClient2);
}
}
You are viewing a condensed version of this merge commit. You can view the full changes here.