Skip to content
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
2 changes: 2 additions & 0 deletions src/Extensions/Wolverine.MemoryPack.Tests/end_to_end.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public async Task DisposeAsync()
{
await _receivingHost.StopAsync();
await _publishingHost.StopAsync();
_receivingHost.Dispose();
_publishingHost.Dispose();
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/Wolverine.MessagePack.Tests/end_to_end.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public async Task DisposeAsync()
{
await _receivingHost.StopAsync();
await _publishingHost.StopAsync();
_receivingHost.Dispose();
_publishingHost.Dispose();
}

#endregion
Expand Down
2 changes: 2 additions & 0 deletions src/Extensions/Wolverine.Protobuf.Tests/end_to_end.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public async Task DisposeAsync()
{
await _receivingHost.StopAsync();
await _publishingHost.StopAsync();
_receivingHost.Dispose();
_publishingHost.Dispose();
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Wolverine.Http.Tests.Transport;

public class CloudEventsHttpTransportTests
public class CloudEventsHttpTransportTests : IDisposable
{
private readonly IHttpClientFactory _clientFactory;
private readonly MockHttpMessageHandler _handler;
Expand Down Expand Up @@ -145,6 +145,12 @@ public async Task cloud_events_with_null_options_uses_default()
_handler.LastRequest.ShouldNotBeNull();
_handler.LastRequest.Content!.Headers.ContentType!.MediaType.ShouldBe(HttpTransport.CloudEventsContentType);
}

public void Dispose()
{
_httpClient.Dispose();
_handler.Dispose();
}
}

public class TestMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Wolverine.Http.Tests.Transport;

public class WolverineHttpTransportClientTests
public class WolverineHttpTransportClientTests : IDisposable
{
private readonly IHttpClientFactory _clientFactory;
private readonly MockHttpMessageHandler _handler;
Expand Down Expand Up @@ -74,6 +74,12 @@ public async Task send_batch_async()
var expectedData = EnvelopeSerializer.Serialize(envelopes);
_handler.LastContent.ShouldBe(expectedData);
}

public void Dispose()
{
_httpClient.Dispose();
_handler.Dispose();
}
}

public class MockHttpMessageHandler : HttpMessageHandler
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Wolverine.Http.Tests/posting_json.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public async Task post_json_but_accept_text_get_406()
[Fact]
public async Task reading_json_from_canceled_request_gets_204()
{
var cts = new CancellationTokenSource();
using var cts = new CancellationTokenSource();
cts.Cancel();

var response = await Scenario(x =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public async Task InitializeAsync()
.UseLightweightSessions()
.IntegrateWithWolverine();

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(RaiseIfValidatedHandler))
.IncludeType(typeof(ResponseHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddResourceSetupOnStartup();
}).StartAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public async Task use_ievent_as_Guid_id()
using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(AEventHandler)).IncludeType(typeof(RaiseLetterHandler));
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(AEventHandler))
.IncludeType(typeof(RaiseLetterHandler));

opts.Services.AddMarten(m =>
{
Expand All @@ -49,8 +51,7 @@ public async Task use_ievent_as_Guid_id()
});

opts.Policies.AutoApplyTransactions();


opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddResourceSetupOnStartup();
}).StartAsync();

Expand All @@ -76,7 +77,8 @@ public async Task using_string_as_stream_key()
using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(StringIdentifiedHandler));
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(StringIdentifiedHandler));

opts.Services.AddMarten(m =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ public async Task InitializeAsync()
.IntegrateWithWolverine();

opts.Services.AddResourceSetupOnStartup();
opts.CodeGeneration.TypeLoadMode = TypeLoadMode.Auto;
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(ConsistentPropertyHandler))
.IncludeType(typeof(ConsistentAggregateHandlerUsage))
.IncludeType(typeof(ConsistentParamHandler));
opts.Durability.Mode = DurabilityMode.Solo;
}).StartAsync();

theStore = theHost.Services.GetRequiredService<IDocumentStore>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
using Wolverine.ComplianceTests;
using Wolverine.Marten;
using Wolverine.Tracking;
using Wolverine;

namespace MartenTests.AggregateHandlerWorkflow;

public class marten_command_workflow_middleware : PostgresqlContext, IAsyncLifetime, IDisposable
public class marten_command_workflow_middleware : PostgresqlContext, IAsyncLifetime
{
private IHost theHost = null!;
private IDocumentStore theStore = null!;
Expand All @@ -40,16 +41,20 @@ public async Task InitializeAsync()
opts.Services.AddResourceSetupOnStartup();

opts.CodeGeneration.TypeLoadMode = TypeLoadMode.Auto;

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(SpecialLetterHandler))
.IncludeType(typeof(LetterAggregateHandler));
opts.Durability.Mode = DurabilityMode.Solo;
});

theStore = theHost.Services.GetRequiredService<IDocumentStore>();
}

Task IAsyncLifetime.DisposeAsync() => Task.CompletedTask;

public void Dispose()
public async Task DisposeAsync()
{
theHost?.Dispose();
await theHost.StopAsync();
theHost.Dispose();
}

internal async Task GivenAggregate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public async Task get_the_correct_aggregate_back_out()
using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(MakePurchaseHandler));
opts.Durability.Mode = DurabilityMode.Solo;
MartenServiceCollectionExtensions.AddMarten(opts.Services, m =>
{
m.Connection(Servers.PostgresConnectionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public async Task InitializeAsync()
theHost = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(TransferFundsWithDualVersionHandler))
.IncludeType(typeof(TransferWithConsistencyCheckHandler))
.IncludeType(typeof(TransferWithConsistencyCheckNoConcurrentModificationHandler))
.IncludeType(typeof(TransferFundsHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddMarten(m =>
{
m.Connection(Servers.PostgresConnectionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace MartenTests.AggregateHandlerWorkflow;

public class natural_key_aggregate_handler_workflow : PostgresqlContext, IAsyncLifetime, IAsyncDisposable
public class natural_key_aggregate_handler_workflow : PostgresqlContext, IAsyncLifetime
{
private IHost _host = null!;
private IDocumentStore _store = null!;
Expand All @@ -36,22 +36,21 @@ public async Task InitializeAsync()
.UseLightweightSessions()
.IntegrateWithWolverine();

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(NkOrderHandler));
opts.Durability.Mode = DurabilityMode.Solo;

opts.Services.AddResourceSetupOnStartup();
opts.CodeGeneration.TypeLoadMode = TypeLoadMode.Auto;
});

_store = _host.Services.GetRequiredService<IDocumentStore>();
}

Task IAsyncLifetime.DisposeAsync() => DisposeAsync().AsTask();

public async ValueTask DisposeAsync()
public async Task DisposeAsync()
{
if (_host != null)
{
await _host.StopAsync();
_host.Dispose();
}
await _host.StopAsync();
_host.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public async Task return_event_with_metadata_from_aggregate_handler()
using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Durability.Mode = DurabilityMode.Solo;
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(AEventHandler))
.IncludeType(typeof(EmitEventsWithMetadataHandler));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public async Task InitializeAsync()
theHost = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(StrongLetterHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddMarten(m =>
{
m.Connection(Servers.PostgresConnectionString);
Expand All @@ -33,6 +35,7 @@ public async Task InitializeAsync()
public async Task DisposeAsync()
{
await theHost.StopAsync();
theHost.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public async Task InitializeAsync()
theHost = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(ParamVersionSourceHandler))
.IncludeType(typeof(CustomVersionSourceHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddMarten(m =>
{
m.Connection(Servers.PostgresConnectionString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public async Task InitializeAsync()
m.DatabaseSchemaName = "things";
}).IntegrateWithWolverine();

opts.Discovery.DisableConventionalDiscovery();
opts.Durability.Mode = DurabilityMode.Solo;

}).StartAsync();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public async Task InitializeAsync()
m.Connection(thingsConnectionString);
}).IntegrateWithWolverine(x => x.MainConnectionString = Servers.PostgresConnectionString);

opts.Discovery.DisableConventionalDiscovery();
opts.Durability.Mode = DurabilityMode.Solo;

opts.Services.AddResourceSetupOnStartup();
}).StartAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public async Task InitializeAsync()
{
x.MainConnectionString = Servers.PostgresConnectionString;
});

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(PlayerMessageHandler));
opts.Services.AddResourceSetupOnStartup();
}).StartAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
using JasperFx.Core;
using JasperFx.MultiTenancy;
using Marten;
using Marten.Storage;
using Microsoft.Extensions.Hosting;
using JasperFx.Resources;
using Shouldly;
using Weasel.Core;
using Wolverine;
using Wolverine.Configuration;
using Wolverine.Marten;
using Wolverine.Postgresql;
using Wolverine.Tracking;
Expand Down Expand Up @@ -42,6 +39,9 @@ public async Task send_messages_with_postgresql_queueing()
options.MessageStorageSchemaName = "sender";
});

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(ColorResponseHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddResourceSetupOnStartup();

}).StartAsync();
Expand Down Expand Up @@ -69,6 +69,9 @@ public async Task send_messages_with_postgresql_queueing()
options.MessageStorageSchemaName = "listener";
});

opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(ColorRequestHandler));
opts.Durability.Mode = DurabilityMode.Solo;
opts.Services.AddResourceSetupOnStartup();

}).StartAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Bug_1427_no_endpoint_error_on_retries : IAsyncLifetime
{
private IHost _host = null!;

public Task InitializeAsync()
public async Task InitializeAsync()
{
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMarten(o =>
Expand All @@ -45,27 +45,27 @@ public Task InitializeAsync()

options.Policies.LogMessageStarting(LogLevel.Information);

options.MultipleHandlerBehavior = MultipleHandlerBehavior.Separated;

if (builder.Environment.IsDevelopment())
{
options.Durability.Mode = DurabilityMode.Solo;
}

// ISSUE: this attempt to retry the failed messages leads to the "Wolverine.Runtime.Handlers.NoHandlerForEndpointException"
options.MultipleHandlerBehavior = MultipleHandlerBehavior.Separated;

options.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(StartBatchHandler));
options.Durability.Mode = DurabilityMode.Solo;

// ISSUE: this attempt to retry the failed messages leads to the "Wolverine.Runtime.Handlers.NoHandlerForEndpointException"
options
.OnException<ConcurrencyException>()
.RetryWithCooldown(2.Seconds(), 4.Seconds(), 8.Seconds());

});

_host = builder.Build();
return _host.StartAsync();
await _host.StartAsync();
}

public Task DisposeAsync()
public async Task DisposeAsync()
{
return _host.StopAsync();
await _host.StopAsync();
_host.Dispose();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public async Task InitializeAsync()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery()
.IncludeType(typeof(UpdateThingAggregateHandler));
.IncludeType(typeof(UpdateThingAggregateHandler));
opts.Durability.Mode = DurabilityMode.Solo;

opts.Services.AddMarten(marten =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public async Task send_messages_with_delay()
using var host = await Host.CreateDefaultBuilder()
.UseWolverine(opts =>
{
opts.Discovery.DisableConventionalDiscovery().IncludeType(typeof(ReproduceBugHandler));
opts.Durability.Mode = DurabilityMode.Solo;

opts.Services.AddMarten(m =>
Expand Down
Loading
Loading