JDK 17 is required. The Temurin builds of Eclipse Adoptium are strongly recommended.
Note that the below
./gradlew
commands should be run from the root of the project.
./gradlew assemble
./gradlew :sdk:test
The tests are only executed if the configuration is provided. That's why we need to pass the configuration file at the beginning of the command.
OPERATOR_ID
, OPERATOR_KEY
and HEDERA_NETWORK
must be passed as Gradle properties (-P
parameters).
HEDERA_NETWORK
can be set to localhost
, testnet
or previewnet
.
./gradlew :sdk:testIntegration -POPERATOR_ID="<shard.realm.num>" -POPERATOR_KEY="<PrivateKey>" -PHEDERA_NETWORK="<network>"
./gradlew :sdk:testIntegration -PCONFIG_FILE="<ConfigurationFilePath>"
An example configuration file can be found in the repo here: sdk/src/test/resources/client-config-with-operator.json
Running against the local network
The format of the configuration file should be as follows:
{
"network": {
"0.0.3": "127.0.0.1:50211"
},
"mirrorNetwork": [
"127.0.0.1:5600"
],
"operator": {
"accountId": "0.0.1022",
"privateKey": "0xa608e2130a0a3cb34f86e757303c862bee353d9ab77ba4387ec084f881d420d4"
}
}
Running against remote networks
The format of the configuration file should be as follows:
{
"network": "testnet",
"operator": {
"accountId": "0.0.7",
"privateKey": "d5d37..."
}
}
HEDERA_NETWORK
can be set to testnet
, previewnet
or mainnet
.
Running test class:
./gradlew :sdk:testIntegration -POPERATOR_ID="<shard.realm.num>" -POPERATOR_KEY="<PrivateKey>" -PHEDERA_NETWORK="testnet" --tests "<TestClass>"
Running test function:
./gradlew :sdk:testIntegration -POPERATOR_ID="<shard.realm.num>" -POPERATOR_KEY="<PrivateKey>" -PHEDERA_NETWORK="testnet" --tests "<TestClass.functionName>"
- Create a new Gradle run configuration (easiest way is to run test class or individual test function from the IDE).
- Update "Run" configuration to pass the required Gradle properties (
OPERATOR_ID
,OPERATOR_KEY
andHEDERA_NETWORK
).
To execute the tasks below, you need to install the tool from this link: https://taskfile.dev/ (these tasks are from the file Taskfile.yml, which is located in the root of the repository). Once installed, you can run the commands as shown below.
Note that the below
task
commands should be run from the root of the project.
task update:snapshots
task update:proto
Update all address books:
task update:addressbooks
Update address books only for a mainnet:
task update:addressbooks:mainnet
Update address books only for a testnet:
task update:addressbooks:testnet
Update address books only for a previewnet:
task update:addressbooks:previewnet