use of org.eclipse.hono.kafka.test.KafkaMockConsumer in project hono by eclipse.
the class KafkaApplicationClientImplTest method setUp.
/**
* Sets up fixture.
*
* @param vertx The vert.x instance to use.
*/
@BeforeEach
void setUp(final Vertx vertx) {
final MockProducer<String, Buffer> mockProducer = KafkaClientUnitTestHelper.newMockProducer(true);
final CachingKafkaProducerFactory<String, Buffer> producerFactory = CachingKafkaProducerFactory.testFactory(vertx, (n, c) -> KafkaClientUnitTestHelper.newKafkaProducer(mockProducer));
tenantId = UUID.randomUUID().toString();
mockConsumer = new KafkaMockConsumer(OffsetResetStrategy.EARLIEST);
final CommonKafkaClientConfigProperties commonConfig = new CommonKafkaClientConfigProperties();
commonConfig.setCommonClientConfig(Map.of(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "kafka"));
final MessagingKafkaConsumerConfigProperties consumerConfig = new MessagingKafkaConsumerConfigProperties();
consumerConfig.setCommonClientConfig(commonConfig);
consumerConfig.setConsumerConfig(Map.of("client.id", "application-test-consumer"));
final MessagingKafkaProducerConfigProperties producerConfig = new MessagingKafkaProducerConfigProperties();
producerConfig.setCommonClientConfig(commonConfig);
producerConfig.setProducerConfig(Map.of("client.id", "application-test-sender"));
client = new KafkaApplicationClientImpl(vertx, consumerConfig, producerFactory, producerConfig);
client.setKafkaConsumerFactory(() -> mockConsumer);
}
use of org.eclipse.hono.kafka.test.KafkaMockConsumer in project hono by eclipse.
the class AsyncHandlingAutoCommitKafkaConsumerTest method setUp.
/**
* Sets up fixture.
*
* @param vertx The vert.x instance.
*/
@BeforeEach
public void setUp(final Vertx vertx) {
this.vertx = vertx;
mockConsumer = new KafkaMockConsumer(OffsetResetStrategy.LATEST);
consumerConfigProperties = new MessagingKafkaConsumerConfigProperties();
consumerConfigProperties.setConsumerConfig(Map.of(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "servers"));
}
use of org.eclipse.hono.kafka.test.KafkaMockConsumer in project hono by eclipse.
the class KafkaBasedNotificationReceiverTest method setUp.
/**
* Sets up fixture.
*
* @param vertx The vert.x instance to use.
*/
@BeforeEach
void setUp(final Vertx vertx) {
this.vertx = vertx;
mockConsumer = new KafkaMockConsumer(OffsetResetStrategy.EARLIEST);
consumerConfig = new NotificationKafkaConsumerConfigProperties();
consumerConfig.setConsumerConfig(Map.of(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, "dummy"));
}
use of org.eclipse.hono.kafka.test.KafkaMockConsumer in project hono by eclipse.
the class KafkaBasedCommandSenderTest method setUp.
/**
* Sets up fixture.
*
* @param vertx The vert.x instance to use.
*/
@BeforeEach
void setUp(final Vertx vertx) {
this.vertx = vertx;
consumerConfig = new MessagingKafkaConsumerConfigProperties();
mockConsumer = new KafkaMockConsumer(OffsetResetStrategy.LATEST);
producerConfig = new MessagingKafkaProducerConfigProperties();
producerConfig.setProducerConfig(Map.of("client.id", "application-test-sender"));
span = TracingMockSupport.mockSpan();
tracer = TracingMockSupport.mockTracer(span);
mockProducer = KafkaClientUnitTestHelper.newMockProducer(true);
final var producerFactory = CachingKafkaProducerFactory.testFactory(vertx, (n, c) -> KafkaClientUnitTestHelper.newKafkaProducer(mockProducer));
commandSender = new KafkaBasedCommandSender(vertx, consumerConfig, producerFactory, producerConfig, tracer);
tenantId = UUID.randomUUID().toString();
deviceId = UUID.randomUUID().toString();
}
use of org.eclipse.hono.kafka.test.KafkaMockConsumer in project hono by eclipse.
the class HonoKafkaConsumerTest method setUp.
/**
* Sets up fixture.
*
* @param vertx The vert.x instance.
*/
@BeforeEach
public void setUp(final Vertx vertx) {
this.vertx = vertx;
mockConsumer = new KafkaMockConsumer(OffsetResetStrategy.LATEST);
consumerConfigProperties = new MessagingKafkaConsumerConfigProperties();
consumerConfigProperties.setConsumerConfig(Map.of(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "servers"));
}
Aggregations