Skip to content

Commit

Permalink
Renamed GenericMqttClientActor to MqttClientActor. Actors for con…
Browse files Browse the repository at this point in the history
…suming and publishing, too, do not have 'Generic' in their name.

Signed-off-by: Juergen Fickel <juergen.fickel@bosch.io>
  • Loading branch information
Juergen Fickel committed Jun 13, 2022
1 parent f60e1f0 commit efd58c3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.eclipse.ditto.connectivity.service.messaging.amqp.AmqpClientActor;
import org.eclipse.ditto.connectivity.service.messaging.httppush.HttpPushClientActor;
import org.eclipse.ditto.connectivity.service.messaging.kafka.KafkaClientActor;
import org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.GenericMqttClientActor;
import org.eclipse.ditto.connectivity.service.messaging.mqtt.hivemq.MqttClientActor;
import org.eclipse.ditto.connectivity.service.messaging.rabbitmq.RabbitMQClientActor;

import com.typesafe.config.Config;
Expand Down Expand Up @@ -72,7 +72,7 @@ public Props getActorPropsForType(final Connection connection,
connectivityConfigOverwrites,
actorSystem,
dittoHeaders);
case MQTT, MQTT_5 -> GenericMqttClientActor.props(connection,
case MQTT, MQTT_5 -> MqttClientActor.props(connection,
proxyActor,
connectionActor,
dittoHeaders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
/**
* Actor for handling connection to an MQTT broker for protocol versions 3 or 5.
*/
public final class GenericMqttClientActor extends BaseClientActor {
public final class MqttClientActor extends BaseClientActor {

private final MqttConfig mqttConfig;
private final MqttSpecificConfig mqttSpecificConfig;
Expand All @@ -83,7 +83,7 @@ public final class GenericMqttClientActor extends BaseClientActor {
private final List<ActorRef> mqttConsumerActorRefs;

@SuppressWarnings("java:S1144")
private GenericMqttClientActor(final Connection connection,
private MqttClientActor(final Connection connection,
final ActorRef proxyActor,
final ActorRef connectionActor,
final DittoHeaders dittoHeaders,
Expand Down Expand Up @@ -120,7 +120,7 @@ public static Props props(final Connection mqttConnection,
final DittoHeaders dittoHeaders,
final Config connectivityConfigOverwrites) {

return Props.create(GenericMqttClientActor.class,
return Props.create(MqttClientActor.class,
ConditionChecker.checkNotNull(mqttConnection, "mqttConnection"),
ConditionChecker.checkNotNull(proxyActor, "proxyActor"),
ConditionChecker.checkNotNull(connectionActor, "connectionActor"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static MqttClientBuilder getGenericMqttClientBuilder(
}

private static URI getConnectionUri(final HiveMqttClientProperties hiveMqttClientProperties) {
final var sshTunnelState = hiveMqttClientProperties.getSshTunnelState().orElse(SshTunnelState.disabled());
final var sshTunnelState = hiveMqttClientProperties.getSshTunnelState().orElseGet(SshTunnelState::disabled);
return sshTunnelState.getURI(hiveMqttClientProperties.getMqttConnection());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ private static Map<String, String> getHeadersAsMap(final GenericMqttPublish gene
final var result = new HashMap<String, String>();

result.put(MqttHeader.MQTT_TOPIC.getName(), getTopicAsString(genericMqttPublish));
result.put(MqttHeader.MQTT_QOS.getName(), getQosAsString(genericMqttPublish));
result.put(MqttHeader.MQTT_RETAIN.getName(), getRetainAsString(genericMqttPublish));
result.put(MqttHeader.MQTT_QOS.getName(), getQosCodeAsString(genericMqttPublish));
result.put(MqttHeader.MQTT_RETAIN.getName(), getIsRetainAsString(genericMqttPublish));

genericMqttPublish.getCorrelationData()
.map(ByteBufferUtils::toUtf8String)
Expand All @@ -179,12 +179,12 @@ private static String getTopicAsString(final GenericMqttPublish genericMqttPubli
return String.valueOf(genericMqttPublish.getTopic());
}

private static String getQosAsString(final GenericMqttPublish genericMqttPublish) {
private static String getQosCodeAsString(final GenericMqttPublish genericMqttPublish) {
final var mqttQos = genericMqttPublish.getQos();
return String.valueOf(mqttQos.getCode());
}

private static String getRetainAsString(final GenericMqttPublish genericMqttPublish) {
private static String getIsRetainAsString(final GenericMqttPublish genericMqttPublish) {
return String.valueOf(genericMqttPublish.isRetain());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@
import io.reactivex.Single;

/**
* Unit test for {@link GenericMqttClientActor}.
* Unit test for {@link MqttClientActor}.
*/
// It is crucial to use `TestActorRef` for the GenericMqttClientActor.
// This ensures that the actor runs in the same thread as the tests.
// The same thread is necessary because otherwise Mockito's static mocking
// of `GenericMqttClientFactory` would not work.
@RunWith(MockitoJUnitRunner.class)
public final class GenericMqttClientActorTest extends AbstractBaseClientActorTest {
public final class MqttClientActorTest extends AbstractBaseClientActorTest {

private static final TestConstants.FreePort FREE_PORT = new TestConstants.FreePort();

Expand Down Expand Up @@ -199,7 +199,7 @@ protected Connection getConnection(final boolean isSecure) {

@Override
protected Props createClientActor(final ActorRef proxyActor, final Connection connection) {
return GenericMqttClientActor.props(connection,
return MqttClientActor.props(connection,
proxyActor,
connectionActor.getRef(),
DittoHeaders.empty(),
Expand Down

0 comments on commit efd58c3

Please sign in to comment.