forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Acceptance test refactoring - DSL - Node interface (hyperledger#170)
* Conditions to remove the getters from Node interface Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
- Loading branch information
Showing
18 changed files
with
339 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/blockchain/Blockchain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* 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.blockchain; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.ExpectMinimumBlockNumber; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.EthTransactions; | ||
|
||
public class Blockchain { | ||
|
||
private final EthTransactions eth; | ||
|
||
public Blockchain(final EthTransactions eth) { | ||
this.eth = eth; | ||
} | ||
|
||
public Condition blockNumberMustBeLatest(final Node node) { | ||
return new ExpectMinimumBlockNumber(eth, node.execute(eth.blockNumber())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/ExpectMinimumBlockNumber.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.EthTransactions; | ||
|
||
import java.math.BigInteger; | ||
|
||
public class ExpectMinimumBlockNumber implements Condition { | ||
|
||
private final EthTransactions eth; | ||
private final BigInteger blockNumber; | ||
|
||
public ExpectMinimumBlockNumber(final EthTransactions eth, final BigInteger blockNumber) { | ||
this.blockNumber = blockNumber; | ||
this.eth = eth; | ||
} | ||
|
||
@Override | ||
public void verify(final Node node) { | ||
assertThat(node.execute(eth.blockNumber())).isGreaterThanOrEqualTo(blockNumber); | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/node/Eth.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.