feat(sprint-8 web 2026-04-25): pages PrimeFaces conformité (compliance dashboard + rapports trimestriels + PI-SPI readiness)
Front-end web JSF/PrimeFaces pour exposer les features backend Sprints 3, 5, 7 aux compliance officers et controleurs internes. DTOs locaux (miroirs JSON, @JsonIgnoreProperties) - ComplianceSnapshotDto + ConformiteIndicateurDto (P1-NEW-7) - RapportTrimestrielDto + helpers estDraft/estSigne/estArchive (P2-NEW-3) - PispiReadinessDto + CheckResultDto + helpers estReady/estBlocked (P1-NEW-15) REST clients @RegisterRestClient configKey=unionflow-api - ComplianceDashboardRestClient : getSnapshotCurrent + getSnapshotOf(orgId) - RapportTrimestrielRestClient : lister, generer, signer, archiver, telechargerPdf - PispiReadinessRestClient : getReadiness - AuthHeaderFactory propage le token OIDC Beans @ViewScoped - ConformiteDashboardBean : init + rafraichir + couleurScore + hasAlertes - RapportsTrimestrielsBean : lister, genererRapport, signerSelection, archiverSelection, telechargerPdf via ExternalContext - PispiReadinessBean : rafraichir + gestion HTTP 503 BLOCKED + couleurStatus + couleurCheck Pages XHTML PrimeFaces (template main-template.xhtml, classes Freya) - /pages/secure/conformite/dashboard.xhtml — score global + 9 indicateurs en grille + alertes - /pages/secure/conformite/rapports-trimestriels.xhtml — table DRAFT/SIGNE/ARCHIVE + bouton générer/signer/archiver/PDF - /pages/secure/admin/pispi-readiness.xhtml — 8 checks + blocages/warnings dédiés + statut global Tests (21/21 verts, JUnit5 natif puisque AssertJ non transitif) - ConformiteDashboardBeanTest : 9 tests (couleur score success/warning/danger/secondary, hasAlertes 5 cas) - PispiReadinessBeanTest : 8 tests (couleurStatus READY/DEGRADED/BLOCKED/null, couleurCheck PASS/FAIL × severity, DTO helpers) - RapportTrimestrielDtoTest : 4 tests (estDraft/estSigne/estArchive/inconnu)
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package dev.lions.unionflow.client.view;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import dev.lions.unionflow.client.api.dto.PispiReadinessDto;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class PispiReadinessBeanTest {
|
||||
|
||||
private PispiReadinessBean bean;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
bean = new PispiReadinessBean();
|
||||
}
|
||||
|
||||
private void setReadiness(PispiReadinessDto r) throws Exception {
|
||||
Field f = PispiReadinessBean.class.getDeclaredField("readiness");
|
||||
f.setAccessible(true);
|
||||
f.set(bean, r);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurStatus — null → secondary")
|
||||
void couleurNull() {
|
||||
assertEquals("secondary", bean.getCouleurStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurStatus — READY → success")
|
||||
void couleurReady() throws Exception {
|
||||
setReadiness(new PispiReadinessDto("READY", "url", List.of(), List.of(), List.of()));
|
||||
assertEquals("success", bean.getCouleurStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurStatus — DEGRADED → warning")
|
||||
void couleurDegraded() throws Exception {
|
||||
setReadiness(new PispiReadinessDto("DEGRADED", "url", List.of(), List.of(), List.of()));
|
||||
assertEquals("warning", bean.getCouleurStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurStatus — BLOCKED → danger")
|
||||
void couleurBlocked() throws Exception {
|
||||
setReadiness(new PispiReadinessDto("BLOCKED", "url", List.of(), List.of(), List.of()));
|
||||
assertEquals("danger", bean.getCouleurStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurCheck — PASS → success quel que soit severity")
|
||||
void couleurCheckPass() {
|
||||
assertEquals("success", bean.getCouleurCheck("BLOCKING", "PASS"));
|
||||
assertEquals("success", bean.getCouleurCheck("WARNING", "PASS"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurCheck — FAIL BLOCKING → danger")
|
||||
void couleurCheckFailBlocking() {
|
||||
assertEquals("danger", bean.getCouleurCheck("BLOCKING", "FAIL"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("couleurCheck — FAIL WARNING → warning")
|
||||
void couleurCheckFailWarning() {
|
||||
assertEquals("warning", bean.getCouleurCheck("WARNING", "FAIL"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("DTO estReady / estBlocked")
|
||||
void dtoStateHelpers() {
|
||||
var ready = new PispiReadinessDto("READY", "u", List.of(), List.of(), List.of());
|
||||
var blocked = new PispiReadinessDto("BLOCKED", "u", List.of(), List.of(), List.of());
|
||||
assertTrue(ready.estReady());
|
||||
assertFalse(ready.estBlocked());
|
||||
assertFalse(blocked.estReady());
|
||||
assertTrue(blocked.estBlocked());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user