Search in sources :

Example 1 with KafkaMockConsumer

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);
}
Also used : Buffer(io.vertx.core.buffer.Buffer) MessagingKafkaConsumerConfigProperties(org.eclipse.hono.client.kafka.consumer.MessagingKafkaConsumerConfigProperties) MessagingKafkaProducerConfigProperties(org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties) CommonKafkaClientConfigProperties(org.eclipse.hono.client.kafka.CommonKafkaClientConfigProperties) KafkaMockConsumer(org.eclipse.hono.kafka.test.KafkaMockConsumer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with KafkaMockConsumer

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"));
}
Also used : KafkaMockConsumer(org.eclipse.hono.kafka.test.KafkaMockConsumer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with KafkaMockConsumer

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"));
}
Also used : KafkaMockConsumer(org.eclipse.hono.kafka.test.KafkaMockConsumer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 4 with KafkaMockConsumer

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();
}
Also used : MessagingKafkaConsumerConfigProperties(org.eclipse.hono.client.kafka.consumer.MessagingKafkaConsumerConfigProperties) MessagingKafkaProducerConfigProperties(org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties) KafkaMockConsumer(org.eclipse.hono.kafka.test.KafkaMockConsumer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with KafkaMockConsumer

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"));
}
Also used : KafkaMockConsumer(org.eclipse.hono.kafka.test.KafkaMockConsumer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

KafkaMockConsumer (org.eclipse.hono.kafka.test.KafkaMockConsumer)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 MessagingKafkaConsumerConfigProperties (org.eclipse.hono.client.kafka.consumer.MessagingKafkaConsumerConfigProperties)2 MessagingKafkaProducerConfigProperties (org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties)2 Buffer (io.vertx.core.buffer.Buffer)1 CommonKafkaClientConfigProperties (org.eclipse.hono.client.kafka.CommonKafkaClientConfigProperties)1