Search in sources :

Example 16 with CredentialsObject

use of org.eclipse.hono.util.CredentialsObject in project hono by eclipse.

the class BaseCredentialsServiceTest method testGetFailsForMissingAuthId.

/**
 * Verifies that the base service fails a request for getting credentials
 * with a 400 error code if the authentication identifier is missing.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testGetFailsForMissingAuthId(final TestContext ctx) {
    // GIVEN a request for getting credentials that does not specify an auth ID
    final CredentialsObject malformedPayload = new CredentialsObject().setType("my-type").addSecret(CredentialsObject.emptySecret(null, null));
    final EventBusMessage request = createRequestForPayload(CredentialsConstants.CredentialsAction.get, JsonObject.mapFrom(malformedPayload));
    // WHEN processing the request
    service.processRequest(request).setHandler(ctx.asyncAssertFailure(t -> {
        // THEN the response contains a 400 error code
        ctx.assertEquals(HttpURLConnection.HTTP_BAD_REQUEST, ((ServiceInvocationException) t).getErrorCode());
    }));
}
Also used : HttpURLConnection(java.net.HttpURLConnection) TestContext(io.vertx.ext.unit.TestContext) BeforeClass(org.junit.BeforeClass) CredentialsResult(org.eclipse.hono.util.CredentialsResult) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) EventBusMessage(org.eclipse.hono.util.EventBusMessage) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ServiceInvocationException(org.eclipse.hono.client.ServiceInvocationException) ServiceConfigProperties(org.eclipse.hono.config.ServiceConfigProperties) Future(io.vertx.core.Future) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) Timeout(org.junit.rules.Timeout) JsonObject(io.vertx.core.json.JsonObject) AsyncResult(io.vertx.core.AsyncResult) Handler(io.vertx.core.Handler) CredentialsObject(org.eclipse.hono.util.CredentialsObject) EventBusMessage(org.eclipse.hono.util.EventBusMessage) CredentialsObject(org.eclipse.hono.util.CredentialsObject) ServiceInvocationException(org.eclipse.hono.client.ServiceInvocationException) Test(org.junit.Test)

Example 17 with CredentialsObject

use of org.eclipse.hono.util.CredentialsObject in project hono by eclipse.

the class ProtonBasedCredentialsClientTest method testGetCredentialsWithClientContextReturnsValueFromCache.

/**
 * Verifies that Credentials are taken from cache, if cache is configured and the cache contains an entry for
 * the given criteria.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testGetCredentialsWithClientContextReturnsValueFromCache(final VertxTestContext ctx) {
    // GIVEN a client with a cache containing an entry
    givenAClient(cache);
    final String authId = "test-auth";
    final String credentialsType = CredentialsConstants.SECRETS_TYPE_HASHED_PASSWORD;
    final var bytes = new byte[] { 0x01, 0x02 };
    final JsonObject credentialsObject = newCredentialsResult("device", authId);
    final CredentialsResult<CredentialsObject> credentialsResult = client.getResult(HttpURLConnection.HTTP_OK, RequestResponseApiConstants.CONTENT_TYPE_APPLICATION_JSON, credentialsObject.toBuffer(), null, null);
    when(cache.getIfPresent(any())).thenReturn(credentialsResult);
    final var cacheKey = ArgumentCaptor.forClass(AnnotatedCacheKey.class);
    // WHEN getting credentials with a client context that contains a raw byte array
    final var contextWithByteArray = new JsonObject().put("bytes", bytes);
    client.get("tenant", credentialsType, authId, contextWithByteArray, span.context()).onFailure(ctx::failNow).compose(result -> {
        ctx.verify(() -> {
            // THEN the credentials are read from the cache
            verify(cache).getIfPresent(cacheKey.capture());
            assertThat(result).isEqualTo(credentialsResult.getPayload());
            verify(sender, never()).send(any(Message.class), VertxMockSupport.anyHandler());
            // and the span is finished
            verify(span).finish();
        });
        // and WHEN getting the same credentials with a client context that contains
        // the Base64 encoding of the byte array
        final var contextWithBase64String = new JsonObject().put("bytes", contextWithByteArray.getValue("bytes"));
        return client.get("tenant", credentialsType, authId, contextWithBase64String, span.context());
    }).onComplete(ctx.succeeding(result -> {
        ctx.verify(() -> {
            // THEN same credentials are read from the cache using the same key as before
            verify(cache, times(2)).getIfPresent(cacheKey.getValue());
            assertThat(result).isEqualTo(credentialsResult.getPayload());
            verify(sender, never()).send(any(Message.class), VertxMockSupport.anyHandler());
            // and the span is finished
            verify(span, times(2)).finish();
        });
        ctx.completeNow();
    }));
}
Also used : HttpURLConnection(java.net.HttpURLConnection) ProtonReceiver(io.vertx.proton.ProtonReceiver) BeforeEach(org.junit.jupiter.api.BeforeEach) LifecycleChange(org.eclipse.hono.notification.deviceregistry.LifecycleChange) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) DeviceChangeNotification(org.eclipse.hono.notification.deviceregistry.DeviceChangeNotification) Tags(io.opentracing.tag.Tags) Timeout(io.vertx.junit5.Timeout) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) ProtonMessageHandler(io.vertx.proton.ProtonMessageHandler) NotificationType(org.eclipse.hono.notification.NotificationType) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) JsonObject(io.vertx.core.json.JsonObject) AllDevicesOfTenantDeletedNotification(org.eclipse.hono.notification.deviceregistry.AllDevicesOfTenantDeletedNotification) CredentialsResult(org.eclipse.hono.util.CredentialsResult) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ProtonQoS(io.vertx.proton.ProtonQoS) Instant(java.time.Instant) MessageHelper(org.eclipse.hono.util.MessageHelper) RequestResponseApiConstants(org.eclipse.hono.util.RequestResponseApiConstants) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Test(org.junit.jupiter.api.Test) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) ProtonSender(io.vertx.proton.ProtonSender) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) AbstractNotification(org.eclipse.hono.notification.AbstractNotification) CacheDirective(org.eclipse.hono.util.CacheDirective) VertxTestContext(io.vertx.junit5.VertxTestContext) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ProtonDelivery(io.vertx.proton.ProtonDelivery) Rejected(org.apache.qpid.proton.amqp.messaging.Rejected) AmqpClientUnitTestHelper(org.eclipse.hono.client.amqp.test.AmqpClientUnitTestHelper) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Cache(com.github.benmanes.caffeine.cache.Cache) Constants(org.eclipse.hono.util.Constants) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) ArgumentCaptor(org.mockito.ArgumentCaptor) Message(org.apache.qpid.proton.message.Message) HonoConnection(org.eclipse.hono.client.HonoConnection) CredentialsChangeNotification(org.eclipse.hono.notification.deviceregistry.CredentialsChangeNotification) RequestResponseClientConfigProperties(org.eclipse.hono.client.RequestResponseClientConfigProperties) Tracer(io.opentracing.Tracer) Vertx(io.vertx.core.Vertx) Mockito.times(org.mockito.Mockito.times) ProtonHelper(io.vertx.proton.ProtonHelper) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Mockito.never(org.mockito.Mockito.never) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) SendMessageSampler(org.eclipse.hono.client.SendMessageSampler) Handler(io.vertx.core.Handler) CredentialsObject(org.eclipse.hono.util.CredentialsObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CredentialsObject(org.eclipse.hono.util.CredentialsObject) JsonObject(io.vertx.core.json.JsonObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Example 18 with CredentialsObject

use of org.eclipse.hono.util.CredentialsObject in project hono by eclipse.

the class ProtonBasedCredentialsClientTest method testGetCredentialsReturnsValueFromCache.

/**
 * Verifies that Credentials are taken from cache, if cache is configured and the cache has this credentials cached.
 *
 * @param ctx The vert.x test context.
 */
@Test
public void testGetCredentialsReturnsValueFromCache(final VertxTestContext ctx) {
    // GIVEN a client with a cache containing a credentials
    givenAClient(cache);
    final String authId = "test-auth";
    final String credentialsType = CredentialsConstants.SECRETS_TYPE_HASHED_PASSWORD;
    final JsonObject credentialsObject = newCredentialsResult("device", authId);
    final CredentialsResult<CredentialsObject> credentialsResult = client.getResult(HttpURLConnection.HTTP_OK, RequestResponseApiConstants.CONTENT_TYPE_APPLICATION_JSON, credentialsObject.toBuffer(), null, null);
    when(cache.getIfPresent(any())).thenReturn(credentialsResult);
    // WHEN getting credentials
    client.get("tenant", credentialsType, authId, span.context()).onComplete(ctx.succeeding(result -> {
        ctx.verify(() -> {
            // THEN the credentials are read from the cache
            verify(cache).getIfPresent(any());
            assertThat(result).isEqualTo(credentialsResult.getPayload());
            verify(sender, never()).send(any(Message.class), VertxMockSupport.anyHandler());
            // and the span is finished
            verify(span).finish();
        });
        ctx.completeNow();
    }));
}
Also used : HttpURLConnection(java.net.HttpURLConnection) ProtonReceiver(io.vertx.proton.ProtonReceiver) BeforeEach(org.junit.jupiter.api.BeforeEach) LifecycleChange(org.eclipse.hono.notification.deviceregistry.LifecycleChange) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) DeviceChangeNotification(org.eclipse.hono.notification.deviceregistry.DeviceChangeNotification) Tags(io.opentracing.tag.Tags) Timeout(io.vertx.junit5.Timeout) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) ProtonMessageHandler(io.vertx.proton.ProtonMessageHandler) NotificationType(org.eclipse.hono.notification.NotificationType) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) JsonObject(io.vertx.core.json.JsonObject) AllDevicesOfTenantDeletedNotification(org.eclipse.hono.notification.deviceregistry.AllDevicesOfTenantDeletedNotification) CredentialsResult(org.eclipse.hono.util.CredentialsResult) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ProtonQoS(io.vertx.proton.ProtonQoS) Instant(java.time.Instant) MessageHelper(org.eclipse.hono.util.MessageHelper) RequestResponseApiConstants(org.eclipse.hono.util.RequestResponseApiConstants) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Test(org.junit.jupiter.api.Test) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) ProtonSender(io.vertx.proton.ProtonSender) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) AbstractNotification(org.eclipse.hono.notification.AbstractNotification) CacheDirective(org.eclipse.hono.util.CacheDirective) VertxTestContext(io.vertx.junit5.VertxTestContext) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ProtonDelivery(io.vertx.proton.ProtonDelivery) Rejected(org.apache.qpid.proton.amqp.messaging.Rejected) AmqpClientUnitTestHelper(org.eclipse.hono.client.amqp.test.AmqpClientUnitTestHelper) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Cache(com.github.benmanes.caffeine.cache.Cache) Constants(org.eclipse.hono.util.Constants) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) ArgumentCaptor(org.mockito.ArgumentCaptor) Message(org.apache.qpid.proton.message.Message) HonoConnection(org.eclipse.hono.client.HonoConnection) CredentialsChangeNotification(org.eclipse.hono.notification.deviceregistry.CredentialsChangeNotification) RequestResponseClientConfigProperties(org.eclipse.hono.client.RequestResponseClientConfigProperties) Tracer(io.opentracing.Tracer) Vertx(io.vertx.core.Vertx) Mockito.times(org.mockito.Mockito.times) ProtonHelper(io.vertx.proton.ProtonHelper) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Mockito.never(org.mockito.Mockito.never) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) SendMessageSampler(org.eclipse.hono.client.SendMessageSampler) Handler(io.vertx.core.Handler) CredentialsObject(org.eclipse.hono.util.CredentialsObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) CredentialsObject(org.eclipse.hono.util.CredentialsObject) JsonObject(io.vertx.core.json.JsonObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.jupiter.api.Test)

Example 19 with CredentialsObject

use of org.eclipse.hono.util.CredentialsObject in project hono by eclipse.

the class ProtonBasedCredentialsClientTest method testGetCredentialsAddsResponseToCacheOnCacheMiss.

/**
 * Verifies that on a cache miss the adapter retrieves credentials information from the
 * Credentials service and puts it to the cache.
 *
 * @param ctx The vert.x test context.
 */
@SuppressWarnings("unchecked")
@Test
public void testGetCredentialsAddsResponseToCacheOnCacheMiss(final VertxTestContext ctx) {
    // GIVEN an adapter with an empty cache
    givenAClient(cache);
    final String authId = "test-auth";
    final String credentialsType = CredentialsConstants.SECRETS_TYPE_HASHED_PASSWORD;
    final JsonObject credentialsObject = newCredentialsResult("device", authId);
    final JsonObject clientContext = new JsonObject();
    // WHEN getting credentials information
    client.get("tenant", credentialsType, authId, clientContext, span.context()).onComplete(ctx.succeeding(credentials -> {
        ctx.verify(() -> {
            final var responseCacheKey = ArgumentCaptor.forClass(AnnotatedCacheKey.class);
            verify(cache).getIfPresent(responseCacheKey.capture());
            assertThat(credentials.getDeviceId()).isEqualTo("device");
            // THEN the credentials result has been added to the cache.
            verify(cache).put(eq(responseCacheKey.getValue()), any(CredentialsResult.class));
            // and the span is finished
            verify(span).finish();
        });
        ctx.completeNow();
    }));
    final Message request = AmqpClientUnitTestHelper.assertMessageHasBeenSent(sender);
    final Message response = ProtonHelper.message();
    response.setCorrelationId(request.getMessageId());
    MessageHelper.addProperty(response, MessageHelper.APP_PROPERTY_STATUS, HttpURLConnection.HTTP_OK);
    MessageHelper.addCacheDirective(response, CacheDirective.maxAgeDirective(60));
    MessageHelper.setPayload(response, MessageHelper.CONTENT_TYPE_APPLICATION_JSON, credentialsObject.toBuffer());
    final ProtonDelivery delivery = mock(ProtonDelivery.class);
    AmqpClientUnitTestHelper.assertReceiverLinkCreated(connection).handle(delivery, response);
}
Also used : HttpURLConnection(java.net.HttpURLConnection) ProtonReceiver(io.vertx.proton.ProtonReceiver) BeforeEach(org.junit.jupiter.api.BeforeEach) LifecycleChange(org.eclipse.hono.notification.deviceregistry.LifecycleChange) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) DeviceChangeNotification(org.eclipse.hono.notification.deviceregistry.DeviceChangeNotification) Tags(io.opentracing.tag.Tags) Timeout(io.vertx.junit5.Timeout) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) ProtonMessageHandler(io.vertx.proton.ProtonMessageHandler) NotificationType(org.eclipse.hono.notification.NotificationType) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) JsonObject(io.vertx.core.json.JsonObject) AllDevicesOfTenantDeletedNotification(org.eclipse.hono.notification.deviceregistry.AllDevicesOfTenantDeletedNotification) CredentialsResult(org.eclipse.hono.util.CredentialsResult) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ProtonQoS(io.vertx.proton.ProtonQoS) Instant(java.time.Instant) MessageHelper(org.eclipse.hono.util.MessageHelper) RequestResponseApiConstants(org.eclipse.hono.util.RequestResponseApiConstants) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Test(org.junit.jupiter.api.Test) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) ProtonSender(io.vertx.proton.ProtonSender) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) Mockito.mock(org.mockito.Mockito.mock) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) AbstractNotification(org.eclipse.hono.notification.AbstractNotification) CacheDirective(org.eclipse.hono.util.CacheDirective) VertxTestContext(io.vertx.junit5.VertxTestContext) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ProtonDelivery(io.vertx.proton.ProtonDelivery) Rejected(org.apache.qpid.proton.amqp.messaging.Rejected) AmqpClientUnitTestHelper(org.eclipse.hono.client.amqp.test.AmqpClientUnitTestHelper) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Cache(com.github.benmanes.caffeine.cache.Cache) Constants(org.eclipse.hono.util.Constants) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) ArgumentCaptor(org.mockito.ArgumentCaptor) Message(org.apache.qpid.proton.message.Message) HonoConnection(org.eclipse.hono.client.HonoConnection) CredentialsChangeNotification(org.eclipse.hono.notification.deviceregistry.CredentialsChangeNotification) RequestResponseClientConfigProperties(org.eclipse.hono.client.RequestResponseClientConfigProperties) Tracer(io.opentracing.Tracer) Vertx(io.vertx.core.Vertx) Mockito.times(org.mockito.Mockito.times) ProtonHelper(io.vertx.proton.ProtonHelper) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Mockito.never(org.mockito.Mockito.never) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) SendMessageSampler(org.eclipse.hono.client.SendMessageSampler) Handler(io.vertx.core.Handler) CredentialsObject(org.eclipse.hono.util.CredentialsObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Message(org.apache.qpid.proton.message.Message) ProtonDelivery(io.vertx.proton.ProtonDelivery) JsonObject(io.vertx.core.json.JsonObject) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) Test(org.junit.jupiter.api.Test)

Example 20 with CredentialsObject

use of org.eclipse.hono.util.CredentialsObject in project hono by eclipse.

the class ProtonBasedCredentialsClient method get.

@Override
public Future<CredentialsObject> get(final String tenantId, final String type, final String authId, final JsonObject clientContext, final SpanContext spanContext) {
    Objects.requireNonNull(tenantId);
    Objects.requireNonNull(type);
    Objects.requireNonNull(authId);
    Objects.requireNonNull(clientContext);
    final int clientContextHashCode;
    if (clientContext.isEmpty()) {
        clientContextHashCode = clientContext.hashCode();
    } else {
        // "normalize" JSON so that binary valued properties always
        // contain the value's Base64 encoding instead of the raw byte array
        // and thus always result in the same hash code
        clientContextHashCode = new JsonObject(clientContext.encode()).hashCode();
    }
    final AnnotatedCacheKey<CacheKey> responseCacheKey = new AnnotatedCacheKey<>(new CacheKey(tenantId, type, authId, clientContextHashCode));
    final Span span = newChildSpan(spanContext, "get Credentials");
    span.setTag(MessageHelper.APP_PROPERTY_TENANT_ID, tenantId);
    span.setTag(TAG_CREDENTIALS_TYPE, type);
    span.setTag(TAG_AUTH_ID, authId);
    final Future<CredentialsResult<CredentialsObject>> resultTracker = getResponseFromCache(responseCacheKey, span).recover(cacheMiss -> getOrCreateClient(tenantId).compose(client -> {
        final JsonObject specification = CredentialsConstants.getSearchCriteria(type, authId).mergeIn(clientContext);
        if (LOG.isTraceEnabled()) {
            LOG.trace("getting credentials using spec:{}{}", System.lineSeparator(), specification.encodePrettily());
        }
        return client.createAndSendRequest(CredentialsConstants.CredentialsAction.get.toString(), null, specification.toBuffer(), RequestResponseApiConstants.CONTENT_TYPE_APPLICATION_JSON, this::getRequestResponseResult, span);
    }).map(credentialsResult -> {
        addResultToCache(responseCacheKey, credentialsResult);
        return credentialsResult;
    }));
    return mapResultAndFinishSpan(resultTracker, result -> {
        switch(result.getStatus()) {
            case HttpURLConnection.HTTP_OK:
            case HttpURLConnection.HTTP_CREATED:
                return result.getPayload();
            case HttpURLConnection.HTTP_NOT_FOUND:
                throw new ClientErrorException(result.getStatus(), "no such credentials");
            default:
                throw StatusCodeMapper.from(result);
        }
    }, span);
}
Also used : HttpURLConnection(java.net.HttpURLConnection) CacheDirective(org.eclipse.hono.util.CacheDirective) LifecycleChange(org.eclipse.hono.notification.deviceregistry.LifecycleChange) Json(io.vertx.core.json.Json) DecodeException(io.vertx.core.json.DecodeException) DeviceChangeNotification(org.eclipse.hono.notification.deviceregistry.DeviceChangeNotification) LoggerFactory(org.slf4j.LoggerFactory) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Cache(com.github.benmanes.caffeine.cache.Cache) Constants(org.eclipse.hono.util.Constants) StatusCodeMapper(org.eclipse.hono.client.StatusCodeMapper) CredentialsClient(org.eclipse.hono.client.registry.CredentialsClient) JsonObject(io.vertx.core.json.JsonObject) HonoConnection(org.eclipse.hono.client.HonoConnection) AbstractRequestResponseServiceClient(org.eclipse.hono.client.amqp.AbstractRequestResponseServiceClient) AllDevicesOfTenantDeletedNotification(org.eclipse.hono.notification.deviceregistry.AllDevicesOfTenantDeletedNotification) CredentialsChangeNotification(org.eclipse.hono.notification.deviceregistry.CredentialsChangeNotification) Logger(org.slf4j.Logger) CredentialsResult(org.eclipse.hono.util.CredentialsResult) RequestResponseClient(org.eclipse.hono.client.amqp.RequestResponseClient) CachingClientFactory(org.eclipse.hono.client.impl.CachingClientFactory) MessageHelper(org.eclipse.hono.util.MessageHelper) RequestResponseApiConstants(org.eclipse.hono.util.RequestResponseApiConstants) Future(io.vertx.core.Future) CredentialsConstants(org.eclipse.hono.util.CredentialsConstants) ApplicationProperties(org.apache.qpid.proton.amqp.messaging.ApplicationProperties) SpanContext(io.opentracing.SpanContext) Objects(java.util.Objects) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) Buffer(io.vertx.core.buffer.Buffer) Span(io.opentracing.Span) SendMessageSampler(org.eclipse.hono.client.SendMessageSampler) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) CredentialsObject(org.eclipse.hono.util.CredentialsObject) JsonObject(io.vertx.core.json.JsonObject) CredentialsResult(org.eclipse.hono.util.CredentialsResult) ClientErrorException(org.eclipse.hono.client.ClientErrorException) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey) Span(io.opentracing.Span) AnnotatedCacheKey(org.eclipse.hono.client.util.AnnotatedCacheKey)

Aggregations

CredentialsObject (org.eclipse.hono.util.CredentialsObject)20 JsonObject (io.vertx.core.json.JsonObject)16 HttpURLConnection (java.net.HttpURLConnection)14 Future (io.vertx.core.Future)13 CredentialsConstants (org.eclipse.hono.util.CredentialsConstants)12 Handler (io.vertx.core.Handler)10 ClientErrorException (org.eclipse.hono.client.ClientErrorException)10 CredentialsResult (org.eclipse.hono.util.CredentialsResult)10 MessageHelper (org.eclipse.hono.util.MessageHelper)7 Truth.assertThat (com.google.common.truth.Truth.assertThat)6 Span (io.opentracing.Span)6 Tracer (io.opentracing.Tracer)6 Vertx (io.vertx.core.Vertx)6 Timeout (io.vertx.junit5.Timeout)6 VertxTestContext (io.vertx.junit5.VertxTestContext)6 Instant (java.time.Instant)6 AnnotatedCacheKey (org.eclipse.hono.client.util.AnnotatedCacheKey)6 VertxExtension (io.vertx.junit5.VertxExtension)5 Constants (org.eclipse.hono.util.Constants)5 Cache (com.github.benmanes.caffeine.cache.Cache)4