Search in sources :

Example 1 with CredentialsClient

use of org.eclipse.hono.client.registry.CredentialsClient in project hono by eclipse.

the class ProtocolAdapterMockSupport method createCredentialsClientMock.

private CredentialsClient createCredentialsClientMock() {
    final CredentialsClient client = mock(CredentialsClient.class);
    when(client.start()).thenReturn(Future.succeededFuture());
    when(client.stop()).thenReturn(Future.succeededFuture());
    return client;
}
Also used : CredentialsClient(org.eclipse.hono.client.registry.CredentialsClient)

Example 2 with CredentialsClient

use of org.eclipse.hono.client.registry.CredentialsClient in project hono by eclipse.

the class AbstractProtocolAdapterBaseTest method setup.

/**
 * Sets up the fixture.
 */
@BeforeEach
public void setup() {
    tenantClient = mock(TenantClient.class);
    when(tenantClient.start()).thenReturn(Future.succeededFuture());
    registrationClient = mock(DeviceRegistrationClient.class);
    when(registrationClient.start()).thenReturn(Future.succeededFuture());
    credentialsClient = mock(CredentialsClient.class);
    when(credentialsClient.start()).thenReturn(Future.succeededFuture());
    amqpTelemetrySender = mockMessagingClient(TelemetrySender.class, MessagingType.amqp);
    when(amqpTelemetrySender.start()).thenReturn(Future.succeededFuture());
    kafkaTelemetrySender = mockMessagingClient(TelemetrySender.class, MessagingType.kafka);
    when(kafkaTelemetrySender.start()).thenReturn(Future.succeededFuture());
    amqpEventSender = mockMessagingClient(EventSender.class, MessagingType.amqp);
    when(amqpEventSender.start()).thenReturn(Future.succeededFuture());
    kafkaEventSender = mockMessagingClient(EventSender.class, MessagingType.kafka);
    when(kafkaEventSender.start()).thenReturn(Future.succeededFuture());
    commandConsumerFactory = mock(CommandConsumerFactory.class);
    when(commandConsumerFactory.start()).thenReturn(Future.succeededFuture());
    amqpCommandResponseSender = mockMessagingClient(CommandResponseSender.class, MessagingType.amqp);
    when(amqpCommandResponseSender.start()).thenReturn(Future.succeededFuture());
    kafkaCommandResponseSender = mockMessagingClient(CommandResponseSender.class, MessagingType.kafka);
    when(kafkaCommandResponseSender.start()).thenReturn(Future.succeededFuture());
    final var telemetrySenderProvider = new MessagingClientProvider<TelemetrySender>().setClient(amqpTelemetrySender).setClient(kafkaTelemetrySender);
    final var eventSenderProvider = new MessagingClientProvider<EventSender>().setClient(amqpEventSender).setClient(kafkaEventSender);
    final var commandResponseSenderProvider = new MessagingClientProvider<CommandResponseSender>().setClient(amqpCommandResponseSender).setClient(kafkaCommandResponseSender);
    messagingClientProviders = new MessagingClientProviders(telemetrySenderProvider, eventSenderProvider, commandResponseSenderProvider);
    commandRouterClient = mock(CommandRouterClient.class);
    when(commandRouterClient.start()).thenReturn(Future.succeededFuture());
    properties = new ProtocolAdapterProperties();
    adapter = newProtocolAdapter(properties, ADAPTER_NAME);
    setCollaborators(adapter);
    vertx = mock(Vertx.class);
    VertxMockSupport.runTimersImmediately(vertx);
    context = mock(Context.class);
    adapter.init(vertx, context);
}
Also used : Context(io.vertx.core.Context) VertxTestContext(io.vertx.junit5.VertxTestContext) TelemetryExecutionContext(org.eclipse.hono.util.TelemetryExecutionContext) SpanContext(io.opentracing.SpanContext) CommandRouterClient(org.eclipse.hono.client.command.CommandRouterClient) ProtocolAdapterProperties(org.eclipse.hono.config.ProtocolAdapterProperties) CommandConsumerFactory(org.eclipse.hono.client.command.CommandConsumerFactory) DeviceRegistrationClient(org.eclipse.hono.client.registry.DeviceRegistrationClient) Vertx(io.vertx.core.Vertx) CredentialsClient(org.eclipse.hono.client.registry.CredentialsClient) MessagingClientProvider(org.eclipse.hono.client.util.MessagingClientProvider) CommandResponseSender(org.eclipse.hono.client.command.CommandResponseSender) TenantClient(org.eclipse.hono.client.registry.TenantClient) EventSender(org.eclipse.hono.client.telemetry.EventSender) TelemetrySender(org.eclipse.hono.client.telemetry.TelemetrySender) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with CredentialsClient

use of org.eclipse.hono.client.registry.CredentialsClient in project hono by eclipse.

the class X509AuthProviderTest method setUp.

@BeforeAll
static void setUp() {
    final CredentialsClient credentialsClient = mock(CredentialsClient.class);
    provider = new X509AuthProvider(credentialsClient, NoopTracerFactory.create());
}
Also used : CredentialsClient(org.eclipse.hono.client.registry.CredentialsClient) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

CredentialsClient (org.eclipse.hono.client.registry.CredentialsClient)3 SpanContext (io.opentracing.SpanContext)1 Context (io.vertx.core.Context)1 Vertx (io.vertx.core.Vertx)1 VertxTestContext (io.vertx.junit5.VertxTestContext)1 CommandConsumerFactory (org.eclipse.hono.client.command.CommandConsumerFactory)1 CommandResponseSender (org.eclipse.hono.client.command.CommandResponseSender)1 CommandRouterClient (org.eclipse.hono.client.command.CommandRouterClient)1 DeviceRegistrationClient (org.eclipse.hono.client.registry.DeviceRegistrationClient)1 TenantClient (org.eclipse.hono.client.registry.TenantClient)1 EventSender (org.eclipse.hono.client.telemetry.EventSender)1 TelemetrySender (org.eclipse.hono.client.telemetry.TelemetrySender)1 MessagingClientProvider (org.eclipse.hono.client.util.MessagingClientProvider)1 ProtocolAdapterProperties (org.eclipse.hono.config.ProtocolAdapterProperties)1 TelemetryExecutionContext (org.eclipse.hono.util.TelemetryExecutionContext)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1