Skip to content

Commit

Permalink
FDP-2359: Minor fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Jasper Kamerling <[email protected]>
  • Loading branch information
jasperkamerling committed Jul 30, 2024
1 parent fd9f80a commit 08a6878
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Contributors to the GXF project
//
// SPDX-License-Identifier: Apache-2.0
package org.gxf.crestdeviceservice.controller
package org.gxf.crestdeviceservice.consumer

import com.alliander.sng.DeviceCredentials
import io.github.oshai.kotlinlogging.KotlinLogging
Expand All @@ -11,7 +11,7 @@ import org.springframework.kafka.annotation.KafkaListener
import org.springframework.stereotype.Service

@Service
class IncomingDeviceCredentialsController(
class IncomingDeviceCredentialsConsumer(
private val pskService: PskService,
private val pskDecryptionService: PskDecryptionService
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Contributors to the GXF project
//
// SPDX-License-Identifier: Apache-2.0
package org.gxf.crestdeviceservice.service
package org.gxf.crestdeviceservice.model

enum class PskErrorUrc(val code: String, val message: String) {
PSK_EQER("PSK:EQER", "Set PSK does not equal earlier PSK"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package org.gxf.crestdeviceservice.service

import com.fasterxml.jackson.databind.JsonNode
import io.github.oshai.kotlinlogging.KotlinLogging
import org.gxf.crestdeviceservice.model.PskErrorUrc
import org.gxf.crestdeviceservice.psk.exception.NoExistingPskException
import org.gxf.crestdeviceservice.psk.service.PskService
import org.springframework.stereotype.Service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: Contributors to the GXF project
//
// SPDX-License-Identifier: Apache-2.0
package org.gxf.crestdeviceservice.controller
package org.gxf.crestdeviceservice.consumer

import com.alliander.sng.DeviceCredentials
import org.gxf.crestdeviceservice.psk.service.PskDecryptionService
Expand All @@ -11,11 +11,11 @@ import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever

class IncomingDeviceCredentialsControllerTest {
class IncomingDeviceCredentialsConsumerTest {
private val pskService = mock<PskService>()
private val pskDecryptionService = mock<PskDecryptionService>()
private val incomingDeviceCredentialsController =
IncomingDeviceCredentialsController(pskService, pskDecryptionService)
private val incomingDeviceCredentialsConsumer =
IncomingDeviceCredentialsConsumer(pskService, pskDecryptionService)

@Test
fun handleIncomingDeviceCredentials() {
Expand All @@ -31,7 +31,7 @@ class IncomingDeviceCredentialsControllerTest {
whenever(pskDecryptionService.decryptSecret(secret, keyRef)).thenReturn(decryptedSecret)
whenever(pskService.changeInitialPsk()).thenReturn(true)

incomingDeviceCredentialsController.handleIncomingDeviceCredentials(deviceCredentials)
incomingDeviceCredentialsConsumer.handleIncomingDeviceCredentials(deviceCredentials)

verify(pskService).setInitialKeyForIdentity(imei, decryptedPsk, decryptedSecret)
verify(pskService).generateNewReadyKeyForIdentity(imei)
Expand Down

0 comments on commit 08a6878

Please sign in to comment.