--- /dev/null
+/*
+ * Copyright © FYLAB and the Conseil Régional d'Île-de-France, 2009
+ * This file is part of L'Interface Libre et Interactive de l'Enseignement (Lilie).
+ *
+ * Lilie is free software. You can redistribute it and/or modify since
+ * you respect the terms of either (at least one of the both license) :
+ * - under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ * - the CeCILL-C as published by CeCILL-C; either version 1 of the
+ * License, or any later version
+ *
+ * There are special exceptions to the terms and conditions of the
+ * licenses as they are applied to this software. View the full text of
+ * the exception in file LICENSE.txt in the directory of this software
+ * distribution.
+ *
+ * Lilie is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * Licenses for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the CeCILL-C along with Lilie. If not, see :
+ * <http://www.gnu.org/licenses/> and
+ * <http://www.cecill.info/licences.fr.html>.
+ */
+
+package org.lilie.services.eliot
+
+import org.lilie.services.eliot.temps.importsts.rapport.StsImportRapport
+import org.lilie.services.eliot.temps.importsts.rapport.StsImportRapportHtmlBuilder
+
+/**
+ * @author othe
+ */
+class StsImportRapportHtmlBuilderTests extends GroovyTestCase {
+
+ private static final RESULTATATTENDU = """<html>
+ <head>
+ <style type='text/css'>html * {
+ margin: 0;
+/*padding: 0; SELECT NOT DISPLAYED CORRECTLY IN FIREFOX */
+}
+
+/* GENERAL */
+
+.spinner {
+ padding: 5px;
+ position: absolute;
+ right: 0;
+}
+
+body {
+ background: #fff;
+ color: #333;
+ font: 11px verdana, arial, helvetica, sans-serif;
+}
+
+a:link, a:visited, a:hover {
+ color: #666;
+ font-weight: bold;
+ text-decoration: none;
+}
+
+h1 {
+ color: #006dba;
+ font-weight: normal;
+ font-size: 16px;
+ margin: .8em 0 .3em 0;
+}
+
+ul {
+ padding-left: 15px;
+}
+
+input, select, textarea {
+ background-color: #fcfcfc;
+ border: 1px solid #ccc;
+ font: 11px verdana, arial, helvetica, sans-serif;
+ margin: 2px 0;
+ padding: 2px 4px;
+}
+select {
+ padding: 2px 2px 2px 0;
+}
+textarea {
+ width: 250px;
+ height: 150px;
+ vertical-align: top;
+}
+
+input:focus, select:focus, textarea:focus {
+ border: 1px solid #b2d1ff;
+}
+
+.body {
+ float: left;
+ margin: 0 15px 10px 15px;
+}
+
+.separator {
+ border-color:#C4C4C4;
+ border-style:dotted none none;
+ border-width:1px 0 0;
+ height:1px;
+ margin:6px 0;
+ width:100%;
+}
+
+/* NAVIGATION MENU */
+
+.nav {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ border-style: solid none solid none;
+ margin-top: 5px;
+ padding: 7px 12px;
+}
+
+.menuButton {
+ font-size: 10px;
+ padding: 0 5px;
+}
+.menuButton a {
+ color: #333;
+ padding: 4px 6px;
+}
+.menuButton a.home {
+ background: url(../images/skin/house.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+.menuButton a.list {
+ background: url(../images/skin/database_table.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+.menuButton a.create {
+ background: url(../images/skin/database_add.png) center left no-repeat;
+ color: #333;
+ padding-left: 25px;
+}
+
+/* MESSAGES AND ERRORS */
+
+.message {
+ background: #f3f8fc url(../images/skin/information.png) 8px 50% no-repeat;
+ border: 1px solid #b2d1ff;
+ color: #006dba;
+ margin: 10px 0 5px 0;
+ padding: 5px 5px 5px 30px
+}
+
+div.errors {
+ background: #fff3f3;
+ border: 1px solid red;
+ color: #cc0000;
+ margin: 10px 0 5px 0;
+ padding: 5px 0 5px 0;
+}
+div.errors ul {
+ list-style: none;
+ padding: 0;
+}
+div.errors li {
+ background: url(../images/skin/exclamation.png) 8px 0% no-repeat;
+ line-height: 16px;
+ padding-left: 30px;
+}
+
+td.errors select {
+ border: 1px solid red;
+}
+td.errors input {
+ border: 1px solid red;
+}
+
+/* TABLES */
+
+table {
+ border: 1px solid #ccc;
+ width: 100%
+}
+tr {
+ border: 0;
+}
+td, th {
+ font: 11px verdana, arial, helvetica, sans-serif;
+ line-height: 12px;
+ padding: 5px 6px;
+ text-align: left;
+ vertical-align: top;
+}
+th {
+ background: #fff url(../images/skin/shadow.jpg);
+ color: #666;
+ font-size: 11px;
+ font-weight: bold;
+ line-height: 17px;
+ padding: 2px 6px;
+}
+th a:link, th a:visited, th a:hover {
+ color: #333;
+ display: block;
+ font-size: 10px;
+ text-decoration: none;
+ width: 100%;
+}
+th.asc a, th.desc a {
+ background-position: right;
+ background-repeat: no-repeat;
+}
+th.asc a {
+ background-image: url(../images/skin/sorted_asc.gif);
+}
+th.desc a {
+ background-image: url(../images/skin/sorted_desc.gif);
+}
+
+.odd {
+ background: #f7f7f7;
+}
+.even {
+ background: #fff;
+}
+
+/* LIST */
+
+.list table {
+ border-collapse: collapse;
+}
+.list th, .list td {
+ border-left: 1px solid #ddd;
+}
+.list th:hover, .list tr:hover {
+ background: #b2d1ff;
+}
+
+/* PAGINATION */
+
+.paginateButtons {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ border-top: 0;
+ color: #666;
+ font-size: 10px;
+ overflow: hidden;
+ padding: 10px 3px;
+}
+.paginateButtons a {
+ background: #fff;
+ border: 1px solid #ccc;
+ border-color: #ccc #aaa #aaa #ccc;
+ color: #666;
+ margin: 0 3px;
+ padding: 2px 6px;
+}
+.paginateButtons span {
+ padding: 2px 3px;
+}
+
+/* DIALOG */
+
+.dialog table {
+ padding: 5px 0;
+}
+
+.prop {
+ padding: 5px;
+}
+.prop .name {
+ text-align: left;
+ width: 15%;
+ white-space: nowrap;
+}
+.prop .value {
+ text-align: left;
+ width: 85%;
+}
+
+/* ACTION BUTTONS */
+
+.buttons {
+ background: #fff url(../images/skin/shadow.jpg) bottom repeat-x;
+ border: 1px solid #ccc;
+ color: #666;
+ font-size: 10px;
+ margin-top: 5px;
+ overflow: hidden;
+ padding: 0;
+}
+
+.buttons input {
+ background: #fff;
+ border: 0;
+ color: #333;
+ cursor: pointer;
+ font-size: 10px;
+ font-weight: bold;
+ margin-left: 3px;
+ overflow: visible;
+ padding: 2px 6px;
+}
+.buttons input.delete {
+ background: transparent url(../images/skin/database_delete.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}
+.buttons input.edit {
+ background: transparent url(../images/skin/database_edit.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}
+.buttons input.save {
+ background: transparent url(../images/skin/database_save.png) 5px 50% no-repeat;
+ padding-left: 28px;
+}
+</style>
+ <style type='text/css'>html * {margin: 5;}</style>
+ <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
+ </head>
+ <body>
+ <center>
+ <h1>Rapport de synchronisation des emplois du temps de l'ENT</h1>
+ <h2>
+ <p>ETAB</p>
+ <p>2015</p>
+ <p>NOM_AUTORITE</p>
+ </h2>
+ <p>(import au 16/12/2014)</p>
+ </center>
+ <br />
+ <div id='Statistiques' class='portal-menu-separator'>
+ <h4>
+ <li>Nombre de professeurs principaux importés : 0</li>
+ <li>Nombre d'échec de création de professeurs principaux : 0</li>
+ <br />
+ <li>Nombre des enseignants mis à jour : 20</li>
+ <li>Nombre d'échec de mise à jour des enseignants : 2</li>
+ <br />
+ <li>Nombre de matières créées ou modifiées : 0</li>
+ <li>Nombre d'échec de création de matières : 0</li>
+ <br />
+ <li>Nombre de structures d'enseignement mises à jour : 0</li>
+ <li>Nombre d'échec de mise à jour de structures d'enseignement : 0</li>
+ <li>Nombre de structures d'enseignement inexistantes: 0</li>
+ <br />
+ <li>Nombre de services créés ou mis à jour: 0</li>
+ <li>Nombre d'échec de création de services : 10</li>
+ <br />
+ <li>Nombre d'enseignements créés ou mis à jour: 20</li>
+ <li>Nombre d'échec de création d'enseigements : 0</li>
+ <br />
+ <li>Nombre de cahiers de textes créés ou mis à jour: 0</li>
+ <li>Nombre d'échec de création de cahiers de textes : 0</li>
+ <br />
+ <li>Nombre d'agendas structure créés ou modifiés : 0</li>
+ <li>Nombre d'échec de création d'agendas Structure : 0</li>
+ <br />
+ <li>Nombre d'agendas enseignant créés ou modifiés : 8</li>
+ <li>Nombre d'échec de création d'agendas Enseignant :0</li>
+ <br />
+ <li>Nombre d'évènements créés : 0</li>
+ <li>Nombre d'échec de création d'évènements : 9</li>
+ <br />
+ <li>Nombre d'alternances en erreur (hors année scolaire) : 0</li>
+ </h4>
+ </div>
+ <br />
+ <br />
+ <div id='Logs' class='portal-menu-separator' />
+ <br />
+ <br />
+ <p>Fin de l'import, durée totale : 12.35 sec.</p>
+ <p>Message de fin d'import: FIN DE TRAITEMENT</p>
+ </body>
+</html>"""
+
+
+ void testGenereRapport() {
+
+ StsImportRapport rapport = new StsImportRapport(
+
+ nomEtablissement: "ETAB",
+ anneeImport: "2015",
+ nomFileStsEmp: "FICHIER_2015_STS",
+ nomFileEmpSts: "FICHIER_2015_EMP",
+ dateImport: "16/12/2014",
+ nomAutorite: "NOM_AUTORITE",
+ tempsExecution: 12350,
+ messageFinTraitement: "FIN DE TRAITEMENT",
+ nbEnseignantsImportes: 20,
+ nbEchecEnseignantsImportes: 2,
+ nbMatieresImportees: 0,
+ nbEchecMatieresImportees: 0,
+ nbStructuresImportees: 0,
+ nbEchecStructuresImportees: 0,
+ nbServicesImportes: 0,
+ nbEchecServicesImportes: 10,
+ nbEnseignementImportes: 20,
+ nbEchecEnseignementImportes: 0,
+ nbCahiersImportes: 0,
+ nbEchecCahiersImportes: 0,
+ nbProfesseursPrincipauxImportes: 0,
+ nbEchecCreationProfesseursPrincipaux: 0,
+ nbAgendaStructureCree: 0,
+ nbEchecCreationAgendaStructure: 0,
+ nbAgendaEnseignantCree: 8,
+ nbEchecCreationAgendaEnseignant: 0,
+ nbEvenementsCree: 0,
+ nbEchecCreationEvenement: 9,
+ nbAlternancesEnErreur: 0,
+ nbStructuresInexistants: 0
+ )
+
+
+ StsImportRapportHtmlBuilder anneeRapportHtmlBuilder = new StsImportRapportHtmlBuilder(
+ rapport: rapport,
+ urlCss: "CSS"
+ )
+
+ Writer writer = new StringWriter()
+ anneeRapportHtmlBuilder.writeHtml(writer)
+ println writer.toString()
+
+ assertEquals("Le fichier HTML attendu est non conforme", writer.toString(), RESULTATATTENDU)
+
+ }
+
+}