Search in sources :

Example 6 with TransactionType

use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.

the class ExpressionConverterImplTest method account.

@Test
void account() throws InvalidProtocolBufferException {
    TransactionType type = TransactionType.ACCOUNT_CREATE;
    when(transactionPublisher.publish(any())).thenReturn(response(type, 100));
    assertThat(expressionConverter.convert("${account.foo}")).isEqualTo("0.0.100");
    verify(transactionPublisher).publish(request.capture());
    assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
Also used : TransactionType(com.hedera.mirror.monitor.publish.transaction.TransactionType) Test(org.junit.jupiter.api.Test)

Example 7 with TransactionType

use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.

the class ExpressionConverterImplTest method nft.

@Test
void nft() throws InvalidProtocolBufferException {
    TransactionType type = TransactionType.TOKEN_CREATE;
    when(transactionPublisher.publish(any())).thenReturn(response(type, 101));
    assertThat(expressionConverter.convert("${nft.foo}")).isEqualTo("0.0.101");
    verify(transactionPublisher).publish(request.capture());
    assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
Also used : TransactionType(com.hedera.mirror.monitor.publish.transaction.TransactionType) Test(org.junit.jupiter.api.Test)

Example 8 with TransactionType

use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.

the class ExpressionConverterImplTest method topic.

@Test
void topic() throws InvalidProtocolBufferException {
    TransactionType type = TransactionType.CONSENSUS_CREATE_TOPIC;
    when(transactionPublisher.publish(any())).thenReturn(response(type, 100));
    assertThat(expressionConverter.convert("${topic.foo}")).isEqualTo("0.0.100");
    verify(transactionPublisher).publish(request.capture());
    assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
Also used : TransactionType(com.hedera.mirror.monitor.publish.transaction.TransactionType) Test(org.junit.jupiter.api.Test)

Example 9 with TransactionType

use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.

the class ExpressionConverterImplTest method map.

@Test
void map() throws InvalidProtocolBufferException {
    Map<String, String> properties = Map.of("accountId", "0.0.100", "topicId", "${topic.fooBar_123}");
    TransactionType type = TransactionType.CONSENSUS_CREATE_TOPIC;
    when(transactionPublisher.publish(any())).thenReturn(response(type, 101));
    assertThat(expressionConverter.convert(properties)).hasSize(2).containsEntry("accountId", "0.0.100").containsEntry("topicId", "0.0.101");
    verify(transactionPublisher).publish(request.capture());
    assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
Also used : TransactionType(com.hedera.mirror.monitor.publish.transaction.TransactionType) Test(org.junit.jupiter.api.Test)

Example 10 with TransactionType

use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.

the class ExpressionConverterImplTest method errorPublishing.

@Test
void errorPublishing() throws InvalidProtocolBufferException {
    TransactionType type = TransactionType.CONSENSUS_CREATE_TOPIC;
    when(transactionPublisher.publish(any())).thenReturn(Mono.error(new TimeoutException("timeout"))).thenReturn(response(type, 100));
    assertThat(expressionConverter.convert("${topic.foo}")).isEqualTo("0.0.100");
}
Also used : TransactionType(com.hedera.mirror.monitor.publish.transaction.TransactionType) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.jupiter.api.Test)

Aggregations

TransactionType (com.hedera.mirror.monitor.publish.transaction.TransactionType)10 Test (org.junit.jupiter.api.Test)10 Stopwatch (com.google.common.base.Stopwatch)1 Suppliers (com.google.common.base.Suppliers)1 HashMultiset (com.google.common.collect.HashMultiset)1 Multiset (com.google.common.collect.Multiset)1 ScenarioStatus (com.hedera.mirror.monitor.ScenarioStatus)1 PublishProperties (com.hedera.mirror.monitor.publish.PublishProperties)1 PublishRequest (com.hedera.mirror.monitor.publish.PublishRequest)1 PublishScenario (com.hedera.mirror.monitor.publish.PublishScenario)1 PublishScenarioProperties (com.hedera.mirror.monitor.publish.PublishScenarioProperties)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 TimeoutException (java.util.concurrent.TimeoutException)1 Supplier (java.util.function.Supplier)1 Collectors (java.util.stream.Collectors)1 Pair (org.apache.commons.math3.util.Pair)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1