Skip to content

Commit

Permalink
WIP: Experimental "fix" for GH-3310
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Jul 17, 2024
1 parent fe2217d commit 0630f55
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 344 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using JasperFx.CodeGeneration;
using JasperFx.Core;
using Marten;
using Marten.Events;
using Marten.Events.Projections;
using Marten.Metadata;
using Marten.Schema;
using Marten.Storage;
using Marten.Testing.Harness;
Expand Down Expand Up @@ -40,14 +42,46 @@ public Bug_3310_inline_projections_with_quick_append(ITestOutputHelper testOutpu
opts.Events.AddEventType<LoadTestUnrelatedEvent>();
opts.Projections.Snapshot<LoadTestInlineProjection>(SnapshotLifecycle.Inline);
opts.Projections.Snapshot<LoadTestUnrelatedInlineProjection>(SnapshotLifecycle.Inline);

// opts.SetApplicationProject(GetType().Assembly);
// opts.GeneratedCodeMode = TypeLoadMode.Auto;
// opts.GeneratedCodeOutputPath =
// AppContext.BaseDirectory.ParentDirectory().ParentDirectory().ParentDirectory().AppendPath("Internal", "Generated");

});
}

[Fact]
public async Task start_and_append_events_to_same_stream()
{
await using var session = theStore.LightweightSession(tenant);

session.Logger = new TestOutputMartenLogger(_testOutputHelper);

var streamId = Guid.NewGuid().ToString();

session.Events.StartStream<LoadTestInlineProjection>(streamId,new LoadTestEvent(Guid.NewGuid(), 1),
new LoadTestEvent(Guid.NewGuid(), 2), new LoadTestEvent(Guid.NewGuid(), 3));
await session.SaveChangesAsync();

_testOutputHelper.WriteLine("APPEND STARTS HERE");

session.Events.Append(streamId, new LoadTestEvent(Guid.NewGuid(), 4), new LoadTestEvent(Guid.NewGuid(), 5));
await session.SaveChangesAsync();

var doc = await session.LoadAsync<LoadTestInlineProjection>(streamId);
doc.Version.ShouldBe(5);


}

[Fact]
public async Task create_1_stream_with_many_events()
{
await using var session = theStore.LightweightSession(tenant);

session.Logger = new TestOutputMartenLogger(_testOutputHelper);

await Preload(session);

var sw = new Stopwatch();
Expand Down Expand Up @@ -187,13 +221,13 @@ public record LoadTestEvent(Guid Value, int Count);
public record LoadTestUnrelatedEvent;

[DocumentAlias("load_testing_inline_projection")]
public record LoadTestInlineProjection
public record LoadTestInlineProjection : IRevisioned
{
[Identity]
public string StreamKey { get; init; }
public Guid LastValue { get; init; }
public long Sum { get; init; }
[Version]
//[Version]
public int Version { get; set; }

public LoadTestInlineProjection Apply(LoadTestEvent @event, LoadTestInlineProjection current)
Expand Down
286 changes: 0 additions & 286 deletions src/EventSourcingTests/Internal/Generated/EventStore/EventStorage.cs

This file was deleted.

Loading

0 comments on commit 0630f55

Please sign in to comment.