use of com.hedera.hashgraph.sdk.TopicCreateTransaction 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();
}
use of com.hedera.hashgraph.sdk.TopicCreateTransaction 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();
}
use of com.hedera.hashgraph.sdk.TopicCreateTransaction 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();
}
use of com.hedera.hashgraph.sdk.TopicCreateTransaction 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();
}
use of com.hedera.hashgraph.sdk.TopicCreateTransaction 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();
}
Aggregations