Skip to content

Commit

Permalink
remove test
Browse files Browse the repository at this point in the history
delete envAction associated with a reporting fails due to fk contraint
  • Loading branch information
thoomasbro committed Nov 2, 2023
1 parent 83494d7 commit b1593ea
Showing 1 changed file with 0 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`() {
Expand Down

0 comments on commit b1593ea

Please sign in to comment.