Search in sources :

Example 6 with TopicDeleteTransaction

use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.

the class TopicClient method deleteTopic.

public NetworkTransactionResponse deleteTopic(TopicId topicId) {
    TopicDeleteTransaction consensusTopicDeleteTransaction = new TopicDeleteTransaction().setMaxTransactionFee(sdkClient.getMaxTransactionFee()).setTopicId(topicId).setTransactionMemo(getMemo("Delete Topic"));
    NetworkTransactionResponse networkTransactionResponse = executeTransactionAndRetrieveReceipt(consensusTopicDeleteTransaction);
    log.debug("Deleted topic : '{}'.", topicId);
    return networkTransactionResponse;
}
Also used : NetworkTransactionResponse(com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction)

Example 7 with TopicDeleteTransaction

use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.

the class ConsensusDeleteTopicTransactionSupplierTest method createWithMinimumData.

@Test
void createWithMinimumData() {
    ConsensusDeleteTopicTransactionSupplier consensusDeleteTopicTransactionSupplier = new ConsensusDeleteTopicTransactionSupplier();
    consensusDeleteTopicTransactionSupplier.setTopicId(TOPIC_ID.toString());
    TopicDeleteTransaction actual = consensusDeleteTopicTransactionSupplier.get();
    assertThat(actual).returns(MAX_TRANSACTION_FEE_HBAR, TopicDeleteTransaction::getMaxTransactionFee).returns(TOPIC_ID, TopicDeleteTransaction::getTopicId);
}
Also used : TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) AbstractTransactionSupplierTest(com.hedera.mirror.monitor.publish.transaction.AbstractTransactionSupplierTest)

Example 8 with TopicDeleteTransaction

use of com.hedera.hashgraph.sdk.TopicDeleteTransaction in project hedera-mirror-node by hashgraph.

the class ConsensusDeleteTopicTransactionSupplierTest method createWithCustomData.

@Test
void createWithCustomData() {
    ConsensusDeleteTopicTransactionSupplier consensusDeleteTopicTransactionSupplier = new ConsensusDeleteTopicTransactionSupplier();
    consensusDeleteTopicTransactionSupplier.setMaxTransactionFee(1);
    consensusDeleteTopicTransactionSupplier.setTopicId(TOPIC_ID.toString());
    TopicDeleteTransaction actual = consensusDeleteTopicTransactionSupplier.get();
    assertThat(actual).returns(ONE_TINYBAR, TopicDeleteTransaction::getMaxTransactionFee).returns(TOPIC_ID, TopicDeleteTransaction::getTopicId);
}
Also used : TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) AbstractTransactionSupplierTest(com.hedera.mirror.monitor.publish.transaction.AbstractTransactionSupplierTest)

Example 9 with TopicDeleteTransaction

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

the class TopicCreateIntegrationTest method canCreateTopic.

@Test
@DisplayName("Can create topic")
void canCreateTopic() throws Exception {
    var testEnv = new IntegrationTestEnv(1);
    var response = new TopicCreateTransaction().setAdminKey(testEnv.operatorKey).setTopicMemo("[e2e::TopicCreateTransaction]").execute(testEnv.client);
    var topicId = Objects.requireNonNull(response.getReceipt(testEnv.client).topicId);
    new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 10 with TopicDeleteTransaction

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

the class TopicDeleteIntegrationTest method cannotDeleteImmutableTopic.

@Test
@DisplayName("Cannot delete immutable topic")
void cannotDeleteImmutableTopic() throws Exception {
    var testEnv = new IntegrationTestEnv(1);
    var response = new TopicCreateTransaction().execute(testEnv.client);
    var topicId = Objects.requireNonNull(response.getReceipt(testEnv.client).topicId);
    assertThatExceptionOfType(ReceiptStatusException.class).isThrownBy(() -> {
        new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    }).withMessageContaining(Status.UNAUTHORIZED.toString());
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

TopicDeleteTransaction (com.hedera.hashgraph.sdk.TopicDeleteTransaction)18 Test (org.junit.jupiter.api.Test)17 TopicCreateTransaction (com.hedera.hashgraph.sdk.TopicCreateTransaction)15 DisplayName (org.junit.jupiter.api.DisplayName)15 TopicInfoQuery (com.hedera.hashgraph.sdk.TopicInfoQuery)10 TopicMessageSubmitTransaction (com.hedera.hashgraph.sdk.TopicMessageSubmitTransaction)6 Var (com.google.errorprone.annotations.Var)2 TopicMessageQuery (com.hedera.hashgraph.sdk.TopicMessageQuery)2 AbstractTransactionSupplierTest (com.hedera.mirror.monitor.publish.transaction.AbstractTransactionSupplierTest)2 Hbar (com.hedera.hashgraph.sdk.Hbar)1 MaxQueryPaymentExceededException (com.hedera.hashgraph.sdk.MaxQueryPaymentExceededException)1 TopicUpdateTransaction (com.hedera.hashgraph.sdk.TopicUpdateTransaction)1 NetworkTransactionResponse (com.hedera.mirror.test.e2e.acceptance.response.NetworkTransactionResponse)1