Skip to content

Commit

Permalink
Merge pull request #486 from MTES-MCT/fix/deployfailed-patch-1
Browse files Browse the repository at this point in the history
Update and rename GetEnvMissionById.kt to GetEnvMissionById2.kt
  • Loading branch information
aleckvincent authored Jan 9, 2025
2 parents 24546ec + d2a38cd commit c08c281
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import org.slf4j.LoggerFactory
import org.springframework.cache.annotation.Cacheable

@UseCase
class GetEnvMissionById(
class GetEnvMissionById2(
private val monitorEnvApiRepo: IEnvMissionRepository
) {
private val logger = LoggerFactory.getLogger(GetEnvMissionById::class.java)
private val logger = LoggerFactory.getLogger(GetEnvMissionById2::class.java)

@Cacheable(value = ["envMission"], key = "#missionId")
fun execute(missionId: Int?): MissionEntity? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fr.gouv.dgampa.rapportnav.config.UseCase
import fr.gouv.dgampa.rapportnav.domain.entities.aem.v2.AEMTableExport2
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.export.MissionExportEntity
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetEnvActionListByMissionId
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetEnvMissionById
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetEnvMissionById2
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetFishActionListByMissionId
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetNavActionListByMissionId
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.generalInfo.GetMissionGeneralInfoByMissionId
Expand All @@ -25,7 +25,7 @@ class ExportMissionAEM2(
@Value("\${rapportnav.aem.tmp_xlsx.path}") private val aemTmpXLSXPath: String,
@Value("\${rapportnav.aem.tmp_ods.path}") private val aemTmpODSPath: String,
private val fillAEMExcelRow: FillAEMExcelRow,
private val getEnvMissionById: GetEnvMissionById,
private val getEnvMissionById2: GetEnvMissionById2,
private val getEnvActionByMissionId: GetEnvActionListByMissionId,
private val getNavActionByMissionId: GetNavActionListByMissionId,
private val getFIshListActionByMissionId: GetFishActionListByMissionId,
Expand Down Expand Up @@ -77,7 +77,7 @@ class ExportMissionAEM2(
}

private fun getAemTableExport(missionIds: List<Int>) = missionIds.map {
val envMission = getEnvMissionById.execute(it)
val envMission = getEnvMissionById2.execute(it)
val envActions = getEnvActionByMissionId.execute(it)
val navActions = getNavActionByMissionId.execute(it)
val fishActions = getFIshListActionByMissionId.execute(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.env.MissionEntity
import fr.gouv.dgampa.rapportnav.domain.entities.mission.env.MissionSourceEnum
import fr.gouv.dgampa.rapportnav.domain.entities.mission.env.MissionTypeEnum
import fr.gouv.dgampa.rapportnav.domain.repositories.mission.IEnvMissionRepository
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetEnvMissionById
import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.v2.GetEnvMissionById2
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
import org.mockito.Mockito.*
Expand All @@ -13,11 +13,11 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.mock.mockito.MockBean
import java.time.Instant

@SpringBootTest(classes = [GetEnvMissionById::class])
class GetEnvMissionByIdTest {
@SpringBootTest(classes = [GetEnvMissionById2::class])
class GetEnvMissionById2Test {

@Autowired
private lateinit var getEnvMissionById: GetEnvMissionById
private lateinit var getEnvMissionById2: GetEnvMissionById2

@MockBean
private lateinit var monitorEnvApiRepo: IEnvMissionRepository
Expand All @@ -40,10 +40,10 @@ class GetEnvMissionByIdTest {
// Mock behavior of findMissionById to return a MissionEntity
`when`(monitorEnvApiRepo.findMissionById(missionId)).thenReturn(missionEntity)

getEnvMissionById = GetEnvMissionById(monitorEnvApiRepo)
getEnvMissionById2 = GetEnvMissionById2(monitorEnvApiRepo)

// When
val result = getEnvMissionById.execute(missionId)
val result = getEnvMissionById2.execute(missionId)

// Then
assertNotNull(result)
Expand Down

0 comments on commit c08c281

Please sign in to comment.