Search in sources :

Example 41 with FileDeleteTransaction

use of com.hedera.hashgraph.sdk.FileDeleteTransaction in project hedera-sdk-java by hashgraph.

the class FileInfoIntegrationTest method canQueryFileInfo.

@Test
@DisplayName("Can query file info")
void canQueryFileInfo() throws Exception {
    var testEnv = new IntegrationTestEnv(1);
    var response = new FileCreateTransaction().setKeys(testEnv.operatorKey).setContents("[e2e::FileCreateTransaction]").execute(testEnv.client);
    var fileId = Objects.requireNonNull(response.getReceipt(testEnv.client).fileId);
    var info = new FileInfoQuery().setFileId(fileId).execute(testEnv.client);
    assertThat(info.fileId).isEqualTo(fileId);
    assertThat(info.size).isEqualTo(28);
    assertThat(info.isDeleted).isFalse();
    assertThat(info.keys).isNotNull();
    assertThat(info.keys.getThreshold()).isNull();
    assertThat(info.keys).isEqualTo(KeyList.of(testEnv.operatorKey));
    new FileDeleteTransaction().setFileId(fileId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : FileCreateTransaction(com.hedera.hashgraph.sdk.FileCreateTransaction) FileInfoQuery(com.hedera.hashgraph.sdk.FileInfoQuery) FileDeleteTransaction(com.hedera.hashgraph.sdk.FileDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

FileDeleteTransaction (com.hedera.hashgraph.sdk.FileDeleteTransaction)41 FileCreateTransaction (com.hedera.hashgraph.sdk.FileCreateTransaction)40 DisplayName (org.junit.jupiter.api.DisplayName)39 Test (org.junit.jupiter.api.Test)39 ContractCreateTransaction (com.hedera.hashgraph.sdk.ContractCreateTransaction)23 ContractFunctionParameters (com.hedera.hashgraph.sdk.ContractFunctionParameters)22 ContractDeleteTransaction (com.hedera.hashgraph.sdk.ContractDeleteTransaction)21 Var (com.google.errorprone.annotations.Var)20 FileInfoQuery (com.hedera.hashgraph.sdk.FileInfoQuery)12 Hbar (com.hedera.hashgraph.sdk.Hbar)11 ContractCallQuery (com.hedera.hashgraph.sdk.ContractCallQuery)7 ContractInfoQuery (com.hedera.hashgraph.sdk.ContractInfoQuery)7 FileContentsQuery (com.hedera.hashgraph.sdk.FileContentsQuery)7 MaxQueryPaymentExceededException (com.hedera.hashgraph.sdk.MaxQueryPaymentExceededException)5 ContractByteCodeQuery (com.hedera.hashgraph.sdk.ContractByteCodeQuery)4 ContractExecuteTransaction (com.hedera.hashgraph.sdk.ContractExecuteTransaction)3 FileAppendTransaction (com.hedera.hashgraph.sdk.FileAppendTransaction)3 Client (com.hedera.hashgraph.sdk.Client)1 ContractUpdateTransaction (com.hedera.hashgraph.sdk.ContractUpdateTransaction)1 FileId (com.hedera.hashgraph.sdk.FileId)1