use of org.eclipse.hono.client.command.CommandHandlers in project hono by eclipse.
the class ProtonBasedInternalCommandConsumerTest method setUp.
/**
* Sets up fixture.
*/
@BeforeEach
public void setUp() {
final HonoConnection honoConnection = AmqpClientUnitTestHelper.mockHonoConnection(mock(Vertx.class));
final String adapterInstanceId = "adapterInstanceId";
commandHandlers = new CommandHandlers();
internalCommandConsumer = new ProtonBasedInternalCommandConsumer(honoConnection, adapterInstanceId, commandHandlers);
context = VertxMockSupport.mockContext(mock(Vertx.class));
}
use of org.eclipse.hono.client.command.CommandHandlers in project hono by eclipse.
the class KafkaBasedInternalCommandConsumerTest method setUp.
/**
* Sets up fixture.
*/
@BeforeEach
public void setUp() {
final Admin kafkaAdminClient = mock(Admin.class);
@SuppressWarnings("unchecked") final KafkaConsumer<String, Buffer> kafkaConsumer = mock(KafkaConsumer.class);
final String adapterInstanceId = "adapterInstanceId";
final Span span = TracingMockSupport.mockSpan();
final Tracer tracer = TracingMockSupport.mockTracer(span);
context = VertxMockSupport.mockContext(mock(Vertx.class));
commandHandlers = new CommandHandlers();
tenantClient = mock(TenantClient.class);
doAnswer(invocation -> {
final String tenantId = invocation.getArgument(0);
return Future.succeededFuture(TenantObject.from(tenantId));
}).when(tenantClient).get(anyString(), any());
commandResponseSender = mock(CommandResponseSender.class);
when(commandResponseSender.sendCommandResponse(any(TenantObject.class), any(RegistrationAssertion.class), any(CommandResponse.class), any())).thenReturn(Future.succeededFuture());
internalCommandConsumer = new KafkaBasedInternalCommandConsumer(context, kafkaAdminClient, kafkaConsumer, "testClientId", tenantClient, commandResponseSender, adapterInstanceId, commandHandlers, tracer);
}
Aggregations