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 16a90bbd2a..5ae972ff8c 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 @@ -14,19 +14,20 @@ package tech.pegasys.pantheon.tests.acceptance.dsl; import tech.pegasys.pantheon.tests.acceptance.dsl.account.Accounts; import tech.pegasys.pantheon.tests.acceptance.dsl.blockchain.Blockchain; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.admin.AdminConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.CliqueConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.EthConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft2.Ibft2Conditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.login.LoginConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.NetConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.PermissioningConditions; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.web3.Web3Conditions; import tech.pegasys.pantheon.tests.acceptance.dsl.contract.ContractVerifier; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Admin; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Clique; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eth; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Ibft2; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Login; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Net; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Perm; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Web3; import tech.pegasys.pantheon.tests.acceptance.dsl.node.cluster.Cluster; import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.PantheonNodeFactory; import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.permissioning.PermissionedNodeBuilder; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.account.AccountTransactions; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.admin.AdminTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.contract.ContractTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions; @@ -41,44 +42,46 @@ public class AcceptanceTestBase { protected final Accounts accounts; protected final AccountTransactions accountTransactions; - protected final Admin admin; + protected final AdminConditions admin; + protected final AdminTransactions adminTransactions; protected final Blockchain blockchain; - protected final Clique clique; + protected final CliqueConditions clique; protected final CliqueTransactions cliqueTransactions; protected final Cluster cluster; protected final ContractVerifier contractVerifier; - protected final Eth eth; + protected final ContractTransactions contractTransactions; + protected final EthConditions eth; protected final EthTransactions ethTransactions; protected final Ibft2Transactions ibftTwoTransactions; - protected final Ibft2 ibftTwo; - protected final Login login; - protected final Net net; + protected final Ibft2Conditions ibftTwo; + protected final LoginConditions login; + protected final NetConditions net; protected final PantheonNodeFactory pantheon; - protected final Perm perm; + protected final PermissioningConditions perm; protected final PermissionedNodeBuilder permissionedNodeBuilder; protected final PermissioningTransactions permissioningTransactions; - protected final ContractTransactions contractTransactions; - protected final Web3 web3; + protected final Web3Conditions web3; protected AcceptanceTestBase() { ethTransactions = new EthTransactions(); accounts = new Accounts(ethTransactions); - blockchain = new Blockchain(ethTransactions); - eth = new Eth(ethTransactions); + adminTransactions = new AdminTransactions(); cliqueTransactions = new CliqueTransactions(); ibftTwoTransactions = new Ibft2Transactions(); accountTransactions = new AccountTransactions(accounts); permissioningTransactions = new PermissioningTransactions(); contractTransactions = new ContractTransactions(); - clique = new Clique(ethTransactions, cliqueTransactions); - ibftTwo = new Ibft2(ibftTwoTransactions); - login = new Login(); - net = new Net(new NetTransactions()); + blockchain = new Blockchain(ethTransactions); + clique = new CliqueConditions(ethTransactions, cliqueTransactions); + eth = new EthConditions(ethTransactions); + ibftTwo = new Ibft2Conditions(ibftTwoTransactions); + login = new LoginConditions(); + net = new NetConditions(new NetTransactions()); cluster = new Cluster(net); - perm = new Perm(permissioningTransactions); - admin = new Admin(); - web3 = new Web3(new Web3Transactions()); + perm = new PermissioningConditions(permissioningTransactions); + admin = new AdminConditions(adminTransactions); + web3 = new Web3Conditions(new Web3Transactions()); pantheon = new PantheonNodeFactory(); contractVerifier = new ContractVerifier(accounts.getPrimaryBenefactor()); permissionedNodeBuilder = new PermissionedNodeBuilder(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/AdminConditions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/AdminConditions.java new file mode 100644 index 0000000000..ad748a1dce --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/AdminConditions.java @@ -0,0 +1,44 @@ +/* + * 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.condition.admin; + +import static org.assertj.core.api.Assertions.fail; + +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.node.RunnableNode; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.admin.AdminTransactions; + +import java.net.URI; + +public class AdminConditions { + + private final AdminTransactions admin; + + public AdminConditions(final AdminTransactions admin) { + this.admin = admin; + } + + public Condition addPeer(final Node addingPeer) { + + return new ExpectPeerAdded(admin.addPeer(enodeUrl(addingPeer))); + } + + private URI enodeUrl(final Node node) { + if (!(node instanceof RunnableNode)) { + fail("A RunnableNode instance is required"); + } + + return ((RunnableNode) node).enodeUrl(); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/ExpectPeerAdded.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/ExpectPeerAdded.java new file mode 100644 index 0000000000..1f22c1c959 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/admin/ExpectPeerAdded.java @@ -0,0 +1,34 @@ +/* + * 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.condition.admin; + +import static org.assertj.core.api.Assertions.assertThat; + +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.admin.AddPeerTransaction; + +public class ExpectPeerAdded implements Condition { + + private final AddPeerTransaction transaction; + + public ExpectPeerAdded(final AddPeerTransaction transaction) { + this.transaction = transaction; + } + + @Override + public void verify(final Node node) { + final Boolean result = node.execute(transaction); + assertThat(result).isTrue(); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Clique.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/clique/CliqueConditions.java similarity index 86% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Clique.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/clique/CliqueConditions.java index 380e7bd001..da0bb993f8 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Clique.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/clique/CliqueConditions.java @@ -10,7 +10,7 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique; import static java.util.Collections.emptyList; import static tech.pegasys.pantheon.ethereum.core.Hash.fromHexString; @@ -21,14 +21,7 @@ import tech.pegasys.pantheon.config.GenesisConfigFile; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.blockchain.ExpectBlockNotCreated; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.AwaitSignerSetChange; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectNonceVote; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectNonceVote.CLIQUE_NONCE_VOTE; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectProposals; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectValidators; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectValidatorsAtBlock; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectValidatorsAtBlockHash; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.clique.ExpectedBlockHasProposer; import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions; @@ -44,11 +37,12 @@ import java.util.stream.Collectors; import com.google.common.collect.ImmutableMap; import org.web3j.protocol.core.DefaultBlockParameter; -public class Clique { +public class CliqueConditions { + private final EthTransactions eth; private final CliqueTransactions clique; - public Clique(final EthTransactions eth, final CliqueTransactions clique) { + public CliqueConditions(final EthTransactions eth, final CliqueTransactions clique) { this.eth = eth; this.clique = clique; } @@ -110,6 +104,7 @@ public class Clique { } public static class ProposalsConfig { + private final Map proposals = new HashMap<>(); private final CliqueTransactions clique; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eea.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/EeaConditions.java similarity index 78% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eea.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/EeaConditions.java index 164db0e151..ea92a5938e 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eea.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/EeaConditions.java @@ -10,17 +10,16 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectSuccessfulEeaGetTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; -public class Eea { +public class EeaConditions { - EeaTransactions transactions; + private final EeaTransactions transactions; - public Eea(final EeaTransactions transactions) { + public EeaConditions(final EeaTransactions transactions) { this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoPrivateContractDeployedReceipt.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoPrivateContractDeployedReceipt.java index 69fbc1e2a9..f9f10f0353 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoPrivateContractDeployedReceipt.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoPrivateContractDeployedReceipt.java @@ -14,14 +14,14 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.junit.Assert.assertNull; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; public class ExpectNoPrivateContractDeployedReceipt extends GetValidPrivateTransactionReceipt { - public ExpectNoPrivateContractDeployedReceipt(final Eea eea, final EeaTransactions transactions) { + public ExpectNoPrivateContractDeployedReceipt( + final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractEventsEmitted.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractEventsEmitted.java index 1903198140..e0141abfbf 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractEventsEmitted.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractEventsEmitted.java @@ -14,7 +14,6 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static junit.framework.TestCase.assertTrue; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; @@ -22,7 +21,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransaction public class ExpectNoValidPrivateContractEventsEmitted extends GetValidPrivateTransactionReceipt { public ExpectNoValidPrivateContractEventsEmitted( - final Eea eea, final EeaTransactions transactions) { + final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractValuesReturned.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractValuesReturned.java index cc5f277ae2..155737a9dd 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractValuesReturned.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectNoValidPrivateContractValuesReturned.java @@ -14,7 +14,6 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.junit.Assert.assertEquals; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; @@ -22,7 +21,7 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransaction public class ExpectNoValidPrivateContractValuesReturned extends GetValidPrivateTransactionReceipt { public ExpectNoValidPrivateContractValuesReturned( - final Eea eea, final EeaTransactions transactions) { + final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractDeployedReceipt.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractDeployedReceipt.java index 45f09d5144..b835e5de99 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractDeployedReceipt.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractDeployedReceipt.java @@ -15,7 +15,6 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; @@ -25,7 +24,7 @@ public class ExpectValidPrivateContractDeployedReceipt extends GetValidPrivateTr private final String contractAddress; public ExpectValidPrivateContractDeployedReceipt( - final String contractAddress, final Eea eea, final EeaTransactions transactions) { + final String contractAddress, final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); this.contractAddress = contractAddress; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractEventsEmitted.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractEventsEmitted.java index 3bd3cee895..0557230432 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractEventsEmitted.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractEventsEmitted.java @@ -14,7 +14,6 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.junit.Assert.assertEquals; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; @@ -28,7 +27,7 @@ public class ExpectValidPrivateContractEventsEmitted extends GetValidPrivateTran private final String eventValue; public ExpectValidPrivateContractEventsEmitted( - final String eventValue, final Eea eea, final EeaTransactions transactions) { + final String eventValue, final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); this.eventValue = eventValue; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractValuesReturned.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractValuesReturned.java index 34ad2fedf1..bb3866fb3d 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractValuesReturned.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateContractValuesReturned.java @@ -14,7 +14,6 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.junit.Assert.assertEquals; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; @@ -29,7 +28,7 @@ public class ExpectValidPrivateContractValuesReturned extends GetValidPrivateTra private final String returnValue; public ExpectValidPrivateContractValuesReturned( - final String returnValue, final Eea eea, final EeaTransactions transactions) { + final String returnValue, final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); this.returnValue = returnValue; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateTransactionReceipt.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateTransactionReceipt.java index a44783099a..b2b979b346 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateTransactionReceipt.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/ExpectValidPrivateTransactionReceipt.java @@ -15,14 +15,14 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.Assert.assertNotNull; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; public class ExpectValidPrivateTransactionReceipt extends GetValidPrivateTransactionReceipt { - public ExpectValidPrivateTransactionReceipt(final Eea eea, final EeaTransactions transactions) { + public ExpectValidPrivateTransactionReceipt( + final EeaConditions eea, final EeaTransactions transactions) { super(eea, transactions); } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/GetValidPrivateTransactionReceipt.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/GetValidPrivateTransactionReceipt.java index a9979867cd..c57a7fe6a9 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/GetValidPrivateTransactionReceipt.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eea/GetValidPrivateTransactionReceipt.java @@ -14,17 +14,16 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea; import static tech.pegasys.pantheon.tests.acceptance.dsl.WaitUtils.waitFor; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaRequestFactory.PrivateTransactionReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; public abstract class GetValidPrivateTransactionReceipt implements EeaCondition { - private Eea eea; + private EeaConditions eea; private EeaTransactions transactions; - GetValidPrivateTransactionReceipt(final Eea eea, final EeaTransactions transactions) { + GetValidPrivateTransactionReceipt(final EeaConditions eea, final EeaTransactions transactions) { this.eea = eea; this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eth.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eth/EthConditions.java similarity index 72% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eth.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eth/EthConditions.java index 40dcbff272..81fc2330a6 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eth.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eth/EthConditions.java @@ -10,22 +10,16 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthAccountsException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthGetTransactionReceiptIsAbsent; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthGetWorkException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthSendRawTransactionException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectSuccessfulEthGetTransactionReceipt; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.SanityCheckEthGetWorkValues; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions; -public class Eth { +public class EthConditions { private final EthTransactions transactions; - public Eth(final EthTransactions transactions) { + public EthConditions(final EthTransactions transactions) { this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft2/Ibft2Conditions.java similarity index 89% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft2/Ibft2Conditions.java index d43ad83fc8..ad625f327f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Ibft2.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ibft2/Ibft2Conditions.java @@ -10,15 +10,12 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft2; import static tech.pegasys.pantheon.tests.acceptance.dsl.transaction.clique.CliqueTransactions.LATEST; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft2.AwaitValidatorSetChange; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft2.ExpectProposals; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ibft2.ExpectValidators; import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.ibft2.Ibft2Transactions; @@ -33,11 +30,11 @@ import java.util.stream.Collectors; import com.google.common.collect.ImmutableMap; -public class Ibft2 { +public class Ibft2Conditions { private final Ibft2Transactions ibftTwo; - public Ibft2(final Ibft2Transactions ibftTwo) { + public Ibft2Conditions(final Ibft2Transactions ibftTwo) { this.ibftTwo = ibftTwo; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Login.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/login/LoginConditions.java similarity index 77% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Login.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/login/LoginConditions.java index b25e2cf951..f984c2da0f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Login.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/login/LoginConditions.java @@ -10,15 +10,12 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.login; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.login.AwaitLoginResponse; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.login.ExpectLoginSuccess; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.login.ExpectLoginUnauthorized; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.login.LoginTransaction; -public class Login { +public class LoginConditions { public Condition success(final String username, final String password) { return new ExpectLoginSuccess(username, password); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Net.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/NetConditions.java similarity index 68% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Net.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/NetConditions.java index 3450d2cf46..3ae2f2fe5e 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Net.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/net/NetConditions.java @@ -10,27 +10,18 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.net; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.AwaitNetPeerCount; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.AwaitNetPeerCountException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetServicesReturnsAllServicesAsActive; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetServicesReturnsOnlyJsonRpcActive; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetVersionConnectionException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetVersionConnectionExceptionWithCause; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetVersionIsNotBlank; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetVersionPermissionException; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.ExpectNetVersionPermissionJsonRpcUnauthorizedResponse; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.net.NetTransactions; import java.math.BigInteger; -public class Net { +public class NetConditions { private final NetTransactions transactions; - public Net(final NetTransactions transactions) { + public NetConditions(final NetTransactions transactions) { this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Perm.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/perm/PermissioningConditions.java similarity index 81% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Perm.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/perm/PermissioningConditions.java index cde8e07c6a..0a8d6705d7 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Perm.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/perm/PermissioningConditions.java @@ -10,20 +10,13 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm; import static java.util.Arrays.asList; import static java.util.stream.Collectors.toList; import tech.pegasys.pantheon.ethereum.permissioning.WhitelistPersistor.WHITELIST_TYPE; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.AddAccountsToWhitelistSuccessfully; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.AddNodeSuccess; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.GetExpectedAccountsWhitelist; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.GetNodesWhitelistPopulated; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.RemoveAccountsFromWhitelistSuccessfully; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.RemoveNodeSuccess; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.perm.WhiteListContainsKeyAndValue; import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; import tech.pegasys.pantheon.tests.acceptance.dsl.node.RunnableNode; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.perm.PermissioningTransactions; @@ -33,9 +26,9 @@ import java.nio.file.Path; import java.util.List; import java.util.stream.Stream; -public class Perm { +public class PermissioningConditions { - public Perm(final PermissioningTransactions transactions) { + public PermissioningConditions(final PermissioningTransactions transactions) { this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Web3.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/web3/Web3Conditions.java similarity index 81% rename from acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Web3.java rename to acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/web3/Web3Conditions.java index 8ef03daa8a..fd9d5d2f59 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Web3.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/web3/Web3Conditions.java @@ -10,17 +10,16 @@ * 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.jsonrpc; +package tech.pegasys.pantheon.tests.acceptance.dsl.condition.web3; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.condition.web3.ExpectWeb3Sha3Equals; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.web3.Web3Transactions; -public class Web3 { +public class Web3Conditions { private final Web3Transactions transactions; - public Web3(final Web3Transactions transactions) { + public Web3Conditions(final Web3Transactions transactions) { this.transactions = transactions; } 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 deleted file mode 100644 index 773988c8ac..0000000000 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Admin.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.jsonrpc; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; - -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.node.RunnableNode; -import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; - -import java.io.IOException; -import java.net.URI; - -import org.web3j.protocol.core.Response; - -public class Admin { - private Transaction addPeerTransaction(final URI enode) { - return (n) -> { - try { - final Response resp = n.admin().adminAddPeer(enode).send(); - assertThat(resp).isNotNull(); - assertThat(resp.hasError()).isFalse(); - return resp.getResult(); - } catch (final IOException e) { - throw new RuntimeException(e); - } - }; - } - - public Condition addPeer(final Node node) { - if (!(node instanceof RunnableNode)) { - fail("Admin.addPeer() needs a RunnableNode instance"); - } - - return (n) -> { - final Boolean result = n.execute(addPeerTransaction(((RunnableNode) node).enodeUrl())); - assertThat(result).isTrue(); - }; - } -} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/cluster/Cluster.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/cluster/Cluster.java index 7ca0012da7..1fb1735d17 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/cluster/Cluster.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/cluster/Cluster.java @@ -18,7 +18,7 @@ import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Net; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.net.NetConditions; import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNodeRunner; @@ -39,22 +39,22 @@ public class Cluster implements AutoCloseable { private final Map nodes = new HashMap<>(); private final PantheonNodeRunner pantheonNodeRunner; - private final Net net; + private final NetConditions net; private final ClusterConfiguration clusterConfiguration; private List originalNodes = emptyList(); private List bootnodes = emptyList(); - public Cluster(final Net net) { + public Cluster(final NetConditions net) { this(new ClusterConfigurationBuilder().build(), net, PantheonNodeRunner.instance()); } - public Cluster(final ClusterConfiguration clusterConfiguration, final Net net) { + public Cluster(final ClusterConfiguration clusterConfiguration, final NetConditions net) { this(clusterConfiguration, net, PantheonNodeRunner.instance()); } public Cluster( final ClusterConfiguration clusterConfiguration, - final Net net, + final NetConditions net, final PantheonNodeRunner pantheonNodeRunner) { this.clusterConfiguration = clusterConfiguration; this.net = net; diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java index 2e3f5e88dd..6ec4dcd04f 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivacyAcceptanceTestBase.java @@ -13,7 +13,7 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.privacy; import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.EeaConditions; import tech.pegasys.pantheon.tests.acceptance.dsl.node.configuration.privacy.PrivacyPantheonNodeFactory; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.PrivateTransactionBuilder; @@ -24,7 +24,7 @@ import org.junit.rules.TemporaryFolder; public class PrivacyAcceptanceTestBase extends AcceptanceTestBase { @ClassRule public static final TemporaryFolder privacy = new TemporaryFolder(); - protected final Eea eea; + protected final EeaConditions eea; protected final PrivateTransactions privateTransactions; protected final PrivateTransactionBuilder.Builder privateTransactionBuilder; protected final PrivateTransactionVerifier privateTransactionVerifier; @@ -34,7 +34,7 @@ public class PrivacyAcceptanceTestBase extends AcceptanceTestBase { final EeaTransactions eeaTransactions = new EeaTransactions(); privateTransactions = new PrivateTransactions(); - eea = new Eea(eeaTransactions); + eea = new EeaConditions(eeaTransactions); privateTransactionBuilder = PrivateTransactionBuilder.builder(); privateTransactionVerifier = new PrivateTransactionVerifier(eea, eeaTransactions); privacyPantheon = new PrivacyPantheonNodeFactory(); diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivateTransactionVerifier.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivateTransactionVerifier.java index 3bccad9cae..f9a5ea6c4e 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivateTransactionVerifier.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/privacy/PrivateTransactionVerifier.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.tests.acceptance.dsl.privacy; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.EeaConditions; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectNoPrivateContractDeployedReceipt; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectNoValidPrivateContractEventsEmitted; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectNoValidPrivateContractValuesReturned; @@ -19,15 +20,14 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectValidPriva import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectValidPrivateContractEventsEmitted; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectValidPrivateContractValuesReturned; import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.ExpectValidPrivateTransactionReceipt; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eea.EeaTransactions; public class PrivateTransactionVerifier { private final EeaTransactions transactions; - private final Eea eea; + private final EeaConditions eea; - public PrivateTransactionVerifier(final Eea eea, final EeaTransactions transactions) { + public PrivateTransactionVerifier(final EeaConditions eea, final EeaTransactions transactions) { this.eea = eea; this.transactions = transactions; } diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AddPeerTransaction.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AddPeerTransaction.java new file mode 100644 index 0000000000..58a7f50c0a --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AddPeerTransaction.java @@ -0,0 +1,44 @@ +/* + * 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.admin; + +import static org.assertj.core.api.Assertions.assertThat; + +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.NodeRequests; +import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction; + +import java.io.IOException; +import java.net.URI; + +import org.web3j.protocol.core.Response; + +public class AddPeerTransaction implements Transaction { + + private final URI peer; + + public AddPeerTransaction(final URI peer) { + this.peer = peer; + } + + @Override + public Boolean execute(final NodeRequests node) { + try { + final Response resp = node.admin().adminAddPeer(peer).send(); + assertThat(resp).isNotNull(); + assertThat(resp.hasError()).isFalse(); + return resp.getResult(); + } catch (final IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AdminTransactions.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AdminTransactions.java new file mode 100644 index 0000000000..e5e3a4cbd2 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/admin/AdminTransactions.java @@ -0,0 +1,22 @@ +/* + * 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.admin; + +import java.net.URI; + +public class AdminTransactions { + + public AddPeerTransaction addPeer(final URI peer) { + return new AddPeerTransaction(peer); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/EventEmitterHarness.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/EventEmitterHarness.java index 46e1b36871..e60ac27167 100644 --- a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/EventEmitterHarness.java +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/EventEmitterHarness.java @@ -17,7 +17,7 @@ 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.eea.EeaCondition; -import tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc.Eea; +import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eea.EeaConditions; import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivacyNet; import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivateTransactionVerifier; import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivateTransactions; @@ -46,7 +46,7 @@ public class EventEmitterHarness { private PrivacyNet privacyNet; private PrivateTransactions privateTransactions; private PrivateTransactionVerifier privateTransactionVerifier; - private Eea eea; + private EeaConditions eea; private Map contracts; @@ -55,7 +55,7 @@ public class EventEmitterHarness { final PrivacyNet privacyNet, final PrivateTransactions privateTransactions, final PrivateTransactionVerifier privateTransactionVerifier, - final Eea eea) { + final EeaConditions eea) { this.privateTransactionBuilder = privateTransactionBuilder; this.privacyNet = privacyNet;