Search in sources :

Example 1 with ResourceLimits

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

the class KafkaBasedCommandResponseSenderTest method testIfValidCommandResponseKafkaRecordIsSent.

@Test
void testIfValidCommandResponseKafkaRecordIsSent(final VertxTestContext ctx, final Vertx vertx) {
    // GIVEN a command response sender
    final String tenantId = "test-tenant";
    final String deviceId = "test-device";
    final String correlationId = UUID.randomUUID().toString();
    final String contentType = "text/plain";
    final String payload = "the-payload";
    final int status = 200;
    final String additionalHeader1Name = "testHeader1";
    final String additionalHeader1Value = "testHeader1Value";
    final String additionalHeader2Name = "testHeader2";
    final String additionalHeader2Value = "testHeader2Value";
    final Map<String, Object> additionalProperties = Map.of(additionalHeader1Name, additionalHeader1Value, additionalHeader2Name, additionalHeader2Value);
    final CommandResponse commandResponse = CommandResponse.fromAddressAndCorrelationId(String.format("%s/%s/%s", CommandConstants.COMMAND_RESPONSE_ENDPOINT, tenantId, Commands.getDeviceFacingReplyToId("", deviceId, MessagingType.kafka)), correlationId, Buffer.buffer(payload), contentType, status);
    commandResponse.setAdditionalProperties(additionalProperties);
    final Span span = TracingMockSupport.mockSpan();
    final Tracer tracer = TracingMockSupport.mockTracer(span);
    final var mockProducer = KafkaClientUnitTestHelper.newMockProducer(true);
    final var factory = CachingKafkaProducerFactory.testFactory(vertx, (n, c) -> KafkaClientUnitTestHelper.newKafkaProducer(mockProducer));
    final var sender = new KafkaBasedCommandResponseSender(vertx, factory, kafkaProducerConfig, tracer);
    final TenantObject tenant = TenantObject.from(tenantId);
    tenant.setResourceLimits(new ResourceLimits().setMaxTtlCommandResponse(10L));
    // WHEN sending a command response
    sender.sendCommandResponse(tenant, new RegistrationAssertion(deviceId), commandResponse, NoopSpan.INSTANCE.context()).onComplete(ctx.succeeding(t -> {
        ctx.verify(() -> {
            // THEN the producer record is created from the given values...
            final ProducerRecord<String, Buffer> record = mockProducer.history().get(0);
            assertThat(record.key()).isEqualTo(deviceId);
            assertThat(record.topic()).isEqualTo(new HonoTopic(HonoTopic.Type.COMMAND_RESPONSE, tenantId).toString());
            assertThat(record.value().toString()).isEqualTo(payload);
            // Verify if the record contains the necessary headers.
            final Headers headers = record.headers();
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.APP_PROPERTY_TENANT_ID, tenantId);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.APP_PROPERTY_DEVICE_ID, deviceId);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.SYS_PROPERTY_CORRELATION_ID, correlationId);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.APP_PROPERTY_STATUS, status);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.SYS_PROPERTY_CONTENT_TYPE, contentType);
            final var creationTimeHeader = headers.headers(MessageHelper.SYS_PROPERTY_CREATION_TIME);
            assertThat(creationTimeHeader).hasSize(1);
            final Long creationTimeMillis = Json.decodeValue(Buffer.buffer(creationTimeHeader.iterator().next().value()), Long.class);
            assertThat(creationTimeMillis).isGreaterThan(0L);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, MessageHelper.SYS_HEADER_PROPERTY_TTL, 10000L);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, additionalHeader1Name, additionalHeader1Value);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(headers, additionalHeader2Name, additionalHeader2Value);
            verify(span).finish();
        });
        ctx.completeNow();
    }));
}
Also used : VertxTestContext(io.vertx.junit5.VertxTestContext) BeforeEach(org.junit.jupiter.api.BeforeEach) Json(io.vertx.core.json.Json) ProducerRecord(org.apache.kafka.clients.producer.ProducerRecord) MessagingKafkaProducerConfigProperties(org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) Headers(org.apache.kafka.common.header.Headers) HashMap(java.util.HashMap) Commands(org.eclipse.hono.client.command.Commands) MessagingType(org.eclipse.hono.util.MessagingType) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.verifyNoMoreInteractions(org.mockito.Mockito.verifyNoMoreInteractions) Map(java.util.Map) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) CommandConstants(org.eclipse.hono.util.CommandConstants) KafkaClientUnitTestHelper(org.eclipse.hono.kafka.test.KafkaClientUnitTestHelper) TenantChangeNotification(org.eclipse.hono.notification.deviceregistry.TenantChangeNotification) ResourceLimits(org.eclipse.hono.util.ResourceLimits) Tracer(io.opentracing.Tracer) CachingKafkaProducerFactory(org.eclipse.hono.client.kafka.producer.CachingKafkaProducerFactory) Vertx(io.vertx.core.Vertx) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) Mockito.when(org.mockito.Mockito.when) UUID(java.util.UUID) Truth.assertThat(com.google.common.truth.Truth.assertThat) MessageHelper(org.eclipse.hono.util.MessageHelper) VertxExtension(io.vertx.junit5.VertxExtension) Mockito.verify(org.mockito.Mockito.verify) CommandResponse(org.eclipse.hono.client.command.CommandResponse) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test) HonoTopic(org.eclipse.hono.client.kafka.HonoTopic) Buffer(io.vertx.core.buffer.Buffer) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) NotificationEventBusSupport(org.eclipse.hono.notification.NotificationEventBusSupport) NoopSpan(io.opentracing.noop.NoopSpan) Mockito.mock(org.mockito.Mockito.mock) Tracer(io.opentracing.Tracer) Headers(org.apache.kafka.common.header.Headers) CommandResponse(org.eclipse.hono.client.command.CommandResponse) HonoTopic(org.eclipse.hono.client.kafka.HonoTopic) Span(io.opentracing.Span) NoopSpan(io.opentracing.noop.NoopSpan) TenantObject(org.eclipse.hono.util.TenantObject) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) ResourceLimits(org.eclipse.hono.util.ResourceLimits) ProducerRecord(org.apache.kafka.clients.producer.ProducerRecord) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test)

Example 2 with ResourceLimits

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

the class ConnectedDevicesAsyncCacheLoaderTest method testAsyncLoadSucceedsIfUnlimited.

/**
 * Verifies that a limited resource with no limit is returned if the tenant has been
 * configured with unlimited connections explicitly.
 */
@Test
public void testAsyncLoadSucceedsIfUnlimited() {
    givenCurrentConnections(90);
    final TenantObject tenant = TenantObject.from(Constants.DEFAULT_TENANT, true).setResourceLimits(new ResourceLimits().setMaxConnections(TenantConstants.UNLIMITED_CONNECTIONS));
    assertLimitedResourceResult(tenant, null, 0L);
}
Also used : TenantObject(org.eclipse.hono.util.TenantObject) ResourceLimits(org.eclipse.hono.util.ResourceLimits) Test(org.junit.jupiter.api.Test)

Example 3 with ResourceLimits

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

the class ProtonBasedDownstreamSenderTest method testDownstreamTelemetryMessageHasCreationTimeAndTtl.

/**
 * Verifies that a downstream telemetry message always contains a creation-time
 * and a time-to-live as defined at the tenant level.
 *
 * @param qosLevel The quality of service used for sending the message.
 * @param expectedTtl The time to live (in millis) expected to be set on the message.
 */
@ParameterizedTest
@CsvSource(value = { "AT_MOST_ONCE,10000", "AT_LEAST_ONCE,20000" })
public void testDownstreamTelemetryMessageHasCreationTimeAndTtl(final QoS qosLevel, final long expectedTtl) {
    final TenantObject tenant = TenantObject.from(Constants.DEFAULT_TENANT, true);
    tenant.setResourceLimits(new ResourceLimits().setMaxTtlTelemetryQoS0(10L).setMaxTtlTelemetryQoS1(20L));
    final RegistrationAssertion device = new RegistrationAssertion("4711");
    // WHEN sending a message without specifying any properties
    sender.sendTelemetry(tenant, device, qosLevel, "text/plain", Buffer.buffer("hello"), null, span.context());
    // THEN the message contains a creation-time
    verify(protonSender).send(argThat(message -> message.getCreationTime() > 0 && message.getTtl() == expectedTtl), VertxMockSupport.anyHandler());
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) HttpURLConnection(java.net.HttpURLConnection) VertxTestContext(io.vertx.junit5.VertxTestContext) BeforeEach(org.junit.jupiter.api.BeforeEach) CsvSource(org.junit.jupiter.params.provider.CsvSource) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) ArgumentMatchers.argThat(org.mockito.ArgumentMatchers.argThat) AmqpClientUnitTestHelper(org.eclipse.hono.client.amqp.test.AmqpClientUnitTestHelper) HashMap(java.util.HashMap) ClientErrorException(org.eclipse.hono.client.ClientErrorException) Supplier(java.util.function.Supplier) Constants(org.eclipse.hono.util.Constants) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Map(java.util.Map) Message(org.apache.qpid.proton.message.Message) HonoConnection(org.eclipse.hono.client.HonoConnection) ClientConfigProperties(org.eclipse.hono.config.ClientConfigProperties) ResourceLimits(org.eclipse.hono.util.ResourceLimits) Tracer(io.opentracing.Tracer) NoopTracerFactory(io.opentracing.noop.NoopTracerFactory) Vertx(io.vertx.core.Vertx) ServerErrorException(org.eclipse.hono.client.ServerErrorException) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) MessageHelper(org.eclipse.hono.util.MessageHelper) VertxExtension(io.vertx.junit5.VertxExtension) Future(io.vertx.core.Future) Mockito.verify(org.mockito.Mockito.verify) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Buffer(io.vertx.core.buffer.Buffer) VertxMockSupport(org.eclipse.hono.test.VertxMockSupport) Span(io.opentracing.Span) ProtonSender(io.vertx.proton.ProtonSender) SendMessageSampler(org.eclipse.hono.client.SendMessageSampler) NoopSpan(io.opentracing.noop.NoopSpan) QoS(org.eclipse.hono.util.QoS) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Mockito.mock(org.mockito.Mockito.mock) TenantObject(org.eclipse.hono.util.TenantObject) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) ResourceLimits(org.eclipse.hono.util.ResourceLimits) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with ResourceLimits

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

the class KafkaBasedTelemetrySenderTest method testSendTelemetryCreatesCorrectRecord.

/**
 * Verifies that the Kafka record is created as expected when sending telemetry data.
 *
 * @param qos The quality of service used for sending the message.
 * @param expectedTtl The ttl expected in the message.
 * @param ctx The vert.x test context.
 */
@ParameterizedTest
@CsvSource(value = { "AT_MOST_ONCE,10000", "AT_LEAST_ONCE,60000" })
public void testSendTelemetryCreatesCorrectRecord(final QoS qos, final long expectedTtl, final VertxTestContext ctx) {
    // GIVEN a telemetry sender
    final String payload = "the-payload";
    final String contentType = "text/plain";
    final Map<String, Object> properties = Map.of("foo", "bar");
    final var spanFinished = ctx.checkpoint();
    final var messageHasHeaders = ctx.checkpoint();
    final var span = TracingMockSupport.mockSpan();
    doAnswer(invocation -> {
        spanFinished.flag();
        return null;
    }).when(span).finish();
    final var tracer = TracingMockSupport.mockTracer(span);
    final var mockProducer = KafkaClientUnitTestHelper.newMockProducer(true);
    final var factory = CachingKafkaProducerFactory.testFactory(vertxMock, (n, c) -> KafkaClientUnitTestHelper.newKafkaProducer(mockProducer));
    final var sender = new KafkaBasedTelemetrySender(vertxMock, factory, kafkaProducerConfig, true, tracer);
    tenant.setResourceLimits(new ResourceLimits().setMaxTtlTelemetryQoS0(10L).setMaxTtlTelemetryQoS1(60L));
    // WHEN sending telemetry data
    sender.sendTelemetry(tenant, device, qos, contentType, Buffer.buffer(payload), properties, null).onComplete(ctx.succeeding(t -> {
        ctx.verify(() -> {
            // THEN the producer record is created from the given values...
            final var producerRecord = mockProducer.history().get(0);
            assertThat(producerRecord.key()).isEqualTo(device.getDeviceId());
            assertThat(producerRecord.topic()).isEqualTo(new HonoTopic(HonoTopic.Type.TELEMETRY, tenant.getTenantId()).toString());
            assertThat(producerRecord.value().toString()).isEqualTo(payload);
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(producerRecord.headers(), "foo", "bar");
            KafkaClientUnitTestHelper.assertUniqueHeaderWithExpectedValue(producerRecord.headers(), MessageHelper.SYS_HEADER_PROPERTY_TTL, expectedTtl);
            // ...AND contains the standard headers
            KafkaClientUnitTestHelper.assertStandardHeaders(producerRecord, device.getDeviceId(), contentType, qos.ordinal());
        });
        messageHasHeaders.flag();
    }));
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) VertxTestContext(io.vertx.junit5.VertxTestContext) BeforeEach(org.junit.jupiter.api.BeforeEach) CsvSource(org.junit.jupiter.params.provider.CsvSource) MessagingKafkaProducerConfigProperties(org.eclipse.hono.client.kafka.producer.MessagingKafkaProducerConfigProperties) HashMap(java.util.HashMap) EventBus(io.vertx.core.eventbus.EventBus) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Mockito.doAnswer(org.mockito.Mockito.doAnswer) Map(java.util.Map) TracingMockSupport(org.eclipse.hono.test.TracingMockSupport) KafkaClientUnitTestHelper(org.eclipse.hono.kafka.test.KafkaClientUnitTestHelper) ResourceLimits(org.eclipse.hono.util.ResourceLimits) Tracer(io.opentracing.Tracer) NoopTracerFactory(io.opentracing.noop.NoopTracerFactory) CachingKafkaProducerFactory(org.eclipse.hono.client.kafka.producer.CachingKafkaProducerFactory) Vertx(io.vertx.core.Vertx) RegistrationAssertion(org.eclipse.hono.util.RegistrationAssertion) Mockito.when(org.mockito.Mockito.when) Truth.assertThat(com.google.common.truth.Truth.assertThat) MessageHelper(org.eclipse.hono.util.MessageHelper) VertxExtension(io.vertx.junit5.VertxExtension) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test) HonoTopic(org.eclipse.hono.client.kafka.HonoTopic) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Buffer(io.vertx.core.buffer.Buffer) QoS(org.eclipse.hono.util.QoS) MockProducer(org.apache.kafka.clients.producer.MockProducer) Mockito.mock(org.mockito.Mockito.mock) ResourceLimits(org.eclipse.hono.util.ResourceLimits) TenantObject(org.eclipse.hono.util.TenantObject) HonoTopic(org.eclipse.hono.client.kafka.HonoTopic) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with ResourceLimits

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

the class TenantApiTests method testGetTenant.

/**
 * Verifies that an existing tenant can be retrieved.
 *
 * @param ctx The vert.x test context.
 */
@Timeout(value = 5, timeUnit = TimeUnit.SECONDS)
@Test
public void testGetTenant(final VertxTestContext ctx) {
    final JsonObject defaults = new JsonObject().put("ttl", 30);
    final Map<String, Object> httpAdapterExtensions = Map.of("deployment", Map.of("maxInstances", 4));
    final ResourceLimits resourceLimits = new ResourceLimits().setMaxConnections(100000).setMaxTtl(30L).setDataVolume(new DataVolume(Instant.parse("2019-07-27T14:30:00Z"), new ResourceLimitsPeriod(PeriodMode.days).setNoOfDays(30), 2147483648L));
    final String tenantId = getHelper().getRandomTenantId();
    final Tenant tenant = new Tenant();
    tenant.setEnabled(true);
    tenant.setResourceLimits(resourceLimits);
    tenant.setDefaults(defaults.getMap());
    tenant.putExtension("customer", "ACME Inc.");
    tenant.addAdapterConfig(new Adapter(Constants.PROTOCOL_ADAPTER_TYPE_MQTT).setEnabled(true).setDeviceAuthenticationRequired(false)).addAdapterConfig(new Adapter(Constants.PROTOCOL_ADAPTER_TYPE_HTTP).setEnabled(true).setDeviceAuthenticationRequired(true).setExtensions(httpAdapterExtensions));
    // expected tenant object
    final TenantObject expectedTenantObject = TenantObject.from(tenantId, true).setDefaults(defaults).setResourceLimits(resourceLimits).addAdapter(new org.eclipse.hono.util.Adapter(Constants.PROTOCOL_ADAPTER_TYPE_MQTT).setEnabled(Boolean.TRUE).setDeviceAuthenticationRequired(Boolean.FALSE)).addAdapter(new org.eclipse.hono.util.Adapter(Constants.PROTOCOL_ADAPTER_TYPE_HTTP).setEnabled(Boolean.TRUE).setDeviceAuthenticationRequired(Boolean.TRUE).setExtensions(httpAdapterExtensions));
    getHelper().registry.addTenant(tenantId, tenant).compose(ok -> getAdminClient().get(tenantId, NoopSpan.INSTANCE.context())).onComplete(ctx.succeeding(tenantObject -> {
        ctx.verify(() -> {
            assertThat(tenantObject.getDefaults()).isEqualTo(expectedTenantObject.getDefaults());
            Assertions.assertThat(tenantObject.getAdapters()).usingRecursiveFieldByFieldElementComparator().containsAll(expectedTenantObject.getAdapters());
            assertThat(tenantObject.getResourceLimits().getMaxConnections()).isEqualTo(expectedTenantObject.getResourceLimits().getMaxConnections());
            assertThat(tenantObject.getResourceLimits().getMaxTtl()).isEqualTo(expectedTenantObject.getResourceLimits().getMaxTtl());
            assertThat(tenantObject.getResourceLimits().getDataVolume().getMaxBytes()).isEqualTo(expectedTenantObject.getResourceLimits().getDataVolume().getMaxBytes());
            assertThat(tenantObject.getResourceLimits().getDataVolume().getEffectiveSince()).isEqualTo(expectedTenantObject.getResourceLimits().getDataVolume().getEffectiveSince());
            assertThat(tenantObject.getResourceLimits().getDataVolume().getPeriod().getMode()).isEqualTo(expectedTenantObject.getResourceLimits().getDataVolume().getPeriod().getMode());
            assertThat(tenantObject.getResourceLimits().getDataVolume().getPeriod().getNoOfDays()).isEqualTo(expectedTenantObject.getResourceLimits().getDataVolume().getPeriod().getNoOfDays());
            final JsonObject extensions = tenantObject.getProperty("ext", JsonObject.class);
            assertThat(extensions.getString("customer")).isEqualTo("ACME Inc.");
            // implicitly added by DeviceRegistryHttpClient
            assertThat(extensions.getString(TenantConstants.FIELD_EXT_MESSAGING_TYPE)).isEqualTo(IntegrationTestSupport.getConfiguredMessagingType().name());
        });
        ctx.completeNow();
    }));
}
Also used : DataVolume(org.eclipse.hono.util.DataVolume) HttpURLConnection(java.net.HttpURLConnection) VertxTestContext(io.vertx.junit5.VertxTestContext) KeyPair(java.security.KeyPair) X500Principal(javax.security.auth.x500.X500Principal) TenantConstants(org.eclipse.hono.util.TenantConstants) Constants(org.eclipse.hono.util.Constants) Tenant(org.eclipse.hono.service.management.tenant.Tenant) Timeout(io.vertx.junit5.Timeout) IntegrationTestSupport(org.eclipse.hono.tests.IntegrationTestSupport) Map(java.util.Map) Assumptions.assumeTrue(org.junit.jupiter.api.Assumptions.assumeTrue) Assertions(org.assertj.core.api.Assertions) JsonObject(io.vertx.core.json.JsonObject) Tenants(org.eclipse.hono.tests.Tenants) KeyPairGenerator(java.security.KeyPairGenerator) ResourceLimits(org.eclipse.hono.util.ResourceLimits) PublicKey(java.security.PublicKey) TenantClient(org.eclipse.hono.client.registry.TenantClient) Truth.assertThat(com.google.common.truth.Truth.assertThat) Instant(java.time.Instant) PeriodMode(org.eclipse.hono.util.ResourceLimitsPeriod.PeriodMode) ResourceLimitsPeriod(org.eclipse.hono.util.ResourceLimitsPeriod) TenantObject(org.eclipse.hono.util.TenantObject) TimeUnit(java.util.concurrent.TimeUnit) Test(org.junit.jupiter.api.Test) Adapter(org.eclipse.hono.util.Adapter) DataVolume(org.eclipse.hono.util.DataVolume) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) NoopSpan(io.opentracing.noop.NoopSpan) TrustAnchor(java.security.cert.TrustAnchor) JsonObject(io.vertx.core.json.JsonObject) Adapter(org.eclipse.hono.util.Adapter) TenantObject(org.eclipse.hono.util.TenantObject) Tenant(org.eclipse.hono.service.management.tenant.Tenant) ResourceLimitsPeriod(org.eclipse.hono.util.ResourceLimitsPeriod) ResourceLimits(org.eclipse.hono.util.ResourceLimits) JsonObject(io.vertx.core.json.JsonObject) TenantObject(org.eclipse.hono.util.TenantObject) Test(org.junit.jupiter.api.Test) Timeout(io.vertx.junit5.Timeout)

Aggregations

ResourceLimits (org.eclipse.hono.util.ResourceLimits)13 Test (org.junit.jupiter.api.Test)12 TenantObject (org.eclipse.hono.util.TenantObject)9 VertxTestContext (io.vertx.junit5.VertxTestContext)7 Truth.assertThat (com.google.common.truth.Truth.assertThat)6 VertxExtension (io.vertx.junit5.VertxExtension)6 Map (java.util.Map)6 RegistrationAssertion (org.eclipse.hono.util.RegistrationAssertion)6 BeforeEach (org.junit.jupiter.api.BeforeEach)6 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)6 JsonObject (io.vertx.core.json.JsonObject)5 Mockito.mock (org.mockito.Mockito.mock)5 Mockito.when (org.mockito.Mockito.when)5 Tracer (io.opentracing.Tracer)4 NoopSpan (io.opentracing.noop.NoopSpan)4 Vertx (io.vertx.core.Vertx)4 Buffer (io.vertx.core.buffer.Buffer)4 EventBus (io.vertx.core.eventbus.EventBus)4 HttpURLConnection (java.net.HttpURLConnection)4 Constants (org.eclipse.hono.util.Constants)4