Search in sources :

Example 1 with SystemDeleteTransaction

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

the class SystemIntegrationTest method allSystemTransactionsAreNotSupported.

@Test
@DisplayName("All system transactions are not supported")
void allSystemTransactionsAreNotSupported() throws Exception {
    var testEnv = new IntegrationTestEnv(1);
    var fileId = Objects.requireNonNull(new FileCreateTransaction().setContents(SMART_CONTRACT_BYTECODE).execute(testEnv.client).getReceipt(testEnv.client).fileId);
    var contractId = Objects.requireNonNull(new ContractCreateTransaction().setAdminKey(testEnv.operatorKey).setGas(100000).setConstructorParameters(new ContractFunctionParameters().addString("Hello from Hedera.")).setBytecodeFileId(fileId).setContractMemo("[e2e::ContractCreateTransaction]").execute(testEnv.client).getReceipt(testEnv.client).contractId);
    assertThatExceptionOfType(PrecheckStatusException.class).isThrownBy(() -> {
        new SystemDeleteTransaction().setContractId(contractId).setExpirationTime(Instant.now()).execute(testEnv.client);
    }).withMessageContaining(Status.NOT_SUPPORTED.toString());
    assertThatExceptionOfType(PrecheckStatusException.class).isThrownBy(() -> {
        new SystemDeleteTransaction().setFileId(fileId).setExpirationTime(Instant.now()).execute(testEnv.client);
    }).withMessageContaining(Status.NOT_SUPPORTED.toString());
    assertThatExceptionOfType(PrecheckStatusException.class).isThrownBy(() -> {
        new SystemUndeleteTransaction().setContractId(contractId).execute(testEnv.client);
    }).withMessageContaining(Status.NOT_SUPPORTED.toString());
    assertThatExceptionOfType(PrecheckStatusException.class).isThrownBy(() -> {
        new SystemUndeleteTransaction().setFileId(fileId).execute(testEnv.client);
    }).withMessageContaining(Status.NOT_SUPPORTED.toString());
    testEnv.close();
}
Also used : FileCreateTransaction(com.hedera.hashgraph.sdk.FileCreateTransaction) SystemDeleteTransaction(com.hedera.hashgraph.sdk.SystemDeleteTransaction) ContractFunctionParameters(com.hedera.hashgraph.sdk.ContractFunctionParameters) ContractCreateTransaction(com.hedera.hashgraph.sdk.ContractCreateTransaction) SystemUndeleteTransaction(com.hedera.hashgraph.sdk.SystemUndeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

ContractCreateTransaction (com.hedera.hashgraph.sdk.ContractCreateTransaction)1 ContractFunctionParameters (com.hedera.hashgraph.sdk.ContractFunctionParameters)1 FileCreateTransaction (com.hedera.hashgraph.sdk.FileCreateTransaction)1 SystemDeleteTransaction (com.hedera.hashgraph.sdk.SystemDeleteTransaction)1 SystemUndeleteTransaction (com.hedera.hashgraph.sdk.SystemUndeleteTransaction)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1