From 48740b1b14c867f8918c92e30e3b90e1ac344d7d Mon Sep 17 00:00:00 2001 From: Abel Buechner-Mihaljevic Date: Mon, 24 Aug 2020 11:25:42 +0200 Subject: [PATCH] [#5] Conform CheckStyle rules (final keyword + license headers + static imports). Signed-off-by: Abel Buechner-Mihaljevic --- .../AbstractMqttProtocolGatewayTest.java | 16 +++++++--------- .../MultiTenantConnectionManagerImplTest.java | 13 +++++++++++++ .../sdk/mqtt2amqp/TenantConnectionsTest.java | 13 +++++++++++++ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/AbstractMqttProtocolGatewayTest.java b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/AbstractMqttProtocolGatewayTest.java index 4c4971cd..5d0d9281 100644 --- a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/AbstractMqttProtocolGatewayTest.java +++ b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/AbstractMqttProtocolGatewayTest.java @@ -14,8 +14,6 @@ package org.eclipse.hono.gateway.sdk.mqtt2amqp; import static org.assertj.core.api.Assertions.assertThat; -import static org.eclipse.hono.gateway.sdk.mqtt2amqp.TestMqttProtocolGateway.GW_PASSWORD; -import static org.eclipse.hono.gateway.sdk.mqtt2amqp.TestMqttProtocolGateway.GW_USERNAME; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; @@ -465,7 +463,7 @@ public void testConnectWithGatewayCredentialsResolvedDynamicallySucceeds() { // WHEN the gateway connects connectTestDevice(gateway); - ArgumentCaptor configPropertiesArgumentCaptor = ArgumentCaptor + final ArgumentCaptor configPropertiesArgumentCaptor = ArgumentCaptor .forClass(ClientConfigProperties.class); verify(tenantConnectionManager).connect(anyString(), any(), configPropertiesArgumentCaptor.capture()); @@ -473,8 +471,8 @@ public void testConnectWithGatewayCredentialsResolvedDynamicallySucceeds() { final ClientConfigProperties clientConfig = configPropertiesArgumentCaptor.getValue(); // THEN the AMQP connection is authenticated with the provided credentials... - assertThat(clientConfig.getUsername()).isEqualTo(GW_USERNAME); - assertThat(clientConfig.getPassword()).isEqualTo(GW_PASSWORD); + assertThat(clientConfig.getUsername()).isEqualTo(TestMqttProtocolGateway.GW_USERNAME); + assertThat(clientConfig.getPassword()).isEqualTo(TestMqttProtocolGateway.GW_PASSWORD); // ... and not with the credentials from the configuration assertThat(clientConfig.getUsername()).isNotEqualTo(configWithoutCredentials.getUsername()); @@ -503,7 +501,7 @@ public void testConfiguredCredentialsTakePrecedenceOverImplementation() { // WHEN the gateway connects connectTestDevice(gateway); - ArgumentCaptor configPropertiesArgumentCaptor = ArgumentCaptor + final ArgumentCaptor configPropertiesArgumentCaptor = ArgumentCaptor .forClass(ClientConfigProperties.class); verify(tenantConnectionManager).connect(anyString(), any(), configPropertiesArgumentCaptor.capture()); @@ -515,8 +513,8 @@ public void testConfiguredCredentialsTakePrecedenceOverImplementation() { assertThat(clientConfig.getPassword()).isEqualTo(password); // ... and not with the credentials from the implementation - assertThat(clientConfig.getUsername()).isNotEqualTo(GW_USERNAME); - assertThat(clientConfig.getPassword()).isNotEqualTo(GW_PASSWORD); + assertThat(clientConfig.getUsername()).isNotEqualTo(TestMqttProtocolGateway.GW_USERNAME); + assertThat(clientConfig.getPassword()).isNotEqualTo(TestMqttProtocolGateway.GW_PASSWORD); } /** @@ -611,7 +609,7 @@ private void rejectAmqpMessage() { verify(protonSender).send(any(), handlerArgumentCaptor.capture()); - ProtonDelivery protonDelivery = mock(ProtonDelivery.class); + final ProtonDelivery protonDelivery = mock(ProtonDelivery.class); when(protonDelivery.getRemoteState()).thenReturn(new Rejected()); when(protonDelivery.remotelySettled()).thenReturn(true); diff --git a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/MultiTenantConnectionManagerImplTest.java b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/MultiTenantConnectionManagerImplTest.java index 640ac3c8..d5ae1030 100644 --- a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/MultiTenantConnectionManagerImplTest.java +++ b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/MultiTenantConnectionManagerImplTest.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + package org.eclipse.hono.gateway.sdk.mqtt2amqp; import static org.assertj.core.api.Assertions.assertThat; diff --git a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/TenantConnectionsTest.java b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/TenantConnectionsTest.java index 99840de0..f0e976a3 100644 --- a/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/TenantConnectionsTest.java +++ b/protocol-gateway/mqtt-protocol-gateway-template/src/test/java/org/eclipse/hono/gateway/sdk/mqtt2amqp/TenantConnectionsTest.java @@ -1,3 +1,16 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0 + * + * SPDX-License-Identifier: EPL-2.0 + *******************************************************************************/ + package org.eclipse.hono.gateway.sdk.mqtt2amqp; import static org.assertj.core.api.Assertions.assertThat;