use of org.eclipse.hono.client.command.kafka.KafkaBasedCommandContext in project hono by eclipse.
the class KafkaCommandProcessingQueueTest method getTestCommandContext.
@SuppressWarnings("unchecked")
private KafkaBasedCommandContext getTestCommandContext(final int offset) {
final String deviceId = "deviceId";
final List<KafkaHeader> headers = new ArrayList<>(List.of(KafkaRecordHelper.createDeviceIdHeader(deviceId), KafkaRecordHelper.createSubjectHeader("subject_" + offset), KafkaRecordHelper.createCorrelationIdHeader("correlationId")));
final KafkaConsumerRecord<String, Buffer> consumerRecord = mock(KafkaConsumerRecord.class);
when(consumerRecord.headers()).thenReturn(headers);
when(consumerRecord.topic()).thenReturn(topic);
when(consumerRecord.key()).thenReturn(deviceId);
when(consumerRecord.offset()).thenReturn((long) offset);
when(consumerRecord.partition()).thenReturn(0);
final KafkaBasedCommand cmd = KafkaBasedCommand.from(consumerRecord);
return new KafkaBasedCommandContext(cmd, mock(CommandResponseSender.class), mock(Span.class)) {
@Override
public String toString() {
return "Command " + offset;
}
};
}
Aggregations