-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from MTES-MCT/feature/446-hasbeendone-mission…
…-action-tag feat(control): add hasBeenDone attributes and column
- Loading branch information
Showing
15 changed files
with
228 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...c/main/resources/db/migration/V1.2024.11.28.15.20__control_table_has_been_done_column.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
DO | ||
$$ | ||
BEGIN | ||
|
||
ALTER TABLE control_administrative | ||
ADD COLUMN has_been_done BOOLEAN; | ||
|
||
ALTER TABLE control_gens_de_mer | ||
ADD COLUMN has_been_done BOOLEAN; | ||
|
||
ALTER TABLE control_navigation | ||
ADD COLUMN has_been_done BOOLEAN; | ||
|
||
ALTER TABLE control_security | ||
ADD COLUMN has_been_done BOOLEAN; | ||
|
||
END | ||
$$; |
48 changes: 48 additions & 0 deletions
48
...apportnav/infrastructure/database/model/mission/control/ControlAdministrativeModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package fr.gouv.gmampa.rapportnav.infrastructure.database.model.mission.control | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlAdministrativeEntity | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.control.ControlAdministrativeModel | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import java.util.* | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(classes = [ControlAdministrativeModel::class]) | ||
class ControlAdministrativeModelTest { | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control Administrative entity`() { | ||
val hasBeenDone = false | ||
|
||
val controlAdministrative = ControlAdministrativeModel() | ||
controlAdministrative.hasBeenDone = hasBeenDone | ||
|
||
val response = controlAdministrative.toControlAdministrativeEntity() | ||
assertThat(response).isNotNull() | ||
assertThat(response.hasBeenDone).isEqualTo(hasBeenDone) | ||
} | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control Administrative Model from Entity`() { | ||
val hasBeenDone = true | ||
|
||
val entity = ControlAdministrativeEntity( | ||
id = UUID.randomUUID(), | ||
missionId = 761, | ||
amountOfControls = 3, | ||
hasBeenDone = hasBeenDone, | ||
actionControlId = "myActionId" | ||
) | ||
|
||
val response = ControlAdministrativeModel.fromControlAdministrativeEntity(entity) | ||
assertThat(response).isNotNull() | ||
assertThat(response.id).isEqualTo(entity.id) | ||
assertThat(response.missionId).isEqualTo(entity.missionId) | ||
assertThat(response.hasBeenDone).isEqualTo(entity.hasBeenDone) | ||
assertThat(response.actionControlId).isEqualTo(entity.actionControlId) | ||
assertThat(response.amountOfControls).isEqualTo(entity.amountOfControls) | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
...mpa/rapportnav/infrastructure/database/model/mission/control/ControlGensDeMerModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package fr.gouv.gmampa.rapportnav.infrastructure.database.model.mission.control | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlGensDeMerEntity | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.control.ControlGensDeMerModel | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import java.util.* | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(classes = [ControlGensDeMerModel::class]) | ||
class ControlGensDeMerModelTest { | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control gens-de-mer entity`() { | ||
val hasBeenDone = false | ||
|
||
val controlGensDeMer = ControlGensDeMerModel() | ||
controlGensDeMer.hasBeenDone = hasBeenDone | ||
|
||
val response = controlGensDeMer.toControlGensDeMerEntity() | ||
assertThat(response).isNotNull() | ||
assertThat(response.hasBeenDone).isEqualTo(hasBeenDone) | ||
} | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control gens-de-mer Model from Entity`() { | ||
val hasBeenDone = true | ||
|
||
val entity = ControlGensDeMerEntity( | ||
id = UUID.randomUUID(), | ||
missionId = 761, | ||
amountOfControls = 3, | ||
hasBeenDone = hasBeenDone, | ||
actionControlId = "myActionId" | ||
) | ||
|
||
val response = ControlGensDeMerModel.fromControlGensDeMerEntity(entity) | ||
assertThat(response).isNotNull() | ||
assertThat(response.id).isEqualTo(entity.id) | ||
assertThat(response.missionId).isEqualTo(entity.missionId) | ||
assertThat(response.hasBeenDone).isEqualTo(entity.hasBeenDone) | ||
assertThat(response.actionControlId).isEqualTo(entity.actionControlId) | ||
assertThat(response.amountOfControls).isEqualTo(entity.amountOfControls) | ||
|
||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...pa/rapportnav/infrastructure/database/model/mission/control/ControlNavigationModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package fr.gouv.gmampa.rapportnav.infrastructure.database.model.mission.control | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlNavigationEntity | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.control.ControlNavigationModel | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import java.util.* | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(classes = [ControlNavigationModel::class]) | ||
class ControlNavigationModelTest { | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control navigation entity`() { | ||
val hasBeenDone = false | ||
|
||
val controlNavigation = ControlNavigationModel(id = UUID.randomUUID()) | ||
controlNavigation.hasBeenDone = hasBeenDone | ||
|
||
val response = controlNavigation.toControlNavigationEntity() | ||
assertThat(response).isNotNull() | ||
assertThat(response.hasBeenDone).isEqualTo(hasBeenDone) | ||
} | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control navigation Model from Entity`() { | ||
val hasBeenDone = true | ||
|
||
val entity = ControlNavigationEntity( | ||
id = UUID.randomUUID(), | ||
missionId = 761, | ||
amountOfControls = 3, | ||
hasBeenDone = hasBeenDone, | ||
actionControlId = "myActionId" | ||
) | ||
|
||
val response = ControlNavigationModel.fromControlNavigationEntity(entity) | ||
assertThat(response).isNotNull() | ||
assertThat(response.id).isEqualTo(entity.id) | ||
assertThat(response.missionId).isEqualTo(entity.missionId) | ||
assertThat(response.hasBeenDone).isEqualTo(entity.hasBeenDone) | ||
assertThat(response.actionControlId).isEqualTo(entity.actionControlId) | ||
assertThat(response.amountOfControls).isEqualTo(entity.amountOfControls) | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...ampa/rapportnav/infrastructure/database/model/mission/control/ControlSecurityModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package fr.gouv.gmampa.rapportnav.infrastructure.database.model.mission.control | ||
|
||
import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.control.ControlSecurityEntity | ||
import fr.gouv.dgampa.rapportnav.infrastructure.database.model.mission.control.ControlSecurityModel | ||
import org.assertj.core.api.Assertions.assertThat | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.extension.ExtendWith | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.test.context.junit.jupiter.SpringExtension | ||
import java.util.* | ||
|
||
@ExtendWith(SpringExtension::class) | ||
@SpringBootTest(classes = [ControlSecurityModel::class]) | ||
class ControlSecurityModelTest { | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control Security entity`() { | ||
val hasBeenDone = false | ||
|
||
val controlSecurity = ControlSecurityModel(id = UUID.randomUUID()) | ||
controlSecurity.hasBeenDone = hasBeenDone | ||
|
||
val response = controlSecurity.toControlSecurityEntity() | ||
assertThat(response).isNotNull() | ||
assertThat(response.hasBeenDone).isEqualTo(hasBeenDone) | ||
} | ||
|
||
@Test | ||
fun `execute should retrieve hasBeenDone in control Security Model from Entity`() { | ||
val hasBeenDone = true | ||
|
||
val entity = ControlSecurityEntity( | ||
id = UUID.randomUUID(), | ||
missionId = 761, | ||
amountOfControls = 3, | ||
hasBeenDone = hasBeenDone, | ||
actionControlId = "myActionId" | ||
) | ||
|
||
val response = ControlSecurityModel.fromControlSecurityEntity(entity) | ||
assertThat(response).isNotNull() | ||
assertThat(response.id).isEqualTo(entity.id) | ||
assertThat(response.missionId).isEqualTo(entity.missionId) | ||
assertThat(response.hasBeenDone).isEqualTo(entity.hasBeenDone) | ||
assertThat(response.actionControlId).isEqualTo(entity.actionControlId) | ||
assertThat(response.amountOfControls).isEqualTo(entity.amountOfControls) | ||
} | ||
} |