return smsFournisseur
}
+ public Map getParametresSms(String uai){
+
+ String hql = """
+ SELECT new map ( e.nomAffichage as nomEtablissement,
+ e.uai as uai,
+ sfe.smsMotDePasse as motDePasse,
+ sfe.smsLogin as login,
+ sf.urlEnvoiHttp as urlEnvoiHttp,
+ sf.urlEnvoiHttps as urlEnvoiHttps,
+ sf.urlSuiviHttp as urlSuiviHttp,
+ sf.nom as nomFournisseur)
+ FROM SmsFournisseurEtablissement as sfe
+ JOIN sfe.smsFournisseur as sf
+ JOIN sfe.etablissement as e
+ WHERE e.uai = :uai
+ AND sfe.actif = true
+ """
+
+ List results = SmsFournisseurEtablissement.executeQuery(hql,[uai:uai])
+
+ return results ? results.first() : [:]
+
+ }
+
}
import org.lilie.services.eliot.test.PopulationTestActeur
import org.lilie.services.eliot.test.PopulationTestEtablissement
import org.hibernate.FetchMode
+import groovy.sql.Sql
+import javax.sql.DataSource
/**
-* Tests :BackofficeServiceTests
-* @author jcok
-*/
+ * Tests :BackofficeServiceTests
+ * @author jcok
+ */
class BackofficeServiceTests extends GroovyTestCase{
BackofficeService backofficeService
BackofficeConfig backofficeConfigTest
BackofficeConfigSaveParam backofficeConfigSaveParamTest1
BackofficeConfigSaveParam backofficeConfigSaveParamTest2
-
+ DataSource dataSource
protected void setUp() {
super.setUp()
- println("SETUP")
+ println("SETUP")
// backofficeConfigTest = new BackofficeConfig(
// uai:'ABCDEF99',
// nom: 'College Serret',
// udt: false,
// nombreEleve: 200
// )
- println ('PASSAGE SETUP')
+ println ('PASSAGE SETUP')
backofficeConfigSaveParamTest1 = new BackofficeConfigSaveParam(
uai:'ABCDEF88',
nom: 'College Serret',
}
+ /*
+ * Test le SQL utilisé dans le script de vérification du nombre d'élèves
+ * remontant au service commercial les dépassements de nombre d'élèves
+ * par rapport aux prévisions (application externe)
+ */
+ void testBackofficeVerifNombreEleve(){
+
+ Sql sql = new Sql(dataSource)
+
+ def select = """
+ select
+ e.uai,
+ min(e.nom_affichage) as nom,
+ count (distinct p.id) as nbr_eleves_reel,
+ ( select nombre_eleve
+ from backoffice.backoffice_config
+ where uai = e.uai
+ ) as nbr_eleves_prevu
+ from
+ ent.personne_propriete_scolarite as pps
+ inner join
+ ent.personne as p on pps.personne_id = p.id
+ inner join
+ ent.propriete_scolarite as ps on pps.propriete_scolarite_id = ps.id
+ inner join
+ securite.autorite as a on p.autorite_id = a.id
+ inner join
+ ent.fonction as f on ps.fonction_id = f.id
+ inner join
+ ent.annee_scolaire as an on ps.annee_scolaire_id = an.id
+ inner join
+ ent.etablissement as e on ps.etablissement_id = e.id
+ where
+ a.est_active = true
+ and pps.est_active = true
+ and an.annee_en_cours = true
+ and f.code = 'ELEVE'
+ group by
+ e.uai
+ order by
+ e.uai
+ """
+ Throwable t = null
+ try{
+ sql.eachRow(select) { etablissement ->
+ //Vérifier le nombre d'élèves réel (par un service ou en vérif. cette requête)
+ }
+ }
+ catch (Exception e){
+ t = e
+ }
+ assertFalse (t instanceof Exception)
+ }
protected void tearDown() {