Search in sources :

Example 81 with Device

use of org.eclipse.hono.auth.Device in project hono by eclipse.

the class CommandResponseResourceTest method testUploadCommandResponseWaitsForAcceptedOutcome.

/**
 * Verifies that the adapter waits for a command response being successfully sent
 * downstream before responding with a 2.04 status to the device.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testUploadCommandResponseWaitsForAcceptedOutcome(final VertxTestContext ctx) {
    // GIVEN an adapter with a downstream application attached
    givenAnAdapter(properties);
    final var resource = givenAResource(adapter);
    final Promise<Void> outcome = Promise.promise();
    final CommandResponseSender sender = givenACommandResponseSenderForAnyTenant(outcome);
    // WHEN a device publishes an command response
    final String reqId = Commands.encodeRequestIdParameters("correlation", "replyToId", "device", MessagingType.amqp);
    final Buffer payload = Buffer.buffer("some payload");
    final OptionSet options = new OptionSet();
    options.addUriPath(CommandConstants.COMMAND_RESPONSE_ENDPOINT).addUriPath(reqId);
    options.addUriQuery(String.format("%s=%d", Constants.HEADER_COMMAND_RESPONSE_STATUS, 200));
    options.setContentFormat(MediaTypeRegistry.TEXT_PLAIN);
    final CoapExchange coapExchange = newCoapExchange(payload, Type.CON, options);
    final Device authenticatedDevice = new Device("tenant", "device");
    final CoapContext context = CoapContext.fromRequest(coapExchange, authenticatedDevice, authenticatedDevice, "device", span);
    final Future<Void> result = resource.uploadCommandResponseMessage(context);
    // THEN the command response is being forwarded downstream
    verify(sender).sendCommandResponse(any(TenantObject.class), any(RegistrationAssertion.class), any(CommandResponse.class), any(SpanContext.class));
    // but the device does not get a response
    verify(coapExchange, never()).respond(any(Response.class));
    // and the response has not been reported as forwarded
    verify(metrics, never()).reportCommand(eq(Direction.RESPONSE), eq("tenant"), any(), eq(ProcessingOutcome.FORWARDED), anyInt(), any());
    // until the message has been accepted
    outcome.complete();
    result.onComplete(ctx.succeeding(code -> {
        ctx.verify(() -> {
            verify(coapExchange).respond(argThat((Response res) -> res.getCode() == ResponseCode.CHANGED));
            verify(metrics).reportCommand(eq(Direction.RESPONSE), eq("tenant"), any(), eq(ProcessingOutcome.FORWARDED), eq(payload.length()), any());
        });
        ctx.completeNow();
    }));
}
Also used : Buffer(io.vertx.core.buffer.Buffer) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) HttpURLConnection(java.net.HttpURLConnection) ResponseCode(org.eclipse.californium.core.coap.CoAP.ResponseCode) VertxTestContext(io.vertx.junit5.VertxTestContext) CoapExchange(org.eclipse.californium.core.server.resources.CoapExchange) Response(org.eclipse.californium.core.coap.Response) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) ClientErrorException(org.eclipse.hono.client.ClientErrorException) CommandResponseSender(org.eclipse.hono.client.command.CommandResponseSender) Commands(org.eclipse.hono.client.command.Commands) Constants(org.eclipse.hono.util.Constants) Timeout(io.vertx.junit5.Timeout) ProcessingOutcome(org.eclipse.hono.service.metric.MetricsTags.ProcessingOutcome) MessagingType(org.eclipse.hono.util.MessagingType) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) MediaTypeRegistry(org.eclipse.californium.core.coap.MediaTypeRegistry) CommandConstants(org.eclipse.hono.util.CommandConstants) ArgumentMatchers.anyInt(org.mockito.ArgumentMatchers.anyInt) Type(org.eclipse.californium.core.coap.CoAP.Type) Direction(org.eclipse.hono.service.metric.MetricsTags.Direction) NoopTracerFactory(io.opentracing.noop.NoopTracerFactory) Promise(io.vertx.core.Promise) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Device(org.eclipse.hono.auth.Device) Mockito.verify(org.mockito.Mockito.verify) CommandResponse(org.eclipse.hono.client.command.CommandResponse) TenantObject(org.eclipse.hono.util.TenantObject) SpanContext(io.opentracing.SpanContext) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Mockito.never(org.mockito.Mockito.never) Buffer(io.vertx.core.buffer.Buffer) OptionSet(org.eclipse.californium.core.coap.OptionSet) SpanContext(io.opentracing.SpanContext) Device(org.eclipse.hono.auth.Device) CommandResponse(org.eclipse.hono.client.command.CommandResponse) Response(org.eclipse.californium.core.coap.Response) CommandResponse(org.eclipse.hono.client.command.CommandResponse) TenantObject(org.eclipse.hono.util.TenantObject) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) CommandResponseSender(org.eclipse.hono.client.command.CommandResponseSender) OptionSet(org.eclipse.californium.core.coap.OptionSet) CoapExchange(org.eclipse.californium.core.server.resources.CoapExchange) Test(org.junit.jupiter.api.Test)

Example 82 with Device

use of org.eclipse.hono.auth.Device in project hono by eclipse.

the class DeviceRegistryBasedPskStore method loadCredentialsForDevice.

/**
 * Load credentials for an identity used by a device in a PSK based DTLS handshake.
 *
 * @param cid the connection id to report the result.
 * @param identity the psk identity of the device.
 */
private void loadCredentialsForDevice(final ConnectionId cid, final PskPublicInformation identity) {
    final String publicInfo = identity.getPublicInfoAsString();
    LOG.debug("getting PSK secret for identity [{}]", publicInfo);
    final Span span = tracer.buildSpan("look up pre-shared key").withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_CLIENT).withTag(Tags.COMPONENT.getKey(), adapter.getTypeName()).start();
    final PreSharedKeyDeviceIdentity handshakeIdentity = getHandshakeIdentity(publicInfo, span);
    if (handshakeIdentity == null) {
        TracingHelper.logError(span, "could not determine auth-id from PSK identity");
        span.finish();
        return;
    }
    TracingHelper.TAG_TENANT_ID.set(span, handshakeIdentity.getTenantId());
    TracingHelper.TAG_AUTH_ID.set(span, handshakeIdentity.getAuthId());
    applyTraceSamplingPriority(handshakeIdentity, span).compose(v -> adapter.getCredentialsClient().get(handshakeIdentity.getTenantId(), handshakeIdentity.getType(), handshakeIdentity.getAuthId(), new JsonObject(), span.context())).map(credentials -> {
        final String deviceId = credentials.getDeviceId();
        TracingHelper.TAG_DEVICE_ID.set(span, deviceId);
        final SecretKey key = getCandidateKey(credentials);
        if (key == null) {
            TracingHelper.logError(span, "PSK credentials for device do not contain proper key");
            return new PskSecretResult(cid, identity, null, null);
        } else {
            span.log("successfully retrieved PSK for device");
            // set AdditionalInfo as customArgument here
            final AdditionalInfo info = DeviceInfoSupplier.createDeviceInfo(new Device(handshakeIdentity.getTenantId(), credentials.getDeviceId()), handshakeIdentity.getAuthId());
            return new PskSecretResult(cid, identity, key, info);
        }
    }).otherwise(t -> {
        TracingHelper.logError(span, "could not retrieve PSK credentials for device", t);
        LOG.debug("error retrieving credentials for PSK identity [{}]", publicInfo, t);
        return new PskSecretResult(cid, identity, null, null);
    }).onSuccess(result -> {
        span.finish();
        californiumResultHandler.apply(result);
    });
}
Also used : Arrays(java.util.Arrays) AdvancedPskStore(org.eclipse.californium.scandium.dtls.pskstore.AdvancedPskStore) LoggerFactory(org.slf4j.LoggerFactory) PskSecretResult(org.eclipse.californium.scandium.dtls.PskSecretResult) Tags(io.opentracing.tag.Tags) SecretUtil(org.eclipse.californium.scandium.util.SecretUtil) PskPublicInformation(org.eclipse.californium.scandium.dtls.PskPublicInformation) DeviceCredentials(org.eclipse.hono.adapter.auth.device.DeviceCredentials) ServerNames(org.eclipse.californium.scandium.util.ServerNames) JsonObject(io.vertx.core.json.JsonObject) TracingHelper(org.eclipse.hono.tracing.TracingHelper) PskSecretResultHandler(org.eclipse.californium.scandium.dtls.PskSecretResultHandler) Logger(org.slf4j.Logger) Tracer(io.opentracing.Tracer) AdditionalInfo(org.eclipse.californium.elements.auth.AdditionalInfo) InetSocketAddress(java.net.InetSocketAddress) Future(io.vertx.core.Future) Device(org.eclipse.hono.auth.Device) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) Objects(java.util.Objects) TenantTraceSamplingHelper(org.eclipse.hono.tracing.TenantTraceSamplingHelper) ConnectionId(org.eclipse.californium.scandium.dtls.ConnectionId) Span(io.opentracing.Span) SecretKey(javax.crypto.SecretKey) CredentialsObject(org.eclipse.hono.util.CredentialsObject) AdditionalInfo(org.eclipse.californium.elements.auth.AdditionalInfo) SecretKey(javax.crypto.SecretKey) PskSecretResult(org.eclipse.californium.scandium.dtls.PskSecretResult) Device(org.eclipse.hono.auth.Device) JsonObject(io.vertx.core.json.JsonObject) Span(io.opentracing.Span)

Example 83 with Device

use of org.eclipse.hono.auth.Device in project hono by eclipse.

the class TracingSupportingHonoResource method getAuthenticatedDevice.

/**
 * Gets an authenticated device's identity for a CoAP request.
 *
 * @param exchange The CoAP exchange with the authenticated device's principal.
 * @return A future indicating the outcome of the operation.
 *         The future will be succeeded if the authenticated device can be determined from the CoAP exchange,
 *         otherwise the future will be failed with a {@link ClientErrorException}.
 */
public static Future<Device> getAuthenticatedDevice(final CoapExchange exchange) {
    final Promise<Device> result = Promise.promise();
    final Principal peerIdentity = exchange.advanced().getRequest().getSourceContext().getPeerIdentity();
    if (peerIdentity instanceof ExtensiblePrincipal) {
        final ExtensiblePrincipal<?> extPrincipal = (ExtensiblePrincipal<?>) peerIdentity;
        final Device authenticatedDevice = extPrincipal.getExtendedInfo().get(DeviceInfoSupplier.EXT_INFO_KEY_HONO_DEVICE, Device.class);
        if (authenticatedDevice != null) {
            result.complete(authenticatedDevice);
        } else {
            result.fail(new ClientErrorException(HttpURLConnection.HTTP_UNAUTHORIZED, "DTLS session does not contain authenticated Device"));
        }
    } else {
        result.fail(new ClientErrorException(HttpURLConnection.HTTP_UNAUTHORIZED, "DTLS session does not contain ExtensiblePrincipal"));
    }
    return result.future();
}
Also used : ExtensiblePrincipal(org.eclipse.californium.elements.auth.ExtensiblePrincipal) Device(org.eclipse.hono.auth.Device) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Principal(java.security.Principal) ExtensiblePrincipal(org.eclipse.californium.elements.auth.ExtensiblePrincipal)

Example 84 with Device

use of org.eclipse.hono.auth.Device in project hono by eclipse.

the class VertxBasedAmqpProtocolAdapterTest method testUploadCommandResponseSucceeds.

/**
 * Verify that the AMQP adapter forwards command responses downstream.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testUploadCommandResponseSucceeds(final VertxTestContext ctx) {
    // GIVEN an AMQP adapter
    givenAnAdapter(properties);
    final CommandResponseSender responseSender = givenACommandResponseSenderForAnyTenant();
    when(responseSender.sendCommandResponse(any(TenantObject.class), any(RegistrationAssertion.class), any(CommandResponse.class), (SpanContext) any())).thenReturn(Future.succeededFuture());
    // which is enabled for the test tenant
    final TenantObject tenantObject = givenAConfiguredTenant(TEST_TENANT_ID, true);
    // WHEN an unauthenticated device publishes a command response
    final String replyToAddress = String.format("%s/%s/%s", getCommandResponseEndpoint(), TEST_TENANT_ID, Commands.getDeviceFacingReplyToId("test-reply-id", TEST_DEVICE, MessagingType.amqp));
    final Map<String, Object> propertyMap = new HashMap<>();
    propertyMap.put(MessageHelper.APP_PROPERTY_STATUS, 200);
    final ApplicationProperties props = new ApplicationProperties(propertyMap);
    final Buffer payload = Buffer.buffer("some payload");
    final Message message = getFakeMessage(replyToAddress, payload);
    message.setCorrelationId("correlation-id");
    message.setApplicationProperties(props);
    final ProtonDelivery delivery = mock(ProtonDelivery.class);
    adapter.onMessageReceived(AmqpContext.fromMessage(delivery, message, span, null)).onComplete(ctx.succeeding(ok -> {
        ctx.verify(() -> {
            // THEN the adapter forwards the command response message downstream
            verify(responseSender).sendCommandResponse(eq(tenantObject), any(RegistrationAssertion.class), any(CommandResponse.class), (SpanContext) any());
            // and reports the forwarded message
            verify(metrics).reportCommand(eq(Direction.RESPONSE), eq(TEST_TENANT_ID), eq(tenantObject), eq(ProcessingOutcome.FORWARDED), eq(payload.length()), any());
        });
        ctx.completeNow();
    }));
}
Also used : Buffer(io.vertx.core.buffer.Buffer) HttpURLConnection(java.net.HttpURLConnection) ProtonConnection(io.vertx.proton.ProtonConnection) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) LifecycleChange(org.eclipse.hono.notification.deviceregistry.LifecycleChange) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) ProcessingOutcome(org.eclipse.hono.service.metric.MetricsTags.ProcessingOutcome) MessagingType(org.eclipse.hono.util.MessagingType) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.doAnswer(org.mockito.Mockito.doAnswer) Map(java.util.Map) DeliveryState(org.apache.qpid.proton.amqp.transport.DeliveryState) AmqpError(org.apache.qpid.proton.amqp.transport.AmqpError) CommandContext(org.eclipse.hono.client.command.CommandContext) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) EventConstants(org.eclipse.hono.util.EventConstants) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) Mockito.mock(org.mockito.Mockito.mock) VertxTestContext(io.vertx.junit5.VertxTestContext) Rejected(org.apache.qpid.proton.amqp.messaging.Rejected) Target(org.apache.qpid.proton.amqp.messaging.Target) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) Commands(org.eclipse.hono.client.command.Commands) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) AsyncResult(io.vertx.core.AsyncResult) CommandConstants(org.eclipse.hono.util.CommandConstants) Direction(org.eclipse.hono.service.metric.MetricsTags.Direction) Vertx(io.vertx.core.Vertx) Mockito.times(org.mockito.Mockito.times) ProtonHelper(io.vertx.proton.ProtonHelper) Released(org.apache.qpid.proton.amqp.messaging.Released) SpanContext(io.opentracing.SpanContext) Mockito.never(org.mockito.Mockito.never) ConnectionAttemptOutcome(org.eclipse.hono.service.metric.MetricsTags.ConnectionAttemptOutcome) ResourceLimitChecks(org.eclipse.hono.adapter.resourcelimits.ResourceLimitChecks) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ProtonReceiver(io.vertx.proton.ProtonReceiver) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) DeviceChangeNotification(org.eclipse.hono.notification.deviceregistry.DeviceChangeNotification) Context(io.vertx.core.Context) ProtonServer(io.vertx.proton.ProtonServer) Timeout(io.vertx.junit5.Timeout) EndpointType(org.eclipse.hono.service.metric.MetricsTags.EndpointType) NotificationType(org.eclipse.hono.notification.NotificationType) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) ResourceIdentifier(org.eclipse.hono.util.ResourceIdentifier) Binary(org.apache.qpid.proton.amqp.Binary) AllDevicesOfTenantDeletedNotification(org.eclipse.hono.notification.deviceregistry.AllDevicesOfTenantDeletedNotification) Data(org.apache.qpid.proton.amqp.messaging.Data) MetricsTags(org.eclipse.hono.service.metric.MetricsTags) ProtonQoS(io.vertx.proton.ProtonQoS) Instant(java.time.Instant) MessageHelper(org.eclipse.hono.util.MessageHelper) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Device(org.eclipse.hono.auth.Device) Test(org.junit.jupiter.api.Test) ErrorCondition(org.apache.qpid.proton.amqp.transport.ErrorCondition) Buffer(io.vertx.core.buffer.Buffer) CommandConsumer(org.eclipse.hono.client.command.CommandConsumer) Mockito.inOrder(org.mockito.Mockito.inOrder) ProtonSender(io.vertx.proton.ProtonSender) Accepted(org.apache.qpid.proton.amqp.messaging.Accepted) QoS(org.eclipse.hono.util.QoS) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) AbstractNotification(org.eclipse.hono.notification.AbstractNotification) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ProtonDelivery(io.vertx.proton.ProtonDelivery) ConnectionLimitManager(org.eclipse.hono.adapter.limiting.ConnectionLimitManager) HashMap(java.util.HashMap) ClientErrorException(org.eclipse.hono.client.ClientErrorException) ConnectionEventProducer(org.eclipse.hono.adapter.monitoring.ConnectionEventProducer) CommandResponseSender(org.eclipse.hono.client.command.CommandResponseSender) Constants(org.eclipse.hono.util.Constants) ProtocolAdapterTestSupport(org.eclipse.hono.adapter.test.ProtocolAdapterTestSupport) TelemetryConstants(org.eclipse.hono.util.TelemetryConstants) ArgumentCaptor(org.mockito.ArgumentCaptor) RecordImpl(org.apache.qpid.proton.engine.impl.RecordImpl) Message(org.apache.qpid.proton.message.Message) HttpUtils(org.eclipse.hono.service.http.HttpUtils) TenantChangeNotification(org.eclipse.hono.notification.deviceregistry.TenantChangeNotification) InOrder(org.mockito.InOrder) Promise(io.vertx.core.Promise) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) Mockito.verify(org.mockito.Mockito.verify) ApplicationProperties(org.apache.qpid.proton.amqp.messaging.ApplicationProperties) CommandResponse(org.eclipse.hono.client.command.CommandResponse) TenantObject(org.eclipse.hono.util.TenantObject) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) Source(org.apache.qpid.proton.amqp.transport.Source) Adapter(org.eclipse.hono.util.Adapter) Handler(io.vertx.core.Handler) Record(org.apache.qpid.proton.engine.Record) SpanContext(io.opentracing.SpanContext) Message(org.apache.qpid.proton.message.Message) ProtonDelivery(io.vertx.proton.ProtonDelivery) HashMap(java.util.HashMap) CommandResponse(org.eclipse.hono.client.command.CommandResponse) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) TenantObject(org.eclipse.hono.util.TenantObject) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) CommandResponseSender(org.eclipse.hono.client.command.CommandResponseSender) ApplicationProperties(org.apache.qpid.proton.amqp.messaging.ApplicationProperties) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test)

Example 85 with Device

use of org.eclipse.hono.auth.Device in project hono by eclipse.

the class EventResourceTest method testUploadEventFailsForRejectedOutcome.

/**
 * Verifies that the adapter fails the upload of an event with a 4.00 result if it is rejected by the downstream
 * peer.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testUploadEventFailsForRejectedOutcome(final VertxTestContext ctx) {
    // GIVEN an adapter with a downstream event consumer attached
    givenAnAdapter(properties);
    final Promise<Void> outcome = Promise.promise();
    givenAnEventSenderForAnyTenant(outcome);
    final var resource = givenAResource(adapter);
    // WHEN a device publishes an event that is not accepted by the peer
    final Buffer payload = Buffer.buffer("some payload");
    final CoapExchange coapExchange = newCoapExchange(payload, Type.CON, MediaTypeRegistry.TEXT_PLAIN);
    final Device authenticatedDevice = new Device("tenant", "device");
    final CoapContext context = CoapContext.fromRequest(coapExchange, authenticatedDevice, authenticatedDevice, "device", span);
    final Future<Void> result = resource.handlePostRequest(context);
    assertEventHasBeenSentDownstream("tenant", "device", "text/plain");
    outcome.fail(new ClientErrorException(HttpURLConnection.HTTP_BAD_REQUEST, "malformed message"));
    // THEN the device gets a 4.00
    result.onComplete(ctx.failing(t -> {
        ctx.verify(() -> {
            assertThat(result.cause()).isInstanceOf(ClientErrorException.class);
            assertThat(((ClientErrorException) result.cause()).getErrorCode()).isEqualTo(HttpURLConnection.HTTP_BAD_REQUEST);
            verify(metrics).reportTelemetry(eq(MetricsTags.EndpointType.EVENT), eq("tenant"), any(), eq(MetricsTags.ProcessingOutcome.UNPROCESSABLE), eq(MetricsTags.QoS.AT_LEAST_ONCE), eq(payload.length()), eq(TtdStatus.NONE), any());
        });
        ctx.completeNow();
    }));
}
Also used : Buffer(io.vertx.core.buffer.Buffer) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) HttpURLConnection(java.net.HttpURLConnection) ResponseCode(org.eclipse.californium.core.coap.CoAP.ResponseCode) VertxTestContext(io.vertx.junit5.VertxTestContext) CoapExchange(org.eclipse.californium.core.server.resources.CoapExchange) Response(org.eclipse.californium.core.coap.Response) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Timeout(io.vertx.junit5.Timeout) TtdStatus(org.eclipse.hono.service.metric.MetricsTags.TtdStatus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) MediaTypeRegistry(org.eclipse.californium.core.coap.MediaTypeRegistry) Type(org.eclipse.californium.core.coap.CoAP.Type) NoopTracerFactory(io.opentracing.noop.NoopTracerFactory) Promise(io.vertx.core.Promise) MetricsTags(org.eclipse.hono.service.metric.MetricsTags) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Device(org.eclipse.hono.auth.Device) Mockito.verify(org.mockito.Mockito.verify) TenantObject(org.eclipse.hono.util.TenantObject) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Mockito.never(org.mockito.Mockito.never) Buffer(io.vertx.core.buffer.Buffer) Device(org.eclipse.hono.auth.Device) ClientErrorException(org.eclipse.hono.client.ClientErrorException) CoapExchange(org.eclipse.californium.core.server.resources.CoapExchange) Test(org.junit.jupiter.api.Test)

Aggregations

Device (org.eclipse.hono.auth.Device)115 HttpURLConnection (java.net.HttpURLConnection)74 Test (org.junit.jupiter.api.Test)72 Future (io.vertx.core.Future)69 ClientErrorException (org.eclipse.hono.client.ClientErrorException)67 Buffer (io.vertx.core.buffer.Buffer)66 Handler (io.vertx.core.Handler)63 TenantObject (org.eclipse.hono.util.TenantObject)63 Promise (io.vertx.core.Promise)59 Constants (org.eclipse.hono.util.Constants)58 Span (io.opentracing.Span)55 RegistrationAssertion (org.eclipse.hono.util.RegistrationAssertion)55 SpanContext (io.opentracing.SpanContext)53 VertxTestContext (io.vertx.junit5.VertxTestContext)52 VertxExtension (io.vertx.junit5.VertxExtension)51 MessageHelper (org.eclipse.hono.util.MessageHelper)51 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)51 Mockito.when (org.mockito.Mockito.when)51 Truth.assertThat (com.google.common.truth.Truth.assertThat)50 ResourceIdentifier (org.eclipse.hono.util.ResourceIdentifier)47