diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java
index 14f5b58a6d..a53bea61bd 100644
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/AcceptanceTestBase.java
@@ -27,6 +27,7 @@
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetTransactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.web3.Web3Transactions;
import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitConditions;
@@ -39,6 +40,7 @@ public class AcceptanceTestBase {
protected final Blockchain blockchain;
protected final Cluster cluster;
protected final CliqueTransactions cliqueTransactions;
+ protected final IbftTransactions ibftTransactions;
protected final Transactions transactions;
protected final Clique clique;
protected final Ibft ibft;
@@ -57,8 +59,10 @@ protected AcceptanceTestBase() {
blockchain = new Blockchain(ethTransactions);
eth = new Eth(ethTransactions);
cliqueTransactions = new CliqueTransactions();
+ ibftTransactions = new IbftTransactions();
+
clique = new Clique(ethTransactions, cliqueTransactions);
- ibft = new Ibft();
+ ibft = new Ibft(ibftTransactions);
net = new Net(new NetTransactions());
cluster = new Cluster(net);
transactions = new Transactions(accounts);
@@ -67,7 +71,7 @@ protected AcceptanceTestBase() {
web3 = new Web3(new Web3Transactions());
pantheon = new PantheonNodeFactory();
contractVerifier = new ContractVerifier(accounts.getPrimaryBenefactor());
- wait = new WaitConditions(ethTransactions, cliqueTransactions);
+ wait = new WaitConditions(ethTransactions, cliqueTransactions, ibftTransactions);
}
@After
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java
new file mode 100644
index 0000000000..0443e018c8
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectProposals.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2018 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor;
+
+import tech.pegasys.pantheon.ethereum.core.Address;
+import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
+import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
+
+import java.util.Map;
+
+public class ExpectProposals implements Condition {
+ private final IbftTransactions ibft;
+ private final Map
proposers;
+
+ public ExpectProposals(final IbftTransactions ibft, final Map proposers) {
+ this.ibft = ibft;
+ this.proposers = proposers;
+ }
+
+ @Override
+ public void verify(final Node node) {
+ waitFor(() -> assertThat(node.execute(ibft.createProposals())).isEqualTo(proposers));
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java
new file mode 100644
index 0000000000..a398d592e5
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft/ExpectValidators.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2018 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor;
+import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions.LATEST;
+
+import tech.pegasys.pantheon.ethereum.core.Address;
+import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
+import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
+
+public class ExpectValidators implements Condition {
+ private final IbftTransactions ibft;
+ private final Address[] validators;
+
+ public ExpectValidators(final IbftTransactions ibft, final Address... validators) {
+ this.ibft = ibft;
+ this.validators = validators;
+ }
+
+ @Override
+ public void verify(final Node node) {
+ waitFor(
+ () ->
+ assertThat(node.execute(ibft.createGetValidators(LATEST))).containsExactly(validators));
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java
index b047a5ee9e..c90377ece0 100644
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java
@@ -25,7 +25,7 @@ public class Admin {
private Transaction addPeerTransaction(final String enode) {
return (n) -> {
try {
- final Response resp = n.adminAddPeer(enode).send();
+ final Response resp = n.admin().adminAddPeer(enode).send();
assertThat(resp).isNotNull();
assertThat(resp.hasError()).isFalse();
return resp.getResult();
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java
index 3c6f30c8b1..37c9bbbaaa 100644
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft.java
@@ -12,14 +12,31 @@
*/
package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc;
+import tech.pegasys.pantheon.ethereum.core.Address;
+import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
+import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals;
+import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectValidators;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft.IbftTransactions;
import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+
+import com.google.common.collect.ImmutableMap;
public class Ibft {
+ private final IbftTransactions ibft;
+
+ public Ibft(final IbftTransactions ibft) {
+ this.ibft = ibft;
+ }
+
public List validators(final PantheonNode[] nodes) {
final Comparator compareByAddress =
Comparator.comparing(PantheonNode::getAddress);
@@ -27,4 +44,49 @@ public List validators(final PantheonNode[] nodes) {
pantheonNodes.sort(compareByAddress);
return pantheonNodes;
}
+
+ public ExpectValidators validatorsEqual(final PantheonNode... validators) {
+ return new ExpectValidators(ibft, validatorAddresses(validators));
+ }
+
+ private Address[] validatorAddresses(final PantheonNode[] validators) {
+ return Arrays.stream(validators).map(PantheonNode::getAddress).sorted().toArray(Address[]::new);
+ }
+
+ public Condition noProposals() {
+ return new ExpectProposals(ibft, ImmutableMap.of());
+ }
+
+ public PendingVotesConfig pendingVotesEqual() {
+ return new PendingVotesConfig(ibft);
+ }
+
+ public static class PendingVotesConfig {
+ private final Map proposals = new HashMap<>();
+ private final IbftTransactions ibft;
+
+ public PendingVotesConfig(final IbftTransactions ibft) {
+ this.ibft = ibft;
+ }
+
+ public PendingVotesConfig addProposal(final PantheonNode node) {
+ proposals.put(node, true);
+ return this;
+ }
+
+ public PendingVotesConfig removeProposal(final PantheonNode node) {
+ proposals.put(node, false);
+ return this;
+ }
+
+ public Condition build() {
+ final Map proposalsAsAddress =
+ this.proposals
+ .entrySet()
+ .stream()
+ .collect(Collectors.toMap(p -> p.getKey().getAddress(), Entry::getValue));
+ return new tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft.ExpectProposals(
+ ibft, proposalsAsAddress);
+ }
+ }
}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java
index fc0608c405..05c0097638 100644
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/PantheonNode.java
@@ -25,7 +25,11 @@
import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration;
import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
-import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PantheonWeb3j;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.AdminJsonRpcRequestFactory;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.CliqueJsonRpcRequestFactory;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.IbftJsonRpcRequestFactory;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.JsonRequestFactories;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.PermissioningJsonRpcRequestFactory;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.waitcondition.WaitCondition;
@@ -50,6 +54,8 @@
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.java_websocket.exceptions.WebsocketNotConnectedException;
+import org.web3j.protocol.Web3jService;
+import org.web3j.protocol.core.JsonRpc2_0Web3j;
import org.web3j.protocol.http.HttpService;
import org.web3j.protocol.websocket.WebSocketClient;
import org.web3j.protocol.websocket.WebSocketListener;
@@ -78,7 +84,7 @@ public class PantheonNode implements Node, NodeConfiguration, RunnableNode, Auto
private final boolean discoveryEnabled;
private List bootnodes = new ArrayList<>();
- private PantheonWeb3j pantheonWeb3j;
+ private JsonRequestFactories jsonRequestFactories;
private Optional ethNetworkConfig = Optional.empty();
public PantheonNode(
@@ -163,19 +169,23 @@ public String hostName() {
return LOCALHOST;
}
- private PantheonWeb3j pantheonWeb3j() {
-
- if (pantheonWeb3j == null) {
- if (!jsonRpcBaseUrl().isPresent()) {
- return new PantheonWeb3j(
- new HttpService("http://" + LOCALHOST + ":8545"), 2000, Async.defaultExecutorService());
- }
-
- return new PantheonWeb3j(
- new HttpService(jsonRpcBaseUrl().get()), 2000, Async.defaultExecutorService());
+ private JsonRequestFactories jsonRequestFactories() {
+ if (jsonRequestFactories == null) {
+ final Web3jService web3jService =
+ jsonRpcBaseUrl()
+ .map(url -> new HttpService(url))
+ .orElse(new HttpService("http://" + LOCALHOST + ":8545"));
+
+ jsonRequestFactories =
+ new JsonRequestFactories(
+ new JsonRpc2_0Web3j(web3jService, 2000, Async.defaultExecutorService()),
+ new CliqueJsonRpcRequestFactory(web3jService),
+ new IbftJsonRpcRequestFactory(web3jService),
+ new PermissioningJsonRpcRequestFactory(web3jService),
+ new AdminJsonRpcRequestFactory(web3jService));
}
- return pantheonWeb3j;
+ return jsonRequestFactories;
}
/** All future JSON-RPC calls are made via a web sockets connection. */
@@ -192,11 +202,9 @@ public void useWebSocketsForJsonRpc() {
throw new RuntimeException("Error connection to WebSocket endpoint", e);
}
- if (pantheonWeb3j != null) {
- pantheonWeb3j.shutdown();
+ if (jsonRequestFactories != null) {
+ jsonRequestFactories.shutdown();
}
-
- pantheonWeb3j = new PantheonWeb3j(webSocketService, 2000, Async.defaultExecutorService());
}
private void checkIfWebSocketEndpointIsAvailable(final String url) {
@@ -358,9 +366,9 @@ public String toString() {
@Override
public void stop() {
- if (pantheonWeb3j != null) {
- pantheonWeb3j.shutdown();
- pantheonWeb3j = null;
+ if (jsonRequestFactories != null) {
+ jsonRequestFactories.shutdown();
+ jsonRequestFactories = null;
}
}
@@ -391,7 +399,7 @@ public void ethNetworkConfig(final Optional ethNetworkConfig)
@Override
public T execute(final Transaction transaction) {
- return transaction.execute(pantheonWeb3j());
+ return transaction.execute(jsonRequestFactories());
}
@Override
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java
new file mode 100644
index 0000000000..68c7a99417
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/AdminJsonRpcRequestFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2019 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.transaction;
+
+import java.util.Collections;
+
+import org.web3j.protocol.Web3jService;
+import org.web3j.protocol.core.Request;
+import org.web3j.protocol.core.Response;
+
+public class AdminJsonRpcRequestFactory {
+
+ public static class AdminAddPeerResponse extends Response {}
+
+ private final Web3jService web3jService;
+
+ public AdminJsonRpcRequestFactory(final Web3jService web3jService) {
+ this.web3jService = web3jService;
+ }
+
+ public Request, AdminAddPeerResponse> adminAddPeer(final String enodeAddress) {
+ return new Request<>(
+ "admin_addPeer",
+ Collections.singletonList(enodeAddress),
+ web3jService,
+ AdminAddPeerResponse.class);
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java
new file mode 100644
index 0000000000..7d4a53960c
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/CliqueJsonRpcRequestFactory.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2019 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.transaction;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+
+import tech.pegasys.pantheon.ethereum.core.Hash;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse;
+
+import java.util.Arrays;
+
+import org.web3j.protocol.Web3jService;
+import org.web3j.protocol.core.Request;
+
+public class CliqueJsonRpcRequestFactory {
+
+ private final Web3jService web3jService;
+
+ public CliqueJsonRpcRequestFactory(final Web3jService web3jService) {
+ this.web3jService = web3jService;
+ }
+
+ public Request, ProposeResponse> cliquePropose(final String address, final Boolean auth) {
+ return new Request<>(
+ "clique_propose",
+ Arrays.asList(address, auth.toString()),
+ web3jService,
+ ProposeResponse.class);
+ }
+
+ public Request, DiscardResponse> cliqueDiscard(final String address) {
+ return new Request<>(
+ "clique_discard", singletonList(address), web3jService, DiscardResponse.class);
+ }
+
+ public Request, ProposalsResponse> cliqueProposals() {
+ return new Request<>("clique_proposals", emptyList(), web3jService, ProposalsResponse.class);
+ }
+
+ public Request, SignersBlockResponse> cliqueGetSigners(final String blockNumber) {
+ return new Request<>(
+ "clique_getSigners", singletonList(blockNumber), web3jService, SignersBlockResponse.class);
+ }
+
+ public Request, SignersBlockResponse> cliqueGetSignersAtHash(final Hash hash) {
+ return new Request<>(
+ "clique_getSignersAtHash",
+ singletonList(hash.toString()),
+ web3jService,
+ SignersBlockResponse.class);
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java
index 2d82324992..294420def8 100644
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java
@@ -37,7 +37,7 @@ public class DeploySmartContractTransaction implements Trans
}
@Override
- public T execute(final PantheonWeb3j node) {
+ public T execute(final JsonRequestFactories node) {
try {
final Method method =
clazz.getMethod(
@@ -45,7 +45,7 @@ public T execute(final PantheonWeb3j node) {
final Object invoked =
method.invoke(
- METHOD_IS_STATIC, node, BENEFACTOR_ONE, DEFAULT_GAS_PRICE, DEFAULT_GAS_LIMIT);
+ METHOD_IS_STATIC, node.eth(), BENEFACTOR_ONE, DEFAULT_GAS_PRICE, DEFAULT_GAS_LIMIT);
return cast(invoked).send();
} catch (final Exception e) {
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java
new file mode 100644
index 0000000000..05635c0d15
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/IbftJsonRpcRequestFactory.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2019 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.transaction;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+
+import tech.pegasys.pantheon.ethereum.core.Hash;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.DiscardResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposalsResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.ProposeResponse;
+import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ResponseTypes.SignersBlockResponse;
+
+import java.util.Arrays;
+
+import org.web3j.protocol.Web3jService;
+import org.web3j.protocol.core.Request;
+
+public class IbftJsonRpcRequestFactory {
+
+ private final Web3jService web3jService;
+
+ public IbftJsonRpcRequestFactory(final Web3jService web3jService) {
+ this.web3jService = web3jService;
+ }
+
+ public Request, ProposeResponse> ibftPropose(final String address, final Boolean auth) {
+ return new Request<>(
+ "ibft_proposeValidatorVote",
+ Arrays.asList(address, auth.toString()),
+ web3jService,
+ ProposeResponse.class);
+ }
+
+ public Request, DiscardResponse> ibftDiscard(final String address) {
+ return new Request<>(
+ "ibft_discardValidatorVote", singletonList(address), web3jService, DiscardResponse.class);
+ }
+
+ public Request, ProposalsResponse> ibftProposals() {
+ return new Request<>(
+ "ibft_getPendingVotes", emptyList(), web3jService, ProposalsResponse.class);
+ }
+
+ public Request, SignersBlockResponse> ibftGetValidators(final String blockNumber) {
+ return new Request<>(
+ "ibft_getValidatorsByBlockNumber",
+ singletonList(blockNumber),
+ web3jService,
+ SignersBlockResponse.class);
+ }
+
+ public Request, SignersBlockResponse> ibftGetSignersAtHash(final Hash hash) {
+ return new Request<>(
+ "ibft_getValidatorsByBlockHash",
+ singletonList(hash.toString()),
+ web3jService,
+ SignersBlockResponse.class);
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java
new file mode 100644
index 0000000000..e3f72d097c
--- /dev/null
+++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/JsonRequestFactories.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2019 ConsenSys AG.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package tech.pegasys.pantheon.tests.acceptance.dsl.transaction;
+
+import org.web3j.protocol.core.JsonRpc2_0Web3j;
+
+public class JsonRequestFactories {
+
+ private final JsonRpc2_0Web3j netEth;
+ private final CliqueJsonRpcRequestFactory clique;
+ private final IbftJsonRpcRequestFactory ibft;
+ private final PermissioningJsonRpcRequestFactory perm;
+ private final AdminJsonRpcRequestFactory admin;
+
+ public JsonRequestFactories(
+ final JsonRpc2_0Web3j netEth,
+ final CliqueJsonRpcRequestFactory clique,
+ final IbftJsonRpcRequestFactory ibft,
+ final PermissioningJsonRpcRequestFactory perm,
+ final AdminJsonRpcRequestFactory admin) {
+ this.netEth = netEth;
+ this.clique = clique;
+ this.ibft = ibft;
+ this.perm = perm;
+ this.admin = admin;
+ }
+
+ public JsonRpc2_0Web3j eth() {
+ return netEth;
+ }
+
+ public JsonRpc2_0Web3j net() {
+ return netEth;
+ }
+
+ public CliqueJsonRpcRequestFactory clique() {
+ return clique;
+ }
+
+ public IbftJsonRpcRequestFactory ibft() {
+ return ibft;
+ }
+
+ public PermissioningJsonRpcRequestFactory perm() {
+ return perm;
+ }
+
+ public AdminJsonRpcRequestFactory admin() {
+ return admin;
+ }
+
+ public void shutdown() {
+ netEth.shutdown();
+ }
+}
diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java
deleted file mode 100644
index 3bbbce5c20..0000000000
--- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/PantheonWeb3j.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2018 ConsenSys AG.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
- * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations under the License.
- */
-package tech.pegasys.pantheon.tests.acceptance.dsl.transaction;
-
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singletonList;
-
-import tech.pegasys.pantheon.ethereum.core.Address;
-import tech.pegasys.pantheon.ethereum.core.Hash;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ScheduledExecutorService;
-
-import org.assertj.core.util.Lists;
-import org.web3j.protocol.Web3jService;
-import org.web3j.protocol.core.JsonRpc2_0Web3j;
-import org.web3j.protocol.core.Request;
-import org.web3j.protocol.core.Response;
-
-public class PantheonWeb3j extends JsonRpc2_0Web3j {
-
- public PantheonWeb3j(final Web3jService web3jService) {
- super(web3jService);
- }
-
- public PantheonWeb3j(
- final Web3jService web3jService,
- final long pollingInterval,
- final ScheduledExecutorService scheduledExecutorService) {
- super(web3jService, pollingInterval, scheduledExecutorService);
- }
-
- public Request, ProposeResponse> cliquePropose(final String address, final Boolean auth) {
- return new Request<>(
- "clique_propose",
- Arrays.asList(address, auth.toString()),
- web3jService,
- ProposeResponse.class);
- }
-
- public Request, DiscardResponse> cliqueDiscard(final String address) {
- return new Request<>(
- "clique_discard", singletonList(address), web3jService, DiscardResponse.class);
- }
-
- public Request, ProposalsResponse> cliqueProposals() {
- return new Request<>("clique_proposals", emptyList(), web3jService, ProposalsResponse.class);
- }
-
- public Request, SignersBlockResponse> cliqueGetSigners(final String blockNumber) {
- return new Request<>(
- "clique_getSigners", singletonList(blockNumber), web3jService, SignersBlockResponse.class);
- }
-
- public Request, SignersBlockResponse> cliqueGetSignersAtHash(final Hash hash) {
- return new Request<>(
- "clique_getSignersAtHash",
- singletonList(hash.toString()),
- web3jService,
- SignersBlockResponse.class);
- }
-
- public static class ProposeResponse extends Response {}
-
- public static class DiscardResponse extends Response {}
-
- public static class SignersBlockResponse extends Response> {}
-
- public static class ProposalsResponse extends Response