Subversion Repositories eFlore/Applications.coel

Rev

Rev 421 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.vues;

import org.tela_botanica.client.Coel;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.vues.StructureDetailPanneauVue;

import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.junit.client.GWTTestCase;

public class StructureDetailPanneauVueTest extends GWTTestCase {
        
        private Coel module = null;
        private Mediateur mediateur = null;
        
        public String getModuleName() {
                return "org.tela_botanica.Coel";
        }
        
        protected void gwtSetUp() {
                module = new Coel();
                module.onModuleLoad();
                mediateur = Registry.get(RegistreId.MEDIATEUR);
        }
        
        public void testerConstructionTxtListeOntologie() {
                StructureDetailPanneauVue vueDetail = new StructureDetailPanneauVue(mediateur);
                JSONArray json = new JSONArray(getJsonArrayListeValeursStockageLocal());
                ValeurListe ontologie = new ValeurListe(json);
                String chaineAAnalyser = "2068;;2069;;2067";

                String chaineFormatee = vueDetail.construireTxtListeOntologie(ontologie, chaineAAnalyser);
                System.out.println(chaineFormatee);
                assertEquals("Bâtiment  (ex. : Herbier), Pièce, Réserves", chaineFormatee);
        }
        
        private native JavaScriptObject getJsonArrayListeValeursStockageLocal() /*-{ 
        {"id":"1018","valeurs":[{"cmlv_id_valeur":"2067","0":"2067","cmlv_ce_parent":"1018","1":"1018","cmlv_ce_projet":"1","2":"1","cmlv_nom":"R\u00e9serves","3":"R\u00e9serves","cmlv_abreviation":"1","4":"1","cmlv_description":"Lieu de stockage des collections d'un mus\u00e9e, d'une biblioth\u00e8que, etc. qui sert \u00e0 conserver les collections, les \u00e9tudier et les g\u00e9rer mais non accessible au public.","5":"Lieu de stockage des collections d'un mus\u00e9e, d'une biblioth\u00e8que, etc. qui sert \u00e0 conserver les collections, les \u00e9tudier et les g\u00e9rer mais non accessible au public.","cmlv_ce_meta":"209","6":"209"},{"cmlv_id_valeur":"2068","0":"2068","cmlv_ce_parent":"1018","1":"1018","cmlv_ce_projet":"1","2":"1","cmlv_nom":"B\u00e2timent (ex. : Herbier)","3":"B\u00e2timent (ex. : Herbier)","cmlv_abreviation":"2","4":"2","cmlv_description":"NULL","5":"NULL","cmlv_ce_meta":"210","6":"210"},{"cmlv_id_valeur":"2069","0":"2069","cmlv_ce_parent":"1018","1":"1018","cmlv_ce_projet":"1","2":"1","cmlv_nom":"Pi\u00e8ce","3":"Pi\u00e8ce","cmlv_abreviation":"3","4":"3","cmlv_description":"NULL","5":"NULL","cmlv_ce_meta":"211","6":"211"}]} 
        }-*/;
}