use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.
the class CompositeTransactionGeneratorTest method distribution.
@Test
void distribution() {
properties.setWarmupPeriod(Duration.ZERO);
CompositeTransactionGenerator generator = supplier.get();
assertThat(generator.distribution.get().getPmf()).hasSize(properties.getScenarios().size()).extracting(Pair::getValue).containsExactly(0.75, 0.25);
Multiset<TransactionType> types = HashMultiset.create();
double seconds = 5;
for (int i = 0; i < totalTps * seconds; ) {
List<PublishRequest> requests = generator.next();
requests.stream().map(r -> r.getScenario().getProperties().getType()).forEach(types::add);
i += requests.size();
}
for (PublishScenarioProperties publishScenarioProperties : properties.getScenarios().values()) {
assertThat(types.count(publishScenarioProperties.getType())).isNotNegative().isNotZero().isCloseTo((int) (publishScenarioProperties.getTps() * seconds), withinPercentage(10));
}
}
use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.
the class ExpressionConverterImplTest method cached.
@Test
void cached() 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");
assertThat(expressionConverter.convert("${topic.foo}")).isEqualTo("0.0.100");
verify(transactionPublisher).publish(request.capture());
assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.
the class ExpressionConverterImplTest method schedule.
@Test
void schedule() throws InvalidProtocolBufferException {
TransactionType type = TransactionType.SCHEDULE_CREATE;
when(transactionPublisher.publish(any())).thenReturn(response(type, 100));
assertThat(expressionConverter.convert("${schedule.foo}")).isEqualTo("0.0.100");
verify(transactionPublisher).publish(request.capture());
assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.
the class ExpressionConverterImplTest method token.
@Test
void token() throws InvalidProtocolBufferException {
TransactionType type = TransactionType.TOKEN_CREATE;
when(transactionPublisher.publish(any())).thenReturn(response(type, 101));
assertThat(expressionConverter.convert("${token.foo}")).isEqualTo("0.0.101");
verify(transactionPublisher).publish(request.capture());
assertThat(request.getValue().getScenario().getProperties().getType()).isEqualTo(type);
}
use of com.hedera.mirror.monitor.publish.transaction.TransactionType in project hedera-mirror-node by hashgraph.
the class ExpressionConverterImplTest method error.
@Test
void error() throws InvalidProtocolBufferException {
TransactionType type = TransactionType.CONSENSUS_SUBMIT_MESSAGE;
when(transactionPublisher.publish(any())).thenReturn(response(type, 100));
assertThatThrownBy(() -> expressionConverter.convert("${topic.foo}")).isInstanceOf(RuntimeException.class);
}
Aggregations