Replace BLite with Surreal embedded persistence
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m21s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m21s
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using ZB.MOM.WW.CBDDC.Core;
|
||||
using ZB.MOM.WW.CBDDC.Core.Network;
|
||||
using ZB.MOM.WW.CBDDC.Persistence.BLite;
|
||||
using ZB.MOM.WW.CBDDC.Persistence.Surreal;
|
||||
|
||||
namespace ZB.MOM.WW.CBDDC.Sample.Console.Tests;
|
||||
|
||||
public class PeerOplogConfirmationStoreTests : IDisposable
|
||||
{
|
||||
private readonly SampleDbContext _context;
|
||||
private readonly BLitePeerOplogConfirmationStore<SampleDbContext> _store;
|
||||
private readonly SurrealPeerOplogConfirmationStore _store;
|
||||
private readonly string _testDbPath;
|
||||
|
||||
/// <summary>
|
||||
@@ -16,21 +16,22 @@ public class PeerOplogConfirmationStoreTests : IDisposable
|
||||
/// </summary>
|
||||
public PeerOplogConfirmationStoreTests()
|
||||
{
|
||||
_testDbPath = Path.Combine(Path.GetTempPath(), $"test-peer-confirmation-{Guid.NewGuid()}.blite");
|
||||
_testDbPath = Path.Combine(Path.GetTempPath(), $"test-peer-confirmation-{Guid.NewGuid()}.rocksdb");
|
||||
_context = new SampleDbContext(_testDbPath);
|
||||
_store = new BLitePeerOplogConfirmationStore<SampleDbContext>(
|
||||
_context,
|
||||
NullLogger<BLitePeerOplogConfirmationStore<SampleDbContext>>.Instance);
|
||||
_store = new SurrealPeerOplogConfirmationStore(
|
||||
_context.SurrealEmbeddedClient,
|
||||
_context.SchemaInitializer,
|
||||
NullLogger<SurrealPeerOplogConfirmationStore>.Instance);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
_context?.Dispose();
|
||||
if (File.Exists(_testDbPath))
|
||||
if (Directory.Exists(_testDbPath))
|
||||
try
|
||||
{
|
||||
File.Delete(_testDbPath);
|
||||
Directory.Delete(_testDbPath, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -109,4 +110,4 @@ public class PeerOplogConfirmationStoreTests : IDisposable
|
||||
peerARows.ShouldNotBeEmpty();
|
||||
peerARows.All(x => !x.IsActive).ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user