Search in sources :

Example 11 with TopicDeleteTransaction

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

the class TopicDeleteIntegrationTest method canDeleteTopic.

@Test
@DisplayName("Can delete topic")
void canDeleteTopic() 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 12 with TopicDeleteTransaction

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

the class TopicInfoIntegrationTest method getCostBigMaxQueryTopicInfo.

@Test
@DisplayName("Can get cost for topic info query")
void getCostBigMaxQueryTopicInfo() 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);
    var infoQuery = new TopicInfoQuery().setTopicId(topicId).setMaxQueryPayment(new Hbar(1000));
    var cost = infoQuery.getCost(testEnv.client);
    assertThat(cost).isNotNull();
    var info = infoQuery.execute(testEnv.client);
    assertThat(info.topicMemo).isEqualTo("[e2e::TopicCreateTransaction]");
    new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicInfoQuery(com.hedera.hashgraph.sdk.TopicInfoQuery) Hbar(com.hedera.hashgraph.sdk.Hbar) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 13 with TopicDeleteTransaction

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

the class TopicInfoIntegrationTest method getCostSmallMaxQueryTopicInfo.

@Test
@DisplayName("Can get cost for topic info query")
void getCostSmallMaxQueryTopicInfo() 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);
    var infoQuery = new TopicInfoQuery().setTopicId(topicId).setMaxQueryPayment(Hbar.fromTinybars(1));
    assertThatExceptionOfType(MaxQueryPaymentExceededException.class).isThrownBy(() -> {
        infoQuery.execute(testEnv.client);
    });
    new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicInfoQuery(com.hedera.hashgraph.sdk.TopicInfoQuery) MaxQueryPaymentExceededException(com.hedera.hashgraph.sdk.MaxQueryPaymentExceededException) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 14 with TopicDeleteTransaction

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

the class TopicInfoIntegrationTest method getCostQueryTopicInfo.

@Test
@DisplayName("Can get cost for topic info query")
void getCostQueryTopicInfo() 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);
    var infoQuery = new TopicInfoQuery().setTopicId(topicId);
    var cost = infoQuery.getCost(testEnv.client);
    assertThat(cost).isNotNull();
    var info = infoQuery.execute(testEnv.client);
    assertThat(info.topicMemo).isEqualTo("[e2e::TopicCreateTransaction]");
    new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicInfoQuery(com.hedera.hashgraph.sdk.TopicInfoQuery) TopicDeleteTransaction(com.hedera.hashgraph.sdk.TopicDeleteTransaction) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 15 with TopicDeleteTransaction

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

the class TopicInfoIntegrationTest method canQueryTopicInfo.

@Test
@DisplayName("Can query topic info")
void canQueryTopicInfo() 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);
    var info = new TopicInfoQuery().setTopicId(topicId).execute(testEnv.client);
    assertThat(info.topicMemo).isEqualTo("[e2e::TopicCreateTransaction]");
    new TopicDeleteTransaction().setTopicId(topicId).execute(testEnv.client).getReceipt(testEnv.client);
    testEnv.close();
}
Also used : TopicCreateTransaction(com.hedera.hashgraph.sdk.TopicCreateTransaction) TopicInfoQuery(com.hedera.hashgraph.sdk.TopicInfoQuery) 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