Skip to content

Commit

Permalink
Refactored OrionTestHarness to use in memory storage. (hyperledger#1676)
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Terry <mark.terry@consensys.net>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
  • Loading branch information
mark-terry and macfarla authored Dec 9, 2020
1 parent 8497b32 commit 55f0d92
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ public class OrionConfiguration {
private final Path tempDir;
private final List<String> otherNodes = new ArrayList<>();
private final boolean clearKnownNodes;
private final String storage;

public OrionConfiguration(
final Path[] publicKeys,
final Path[] privateKeys,
final Path tempDir,
final List<String> otherNodes,
final boolean clearKnownNodes) {
final boolean clearKnownNodes,
final String storage) {

this.publicKeys = publicKeys;
this.privateKeys = privateKeys;
this.tempDir = tempDir;
this.otherNodes.addAll(otherNodes);
this.clearKnownNodes = clearKnownNodes;
this.storage = storage;
}

public Path[] getPublicKeys() {
Expand All @@ -63,4 +66,8 @@ public void addOtherNode(final String otherNode) {
public boolean isClearKnownNodes() {
return clearKnownNodes;
}

public String getStorage() {
return storage;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ private Config buildConfig() {
+ "clientnetworkinterface = \""
+ HOST
+ "\"\n"
+ "storage = \"leveldb:database/orion_node\"\n"
+ "storage = \""
+ orionConfiguration.getStorage()
+ "\"\n"
+ "publickeys = ["
+ joinPathsAsTomlListEntry(orionConfiguration.getPublicKeys())
+ "]\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.List;

public class OrionTestHarnessFactory {
private static final String storage = "memory";

public static OrionTestHarness create(
final Path tempDir, final OrionKeyConfiguration orionConfig) {
Expand Down Expand Up @@ -69,8 +70,7 @@ public static OrionTestHarness create(
final Path[] key1pubs,
final Path[] key1keys,
final List<String> othernodes) {

return new OrionTestHarness(
new OrionConfiguration(key1pubs, key1keys, tempDir, othernodes, false));
new OrionConfiguration(key1pubs, key1keys, tempDir, othernodes, false, storage));
}
}

0 comments on commit 55f0d92

Please sign in to comment.