Skip to content

Commit

Permalink
Merge branch 'master' into issues/172
Browse files Browse the repository at this point in the history
  • Loading branch information
minhoryang authored Aug 20, 2019
2 parents 78b5f70 + 3ec8619 commit 59a43ee
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 1,253 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ To be released.
- Added `IActionContext.NewGuId()` method. [[#371], [#439]]
- `Address(byte[])` became to throw `ArgumentNullException`
instead of `NullReferenceException`. [[#443]]
- Removed `FileStore` class. [[#446]]

### Added interfaces

Expand Down Expand Up @@ -157,6 +158,7 @@ To be released.
[#442]: https://github.com/planetarium/libplanet/issues/442
[#443]: https://github.com/planetarium/libplanet/pull/443
[#445]: https://github.com/planetarium/libplanet/pull/445
[#446]: https://github.com/planetarium/libplanet/pull/446
[LiteDB #1268]: https://github.com/mbdavid/LiteDB/issues/1268
[floating-point determinism]: https://wp.me/p1fTCO-kT

Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Benchmarks/MineBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace Libplanet.Benchmarks
{
public class MineBlock
{
private FileStoreFixture _fx;
private StoreFixture _fx;
private BlockChain<DumbAction> _blockChain;

public MineBlock()
{
_fx = new FileStoreFixture();
_fx = new LiteDBStoreFixture();
_blockChain = new BlockChain<DumbAction>(
new NullPolicy<DumbAction>(),
_fx.Store
Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Blockchain/BlockChainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace Libplanet.Tests.Blockchain
{
public class BlockChainTest : IDisposable
{
private FileStoreFixture _fx;
private StoreFixture _fx;
private BlockChain<DumbAction> _blockChain;

public BlockChainTest()
{
_fx = new FileStoreFixture();
_fx = new LiteDBStoreFixture();
_blockChain = new BlockChain<DumbAction>(
new BlockPolicy<DumbAction>(new MinerReward(1)),
_fx.Store
Expand Down
3 changes: 1 addition & 2 deletions Libplanet.Tests/Blockchain/Policies/BlockPolicyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using Libplanet.Blockchain;
using Libplanet.Blockchain.Policies;
using Libplanet.Blocks;
using Libplanet.Tests.Common.Action;
Expand All @@ -13,7 +12,7 @@

namespace Libplanet.Tests.Blockchain.Policies
{
public class BlockPolicyTest : IClassFixture<FileStoreFixture>
public class BlockPolicyTest : IClassFixture<LiteDBStoreFixture>
{
private static readonly DateTimeOffset FixtureEpoch =
new DateTimeOffset(2018, 1, 1, 0, 0, 0, TimeSpan.Zero);
Expand Down
15 changes: 7 additions & 8 deletions Libplanet.Tests/Net/SwarmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ public class SwarmTest : IDisposable
private const int DisposeTimeout = 5 * 1000;

private readonly ITestOutputHelper _output;

private readonly FileStoreFixture _fx1;
private readonly FileStoreFixture _fx2;
private readonly FileStoreFixture _fx3;
private readonly StoreFixture _fx1;
private readonly StoreFixture _fx2;
private readonly StoreFixture _fx3;

private readonly List<BlockChain<DumbAction>> _blockchains;
private readonly List<Swarm<DumbAction>> _swarms;
Expand All @@ -53,9 +52,9 @@ public SwarmTest(ITestOutputHelper output)
_output = output;

var policy = new BlockPolicy<DumbAction>(new MinerReward(1));
_fx1 = new FileStoreFixture();
_fx2 = new FileStoreFixture();
_fx3 = new FileStoreFixture();
_fx1 = new LiteDBStoreFixture();
_fx2 = new LiteDBStoreFixture();
_fx3 = new LiteDBStoreFixture();

_blockchains = new List<BlockChain<DumbAction>>
{
Expand Down Expand Up @@ -341,7 +340,7 @@ public async Task DetectAppProtocolVersion()
host: IPAddress.Loopback.ToString(),
appProtocolVersion: 2);
var d = new Swarm<DumbAction>(
new BlockChain<DumbAction>(_blockchains[0].Policy, new FileStoreFixture().Store),
new BlockChain<DumbAction>(_blockchains[0].Policy, new LiteDBStoreFixture().Store),
new PrivateKey(),
host: IPAddress.Loopback.ToString(),
appProtocolVersion: 3);
Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Store/BlockSetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ namespace Libplanet.Tests.Store
{
public class BlockSetTest : IDisposable
{
private readonly FileStoreFixture _fx;
private readonly StoreFixture _fx;
private readonly BlockSet<DumbAction> _set;

public BlockSetTest()
{
_fx = new FileStoreFixture();
_fx = new LiteDBStoreFixture();
_set = new BlockSet<DumbAction>(_fx.Store);
}

Expand Down
38 changes: 0 additions & 38 deletions Libplanet.Tests/Store/FileStoreFixture.cs

This file was deleted.

161 changes: 0 additions & 161 deletions Libplanet.Tests/Store/FileStoreTest.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Libplanet.Tests/Store/LiteDBStoreFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public LiteDBStoreFixture()

public string Path { get; }

public void Dispose()
public override void Dispose()
{
(Store as LiteDBStore)?.Dispose();
File.Delete(Path);
Expand Down
1 change: 0 additions & 1 deletion Libplanet.Tests/Store/StoreExtensionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public static IEnumerable<object[]> StoreFixtures
{
get
{
yield return new object[] { new FileStoreFixture() };
yield return new object[] { new LiteDBStoreFixture() };
}
}
Expand Down
4 changes: 3 additions & 1 deletion Libplanet.Tests/Store/StoreFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Libplanet.Tests.Store
{
public abstract class StoreFixture
public abstract class StoreFixture : IDisposable
{
public StoreFixture()
{
Expand Down Expand Up @@ -107,6 +107,8 @@ public StoreFixture()

public IStore Store { get; set; }

public abstract void Dispose();

public Transaction<DumbAction> MakeTransaction(
IEnumerable<DumbAction> actions = null,
ImmutableHashSet<Address> updatedAddresses = null,
Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Store/StoreTrackerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ namespace Libplanet.Tests.Store
{
public sealed class StoreTrackerTest
{
private readonly FileStoreFixture _fx;
private readonly StoreFixture _fx;
private readonly StoreTracker _tracker;

public StoreTrackerTest()
{
_fx = new FileStoreFixture();
_fx = new LiteDBStoreFixture();
_tracker = new StoreTracker(_fx.Store);
}

Expand Down
4 changes: 2 additions & 2 deletions Libplanet.Tests/Store/TransactionSetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace Libplanet.Tests.Store
{
public class TransactionSetTest : IDisposable
{
private readonly FileStoreFixture _fx;
private readonly StoreFixture _fx;
private readonly TransactionSet<DumbAction> _set;

public TransactionSetTest()
{
_fx = new FileStoreFixture();
_fx = new LiteDBStoreFixture();
_set = new TransactionSet<DumbAction>(_fx.Store);
}

Expand Down
Loading

0 comments on commit 59a43ee

Please sign in to comment.