Refactored OrionTestHarness to use in memory storage. (#1676)

Signed-off-by: Mark Terry <mark.terry@consensys.net>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/1690/head
mark-terry 4 years ago committed by GitHub
parent 8497b324c7
commit 55f0d92f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      testutil/src/main/java/org/hyperledger/orion/testutil/OrionConfiguration.java
  2. 4
      testutil/src/main/java/org/hyperledger/orion/testutil/OrionTestHarness.java
  3. 4
      testutil/src/main/java/org/hyperledger/orion/testutil/OrionTestHarnessFactory.java

@ -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() {
@ -63,4 +66,8 @@ public class OrionConfiguration {
public boolean isClearKnownNodes() {
return clearKnownNodes;
}
public String getStorage() {
return storage;
}
}

@ -134,7 +134,9 @@ public class OrionTestHarness {
+ "clientnetworkinterface = \""
+ HOST
+ "\"\n"
+ "storage = \"leveldb:database/orion_node\"\n"
+ "storage = \""
+ orionConfiguration.getStorage()
+ "\"\n"
+ "publickeys = ["
+ joinPathsAsTomlListEntry(orionConfiguration.getPublicKeys())
+ "]\n"

@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.List;
public class OrionTestHarnessFactory {
private static final String storage = "memory";
public static OrionTestHarness create(
final Path tempDir, final OrionKeyConfiguration orionConfig) {
@ -69,8 +70,7 @@ public class OrionTestHarnessFactory {
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));
}
}

Loading…
Cancel
Save