diff --git a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/CoapMessageHandlingTest.kt b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/CoapMessageHandlingTest.kt index 5d2b968c..41ea2b2f 100644 --- a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/CoapMessageHandlingTest.kt +++ b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/CoapMessageHandlingTest.kt @@ -41,7 +41,7 @@ import org.springframework.test.annotation.DirtiesContext "\${kafka.consumers.command.topic}", "\${kafka.consumers.pre-shared-key.topic}", "\${kafka.producers.command-feedback.topic}", - "\${kafka.producers.device-message.topic}" + "\${kafka.producers.device-message.topic}", ] ) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @@ -89,7 +89,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK, null, - Command.CommandStatus.PENDING + Command.CommandStatus.PENDING, ) ) commandRepository.save( @@ -100,7 +100,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK_SET, null, - Command.CommandStatus.PENDING + Command.CommandStatus.PENDING, ) ) @@ -124,7 +124,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK, null, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) ) commandRepository.save( @@ -135,7 +135,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK_SET, null, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) ) @@ -164,7 +164,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK, null, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) ) commandRepository.save( @@ -175,7 +175,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.PSK_SET, null, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) ) @@ -204,7 +204,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.REBOOT, null, - Command.CommandStatus.PENDING + Command.CommandStatus.PENDING, ) commandRepository.save(pendingCommand) @@ -222,7 +222,7 @@ class CoapMessageHandlingTest { val savedCommand = commandRepository.findFirstByDeviceIdAndStatusOrderByTimestampIssuedAsc( DEVICE_ID, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) assertThat(savedCommand).isNotNull() @@ -244,7 +244,7 @@ class CoapMessageHandlingTest { Instant.now(), Command.CommandType.REBOOT, "reboot", - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) commandRepository.save(commandInProgress) @@ -261,7 +261,7 @@ class CoapMessageHandlingTest { val savedCommand = commandRepository.findFirstByDeviceIdAndStatusOrderByTimestampIssuedAsc( DEVICE_ID, - Command.CommandStatus.SUCCESSFUL + Command.CommandStatus.SUCCESSFUL, ) assertThat(savedCommand).isNotNull diff --git a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/DeviceCredentialsRetrievalTest.kt b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/DeviceCredentialsRetrievalTest.kt index 3850838b..72b88c5d 100644 --- a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/DeviceCredentialsRetrievalTest.kt +++ b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/DeviceCredentialsRetrievalTest.kt @@ -24,9 +24,7 @@ import org.springframework.kafka.test.context.EmbeddedKafka import org.springframework.test.annotation.DirtiesContext @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) -@EmbeddedKafka( - topics = ["\${kafka.producers.device-message.topic}"], -) +@EmbeddedKafka(topics = ["\${kafka.producers.device-message.topic}"]) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) class DeviceCredentialsRetrievalTest { companion object { diff --git a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/IntegrationTestHelper.kt b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/IntegrationTestHelper.kt index bc716e7c..966d9d7b 100644 --- a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/IntegrationTestHelper.kt +++ b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/IntegrationTestHelper.kt @@ -23,7 +23,7 @@ import org.springframework.util.ResourceUtils object IntegrationTestHelper { fun createKafkaConsumer( embeddedKafkaBroker: EmbeddedKafkaBroker, - topic: String + topic: String, ): Consumer { val testProperties = KafkaTestUtils.consumerProps("testGroup", "true", embeddedKafkaBroker) val consumerFactory = @@ -32,7 +32,7 @@ object IntegrationTestHelper { StringDeserializer(), AvroDeserializer( listOf(DeviceMessage.getClassSchema(), CommandFeedback.getClassSchema(), Firmwares.getClassSchema()) - ) + ), ) val consumer = consumerFactory.createConsumer() embeddedKafkaBroker.consumeFromAnEmbeddedTopic(consumer, topic) @@ -57,7 +57,7 @@ object IntegrationTestHelper { ProducerConfig.LINGER_MS_CONFIG to 1, ProducerConfig.BUFFER_MEMORY_CONFIG to "33554432", ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG to StringSerializer::class.java, - ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to AvroSerializer::class.java + ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG to AvroSerializer::class.java, ) } diff --git a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MakiCommandHandlingTest.kt b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MakiCommandHandlingTest.kt index 72ca00d6..e986c7c1 100644 --- a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MakiCommandHandlingTest.kt +++ b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MakiCommandHandlingTest.kt @@ -83,7 +83,7 @@ class MakiCommandHandlingTest { val savedCommand = commandRepository.findFirstByDeviceIdAndStatusOrderByTimestampIssuedAsc( DEVICE_ID, - org.gxf.crestdeviceservice.command.entity.Command.CommandStatus.PENDING + org.gxf.crestdeviceservice.command.entity.Command.CommandStatus.PENDING, ) assertThat(savedCommand).isNotNull diff --git a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MessageHandlingTest.kt b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MessageHandlingTest.kt index 6a7e93f9..f20c3ba1 100644 --- a/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MessageHandlingTest.kt +++ b/application/src/integrationTest/kotlin/org/gxf/crestdeviceservice/MessageHandlingTest.kt @@ -24,9 +24,7 @@ import org.springframework.test.annotation.DirtiesContext import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) -@EmbeddedKafka( - topics = ["\${kafka.producers.device-message.topic}"], -) +@EmbeddedKafka(topics = ["\${kafka.producers.device-message.topic}"]) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) @EnableConfigurationProperties(KafkaProducerProperties::class) class MessageHandlingTest { diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/consumer/CommandConsumer.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/consumer/CommandConsumer.kt index 45065a23..f68bd72b 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/consumer/CommandConsumer.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/consumer/CommandConsumer.kt @@ -18,7 +18,7 @@ import org.springframework.stereotype.Service class CommandConsumer( private val commandService: CommandService, private val commandFeedbackService: CommandFeedbackService, - private val pskService: PskService + private val pskService: PskService, ) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/entity/Command.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/entity/Command.kt index 16d1e6a5..d18596fc 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/entity/Command.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/entity/Command.kt @@ -55,6 +55,6 @@ class Command( IN_PROGRESS, SUCCESSFUL, ERROR, - CANCELLED + CANCELLED, } } diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/generator/FirmwareCommandGenerator.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/generator/FirmwareCommandGenerator.kt index 90aa42f6..143580a8 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/generator/FirmwareCommandGenerator.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/generator/FirmwareCommandGenerator.kt @@ -8,9 +8,7 @@ import org.gxf.crestdeviceservice.firmware.service.FirmwareService import org.springframework.stereotype.Component @Component -class FirmwareCommandGenerator( - private val firmwareService: FirmwareService, -) : CommandGenerator { +class FirmwareCommandGenerator(private val firmwareService: FirmwareService) : CommandGenerator { override fun generateCommandString(command: Command): String { requireNotNull(command.commandValue) { "commandValue should have a firmware name" } val deviceId = command.deviceId diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandFeedbackMapper.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandFeedbackMapper.kt index 8d319276..e63eb6e6 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandFeedbackMapper.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandFeedbackMapper.kt @@ -13,7 +13,7 @@ object CommandFeedbackMapper { fun commandEntityToCommandFeedback( command: Command, status: ExternalCommandStatus, - message: String + message: String, ): CommandFeedback = CommandFeedback.newBuilder() .setDeviceId(command.deviceId) @@ -26,7 +26,7 @@ object CommandFeedbackMapper { fun externalCommandToCommandFeedback( command: ExternalCommand, status: ExternalCommandStatus, - message: String + message: String, ): CommandFeedback = CommandFeedback.newBuilder() .setDeviceId(command.deviceId) diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandMapper.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandMapper.kt index 7d5f6ed4..f20ce64d 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandMapper.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/mapper/CommandMapper.kt @@ -18,7 +18,7 @@ object CommandMapper { timestampIssued = externalCommand.timestamp, type = commandNameToType(externalCommand.command), status = status, - commandValue = externalCommand.value + commandValue = externalCommand.value, ) } catch (exception: IllegalArgumentException) { throw CommandValidationException("Command unknown: ${externalCommand.command}") diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/repository/CommandRepository.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/repository/CommandRepository.kt index db764015..e3c3ed8e 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/repository/CommandRepository.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/repository/CommandRepository.kt @@ -16,12 +16,12 @@ interface CommandRepository : CrudRepository { fun findAllByDeviceIdAndStatusOrderByTimestampIssuedAsc( deviceId: String, - status: Command.CommandStatus + status: Command.CommandStatus, ): List fun findAllByDeviceIdAndTypeAndStatusOrderByTimestampIssuedAsc( deviceId: String, type: Command.CommandType, - status: Command.CommandStatus + status: Command.CommandStatus, ): List } diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/CommandResultHandler.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/CommandResultHandler.kt index 86ed6a0a..97e3ff42 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/CommandResultHandler.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/CommandResultHandler.kt @@ -13,7 +13,7 @@ import org.gxf.crestdeviceservice.model.ErrorUrc.Companion.getMessageFromCode abstract class CommandResultHandler( private val commandService: CommandService, - private val commandFeedbackService: CommandFeedbackService + private val commandFeedbackService: CommandFeedbackService, ) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/FirmwareCommandResultHandler.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/FirmwareCommandResultHandler.kt index 71b1408f..aa0c62bc 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/FirmwareCommandResultHandler.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/FirmwareCommandResultHandler.kt @@ -12,7 +12,7 @@ import org.springframework.stereotype.Component @Component class FirmwareCommandResultHandler( val commandService: CommandService, - val commandFeedbackService: CommandFeedbackService + val commandFeedbackService: CommandFeedbackService, ) : CommandResultHandler(commandService, commandFeedbackService) { private val successUrc = "OTA:SUC" diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandler.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandler.kt index 6c2a5986..3262547f 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandler.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandler.kt @@ -16,7 +16,7 @@ import org.springframework.stereotype.Component class PskSetCommandResultHandler( val pskService: PskService, val commandService: CommandService, - val commandFeedbackService: CommandFeedbackService + val commandFeedbackService: CommandFeedbackService, ) : CommandResultHandler(commandService, commandFeedbackService) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandFeedbackService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandFeedbackService.kt index 64b8005f..b9df4344 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandFeedbackService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandFeedbackService.kt @@ -22,7 +22,7 @@ import org.springframework.stereotype.Service @Service class CommandFeedbackService( private val kafkaTemplate: KafkaTemplate, - kafkaProducerProperties: KafkaProducerProperties + kafkaProducerProperties: KafkaProducerProperties, ) { private val topic = kafkaProducerProperties.commandFeedback.topic diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandResultService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandResultService.kt index 9d300b94..2ebaaee7 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandResultService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandResultService.kt @@ -13,7 +13,7 @@ import org.springframework.stereotype.Service @Service class CommandResultService( private val commandService: CommandService, - private val commandResultHandlersByType: Map + private val commandResultHandlersByType: Map, ) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandService.kt index 9f939a2d..37122608 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/command/service/CommandService.kt @@ -15,7 +15,7 @@ import org.springframework.stereotype.Service @Service class CommandService( private val commandRepository: CommandRepository, - private val commandFeedbackService: CommandFeedbackService + private val commandFeedbackService: CommandFeedbackService, ) { private val logger = KotlinLogging.logger {} @@ -42,7 +42,7 @@ class CommandService( private fun deviceHasNewerSameCommand( deviceId: String, commandType: Command.CommandType, - timestampNewCommand: Instant + timestampNewCommand: Instant, ): Boolean { val latestCommandInDatabase = getLatestCommandInDatabase(deviceId, commandType) ?: return false @@ -55,7 +55,7 @@ class CommandService( .findAllByDeviceIdAndTypeAndStatusOrderByTimestampIssuedAsc( deviceId, commandType, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) .isNotEmpty() @@ -93,7 +93,7 @@ class CommandService( fun getFirstCommandInProgressForDevice(deviceId: String) = commandRepository.findFirstByDeviceIdAndStatusOrderByTimestampIssuedAsc( deviceId, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) fun getAllPendingCommandsForDevice(deviceId: String) = @@ -102,7 +102,7 @@ class CommandService( fun getAllCommandsInProgressForDevice(deviceId: String) = commandRepository.findAllByDeviceIdAndStatusOrderByTimestampIssuedAsc( deviceId, - Command.CommandStatus.IN_PROGRESS + Command.CommandStatus.IN_PROGRESS, ) fun saveCommand(command: Command) = commandRepository.save(command) diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaConfiguration.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaConfiguration.kt index 702c944f..53dcef27 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaConfiguration.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaConfiguration.kt @@ -34,7 +34,7 @@ class KafkaConfiguration(private val kafkaProperties: KafkaProperties, private v DefaultKafkaConsumerFactory( kafkaProperties.buildConsumerProperties(sslBundles), StringDeserializer(), - AvroDeserializer(listOf(DeviceCredentials.getClassSchema(), Command.getClassSchema())) + AvroDeserializer(listOf(DeviceCredentials.getClassSchema(), Command.getClassSchema())), ) @Bean @@ -45,6 +45,6 @@ class KafkaConfiguration(private val kafkaProperties: KafkaProperties, private v DefaultKafkaProducerFactory( kafkaProperties.buildProducerProperties(sslBundles), StringSerializer(), - AvroSerializer() + AvroSerializer(), ) } diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaProducerProperties.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaProducerProperties.kt index 46171f73..acb0a4be 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaProducerProperties.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/config/KafkaProducerProperties.kt @@ -9,5 +9,5 @@ import org.springframework.boot.context.properties.ConfigurationProperties class KafkaProducerProperties( val deviceMessage: KafkaProducerTopicProperties, val commandFeedback: KafkaProducerTopicProperties, - val firmware: KafkaProducerTopicKeyProperties + val firmware: KafkaProducerTopicKeyProperties, ) diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/consumer/IncomingDeviceCredentialsConsumer.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/consumer/IncomingDeviceCredentialsConsumer.kt index e9598af4..e5673af5 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/consumer/IncomingDeviceCredentialsConsumer.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/consumer/IncomingDeviceCredentialsConsumer.kt @@ -21,7 +21,7 @@ class IncomingDeviceCredentialsConsumer( private val deviceService: DeviceService, private val pskService: PskService, private val pskDecryptionService: PskDecryptionService, - private val commandService: CommandService + private val commandService: CommandService, ) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/FirmwareController.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/FirmwareController.kt index 95fef3ee..2099a2af 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/FirmwareController.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/FirmwareController.kt @@ -18,10 +18,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes @Controller @RequestMapping("/web/firmware") -class FirmwareController( - val firmwareService: FirmwareService, - val firmwareProducerService: FirmwareProducerService, -) { +class FirmwareController(val firmwareService: FirmwareService, val firmwareProducerService: FirmwareProducerService) { private val logger = KotlinLogging.logger {} private val redirectUrl = "redirect:/web/firmware" diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/RspController.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/RspController.kt index 16062f49..9fbad5ee 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/RspController.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/controller/RspController.kt @@ -42,7 +42,7 @@ class RspController(private val commandService: CommandService) { timestampIssued = Instant.now(), type = commandType, status = Command.CommandStatus.PENDING, - commandValue = null + commandValue = null, ) ) } diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/DownlinkService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/DownlinkService.kt index 0b971adb..6eaa79f7 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/DownlinkService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/DownlinkService.kt @@ -20,7 +20,7 @@ class DownlinkService( private val pskService: PskService, private val commandService: CommandService, private val messageProperties: MessageProperties, - commandGenerators: List + commandGenerators: List, ) { private val logger = KotlinLogging.logger {} diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/MessageProducerService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/MessageProducerService.kt index 72c6bdda..895c9705 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/MessageProducerService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/MessageProducerService.kt @@ -15,7 +15,7 @@ import org.springframework.stereotype.Service @Service class MessageProducerService( private val kafkaTemplate: KafkaTemplate, - private val kafkaProducerProperties: KafkaProducerProperties + private val kafkaProducerProperties: KafkaProducerProperties, ) { private val logger = KotlinLogging.logger {} @@ -28,7 +28,7 @@ class MessageProducerService( deviceId = message["ID"].toString() timestamp = Instant.now().toEpochMilli() payload = message.toString() - } + }, ) } } diff --git a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/PayloadService.kt b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/PayloadService.kt index 181cead8..2e45ab44 100644 --- a/application/src/main/kotlin/org/gxf/crestdeviceservice/service/PayloadService.kt +++ b/application/src/main/kotlin/org/gxf/crestdeviceservice/service/PayloadService.kt @@ -43,7 +43,7 @@ class PayloadService( private fun addFirmwareCommandIfRequested( deviceMessage: DeviceMessage, identity: String, - downlink: Downlink + downlink: Downlink, ): Command? = deviceMessage .getFotaMessageCounter() diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/CommandFactory.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/CommandFactory.kt index e3407df5..42dd3cf4 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/CommandFactory.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/CommandFactory.kt @@ -19,7 +19,7 @@ object CommandFactory { timestampIssued = timestamp, type = Command.CommandType.PSK, commandValue = null, - status = Command.CommandStatus.PENDING + status = Command.CommandStatus.PENDING, ) fun pendingPskSetCommand() = @@ -30,13 +30,13 @@ object CommandFactory { timestampIssued = timestamp, type = Command.CommandType.PSK_SET, commandValue = null, - status = Command.CommandStatus.PENDING + status = Command.CommandStatus.PENDING, ) fun pendingRebootCommand( timestampIssued: Instant = timestamp, correlationId: UUID = CORRELATION_ID, - status: Command.CommandStatus = Command.CommandStatus.PENDING + status: Command.CommandStatus = Command.CommandStatus.PENDING, ) = Command( id = UUID.randomUUID(), @@ -45,7 +45,7 @@ object CommandFactory { timestampIssued = timestampIssued, type = Command.CommandType.REBOOT, commandValue = null, - status = status + status = status, ) fun rebootCommandInProgress() = pendingRebootCommand().start() @@ -64,7 +64,7 @@ object CommandFactory { timestampIssued = timestamp, type = Command.CommandType.FIRMWARE, commandValue = "the-firmware-to-install", - status = Command.CommandStatus.IN_PROGRESS + status = Command.CommandStatus.IN_PROGRESS, ) fun rspCommandInProgress() = @@ -75,7 +75,7 @@ object CommandFactory { timestampIssued = timestamp, type = Command.CommandType.RSP, commandValue = null, - status = Command.CommandStatus.IN_PROGRESS + status = Command.CommandStatus.IN_PROGRESS, ) fun rsp2CommandInProgress() = @@ -86,6 +86,6 @@ object CommandFactory { timestampIssued = timestamp, type = Command.CommandType.RSP2, commandValue = null, - status = Command.CommandStatus.IN_PROGRESS + status = Command.CommandStatus.IN_PROGRESS, ) } diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/entity/CommandTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/entity/CommandTest.kt index 6aa129a8..b4f2d675 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/entity/CommandTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/entity/CommandTest.kt @@ -30,6 +30,6 @@ class CommandTest { Instant.now(), commandType, value, - Command.CommandStatus.PENDING + Command.CommandStatus.PENDING, ) } diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskCommandGeneratorTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskCommandGeneratorTest.kt index 575e5e00..e7341bf4 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskCommandGeneratorTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskCommandGeneratorTest.kt @@ -32,7 +32,7 @@ class PskCommandGeneratorTest { "1234567890123456,ce2eca02d7ce354830eae7dd3b140755334f9c00582a53044655adde22126071,secret", "1234567890123456,78383f73855e7595f8d31ee7cabdf854bc4e70d036f225f8d144d566083c7d01,different-secret", "6543210987654321,5e15cf0f8a55b58a54f51dda17c1d1645ebc145f912888ec2e02a55d7b7baea4,secret", - "6543210987654321,64904d94590a354cecd8e65630289bcc22103c07b08c009b0b12a8ef0d58af9d,different-secret" + "6543210987654321,64904d94590a354cecd8e65630289bcc22103c07b08c009b0b12a8ef0d58af9d,different-secret", ) fun shouldCreateACorrectPskSetCommandWithHash(key: String, expectedHash: String, usedSecret: String) { val pskCommandPending = CommandFactory.pendingPskCommand() diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskSetCommandGeneratorTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskSetCommandGeneratorTest.kt index 704a8273..3785e65c 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskSetCommandGeneratorTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/generator/PskSetCommandGeneratorTest.kt @@ -32,7 +32,7 @@ class PskSetCommandGeneratorTest { "1234567890123456,ce2eca02d7ce354830eae7dd3b140755334f9c00582a53044655adde22126071,secret", "1234567890123456,78383f73855e7595f8d31ee7cabdf854bc4e70d036f225f8d144d566083c7d01,different-secret", "6543210987654321,5e15cf0f8a55b58a54f51dda17c1d1645ebc145f912888ec2e02a55d7b7baea4,secret", - "6543210987654321,64904d94590a354cecd8e65630289bcc22103c07b08c009b0b12a8ef0d58af9d,different-secret" + "6543210987654321,64904d94590a354cecd8e65630289bcc22103c07b08c009b0b12a8ef0d58af9d,different-secret", ) fun shouldCreateACorrectPskSetCommandWithHash(key: String, expectedHash: String, usedSecret: String) { val pskCommandPending = CommandFactory.pendingPskCommand() diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandlerTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandlerTest.kt index 447146dd..11443e2d 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandlerTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/command/resulthandler/PskSetCommandResultHandlerTest.kt @@ -61,7 +61,7 @@ class PskSetCommandResultHandlerTest { verify { commandFeedbackService.sendErrorFeedback( command, - match { error -> error.contains("Set PSK does not equal earlier PSK") } + match { error -> error.contains("Set PSK does not equal earlier PSK") }, ) } } diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/DownlinkServiceTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/DownlinkServiceTest.kt index 605cfc8c..225112d0 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/DownlinkServiceTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/DownlinkServiceTest.kt @@ -53,7 +53,7 @@ class DownlinkServiceTest { pskService, commandService, messageProperties, - listOf(pskCommandGenerator, pskSetCommandGenerator) + listOf(pskCommandGenerator, pskSetCommandGenerator), ) } diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/FirmwareProducerServiceTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/FirmwareProducerServiceTest.kt index c641deab..cbf6d22d 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/FirmwareProducerServiceTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/FirmwareProducerServiceTest.kt @@ -40,7 +40,7 @@ class FirmwareProducerServiceTest { KafkaProducerProperties( KafkaProducerTopicProperties(DEVICE_MESSAGE_TOPIC), KafkaProducerTopicProperties(COMMAND_FEEDBACK_TOPIC), - KafkaProducerTopicKeyProperties(FIRMWARE_TOPIC, FIRMWARE_KEY) + KafkaProducerTopicKeyProperties(FIRMWARE_TOPIC, FIRMWARE_KEY), ) service = FirmwareProducerService(kafkaTemplate, kafkaProducerProperties, firmwareService, firmwareMapper) diff --git a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/MessageProducerServiceTest.kt b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/MessageProducerServiceTest.kt index c27d2517..1b7b3cf4 100644 --- a/application/src/test/kotlin/org/gxf/crestdeviceservice/service/MessageProducerServiceTest.kt +++ b/application/src/test/kotlin/org/gxf/crestdeviceservice/service/MessageProducerServiceTest.kt @@ -34,7 +34,7 @@ class MessageProducerServiceTest { KafkaProducerProperties( KafkaProducerTopicProperties(DEVICE_MESSAGE_TOPIC), KafkaProducerTopicProperties(COMMAND_FEEDBACK_TOPIC), - KafkaProducerTopicKeyProperties(FIRMWARE_TOPIC, FIRMWARE_KEY) + KafkaProducerTopicKeyProperties(FIRMWARE_TOPIC, FIRMWARE_KEY), ) service = MessageProducerService(kafkaTemplate, kafkaProducerProperties) @@ -57,7 +57,7 @@ class MessageProducerServiceTest { verify { kafkaTemplate.send( DEVICE_MESSAGE_TOPIC, - match { (it is DeviceMessage) && (it.payload == jsonNode.toString()) } + match { (it is DeviceMessage) && (it.payload == jsonNode.toString()) }, ) } } diff --git a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/Firmware.kt b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/Firmware.kt index a3ca6276..123eb2af 100644 --- a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/Firmware.kt +++ b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/Firmware.kt @@ -19,5 +19,5 @@ class Firmware( val previousFirmwareId: UUID? = null, @OneToMany(mappedBy = "firmware") @Cascade(CascadeType.ALL) - val packets: MutableList = mutableListOf() + val packets: MutableList = mutableListOf(), ) diff --git a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/FirmwarePacket.kt b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/FirmwarePacket.kt index 6de69d61..109a4e28 100644 --- a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/FirmwarePacket.kt +++ b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/entity/FirmwarePacket.kt @@ -15,7 +15,7 @@ class FirmwarePacket( @ManyToOne @Id val firmware: Firmware, @Id val packetNumber: Int, @Column(length = 1024) // without this, the integration test assumes a length of 255 - val packet: String + val packet: String, ) { fun isFirstPacket() = packet.startsWith(OTA_START) diff --git a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/mapper/FirmwareMapper.kt b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/mapper/FirmwareMapper.kt index d555d0ab..2bee3619 100644 --- a/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/mapper/FirmwareMapper.kt +++ b/components/firmware/src/main/kotlin/org/gxf/crestdeviceservice/firmware/mapper/FirmwareMapper.kt @@ -30,7 +30,7 @@ class FirmwareMapper(private val firmwareRepository: FirmwareRepository) { name, getFirmwareVersionFromName(name), getPreviousFirmwareIdFromName(name), - mutableListOf() + mutableListOf(), ) val packets = mapLinesToPackets(fileContent.lines(), firmware) diff --git a/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKey.kt b/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKey.kt index 1d6cb918..41f08b74 100644 --- a/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKey.kt +++ b/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKey.kt @@ -19,5 +19,5 @@ class PreSharedKey( @Id val revision: Int, val revisionTime: Instant, @Convert(converter = DatabaseFieldEncryptor::class) val preSharedKey: String, - @Enumerated(EnumType.STRING) var status: PreSharedKeyStatus + @Enumerated(EnumType.STRING) var status: PreSharedKeyStatus, ) diff --git a/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKeyStatus.kt b/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKeyStatus.kt index d8b572b8..ea59c1ea 100644 --- a/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKeyStatus.kt +++ b/components/psk/src/main/kotlin/org/gxf/crestdeviceservice/psk/entity/PreSharedKeyStatus.kt @@ -11,5 +11,5 @@ enum class PreSharedKeyStatus { /** Acknowledged by device */ ACTIVE, INACTIVE, - INVALID + INVALID, } diff --git a/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/PSKKeyGenerator.kt b/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/PSKKeyGenerator.kt index 4aba464b..7db389ed 100644 --- a/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/PSKKeyGenerator.kt +++ b/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/PSKKeyGenerator.kt @@ -54,7 +54,7 @@ class PSKKeyGenerator { .joinToString( separator = "\n", prefix = "-----BEGIN PRIVATE KEY-----\n", - postfix = "\n-----END PRIVATE KEY-----" + postfix = "\n-----END PRIVATE KEY-----", ) private fun publicKeyToString(publicKey: PublicKey) = @@ -64,6 +64,6 @@ class PSKKeyGenerator { .joinToString( separator = "\n", prefix = "-----BEGIN PUBLIC KEY-----\n", - postfix = "\n-----END PUBLIC KEY-----" + postfix = "\n-----END PUBLIC KEY-----", ) } diff --git a/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/service/PskDecryptionServiceTest.kt b/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/service/PskDecryptionServiceTest.kt index 91a4d457..63317961 100644 --- a/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/service/PskDecryptionServiceTest.kt +++ b/components/psk/src/test/kotlin/org/gxf/crestdeviceservice/psk/service/PskDecryptionServiceTest.kt @@ -30,7 +30,7 @@ class PskDecryptionServiceTest { PskDecryptionService( PskDecryptionConfiguration( mapOf(keyRef to keyPair.private as RSAPrivateKey), - "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING" + "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING", ) ) @@ -54,7 +54,7 @@ class PskDecryptionServiceTest { PskDecryptionService( PskDecryptionConfiguration( mapOf(keyRef to keyPair.private as RSAPrivateKey), - "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING" + "RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING", ) ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a3238161..a2774eaa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ kotlin-logging = "7.0.3" mockk = "1.13.14" springmockk = "4.0.2" sonarqube = "6.0.1.5171" -spotless = "6.25.0" +spotless = "7.0.1" spring-boot = "3.4.1" [libraries]