diff --git a/backend/src/test/kotlin/fr/gouv/cacem/monitorenv/infrastructure/database/repositories/JpaMissionRepositoryITests.kt b/backend/src/test/kotlin/fr/gouv/cacem/monitorenv/infrastructure/database/repositories/JpaMissionRepositoryITests.kt index 0cd5c21f6..8bca88d52 100644 --- a/backend/src/test/kotlin/fr/gouv/cacem/monitorenv/infrastructure/database/repositories/JpaMissionRepositoryITests.kt +++ b/backend/src/test/kotlin/fr/gouv/cacem/monitorenv/infrastructure/database/repositories/JpaMissionRepositoryITests.kt @@ -795,101 +795,6 @@ class JpaMissionRepositoryITests : AbstractDBTests() { assertThat(updatedMission).isEqualTo(expectedUpdatedMission) } - @Test - @Transactional - fun `save Should be able to delete envActions associated with a reporting`() { - // Given - val wktReader = WKTReader() - val multipolygonString = - "MULTIPOLYGON (((-4.54877816747593 48.305559876971, -4.54997332394943 48.3059760121399, -4.54998501370013 48.3071882334181, -4.54879290083417 48.3067746138142, -4.54877816747593 48.305559876971)))" - val polygon = wktReader.read(multipolygonString) as MultiPolygon - - - val missionToUpdate = - MissionEntity( - id = 34, - missionTypes = listOf(MissionTypeEnum.LAND), - facade = "NAMO", - geom = polygon, - observationsCacem = null, - observationsCnsp = null, - startDateTimeUtc = ZonedDateTime.parse("2022-01-15T04:50:09Z"), - endDateTimeUtc = ZonedDateTime.parse("2022-01-23T20:29:03Z"), - isClosed = false, - isDeleted = false, - envActions = listOf( - EnvActionControlEntity( - id = - UUID.fromString( - "33310163-4e22-4d3d-b585-dac4431eb4b5", - ), - facade = "Facade 1", - department = "Department 1", - geom = polygon, - vehicleType = VehicleTypeEnum.VEHICLE_LAND, - isAdministrativeControl = true, - isComplianceWithWaterRegulationsControl = true, - isSafetyEquipmentAndStandardsComplianceControl = - true, - isSeafarersControl = true, - ), - ), - missionSource = MissionSourceEnum.MONITORENV, - hasMissionOrder = false, - isUnderJdp = false, - isGeometryComputedFromControls = false, - ) - val expectedUpdatedMission = - MissionEntity( - id = 34, - missionTypes = listOf(MissionTypeEnum.LAND), - facade = "NAMO", - geom = polygon, - observationsCacem = null, - observationsCnsp = null, - startDateTimeUtc = - ZonedDateTime.parse("2022-01-15T04:50:09Z"), - endDateTimeUtc = - ZonedDateTime.parse("2022-01-23T20:29:03Z"), - isClosed = false, - isDeleted = false, - envActions = listOf( - EnvActionControlEntity( - id = - UUID.fromString( - "33310163-4e22-4d3d-b585-dac4431eb4b5", - ), - facade = "Facade 1", - department = "Department 1", - geom = polygon, - vehicleType = VehicleTypeEnum.VEHICLE_LAND, - isAdministrativeControl = true, - isComplianceWithWaterRegulationsControl = true, - isSafetyEquipmentAndStandardsComplianceControl = - true, - isSeafarersControl = true, - ), - ), - missionSource = MissionSourceEnum.MONITORENV, - hasMissionOrder = false, - isUnderJdp = false, - isGeometryComputedFromControls = false, - ) - - val attachedReporting = jpaReportingRepository.findById(6) - assertThat(attachedReporting.reporting.attachedEnvActionId).isEqualTo(UUID.fromString("b8007c8a-5135-4bc3-816f-c69c7b75d807")) - - // When - jpaMissionRepository.save(missionToUpdate) - - // Then - val updatedMission = jpaMissionRepository.findFullMissionById(34) - val updatedReporting = jpaReportingRepository.findById(6) - assertThat(updatedMission.mission).isEqualTo(expectedUpdatedMission) - assertThat(updatedMission.attachedReportingIds).isEqualTo(listOf(6,7)) - assertThat(updatedReporting.reporting.attachedEnvActionId).isNull() - } - @Test @Transactional fun `delete Should set the deleted flag as true`() {