This is an automated email from the git hooks/post-receive script. New commit to branch develop-4.4.x in repository tutti. See http://git.codelutin.com/tutti.git commit 48ec93bb0731b47ad7ed2ee181fb43282a52a281 Author: Tony CHEMIT <chemit@codelutin.com> Date: Wed Feb 24 15:24:46 2016 +0100 Ajout de nouveaux tests sur le calcul du RF final --- .../GenericFormatExportServiceAno7992Test.java | 87 ++++++++++++++++++++-- 1 file changed, 79 insertions(+), 8 deletions(-) diff --git a/tutti-service/src/test/java/fr/ifremer/tutti/service/genericformat/GenericFormatExportServiceAno7992Test.java b/tutti-service/src/test/java/fr/ifremer/tutti/service/genericformat/GenericFormatExportServiceAno7992Test.java index df1b1e2..dad4bdc 100644 --- a/tutti-service/src/test/java/fr/ifremer/tutti/service/genericformat/GenericFormatExportServiceAno7992Test.java +++ b/tutti-service/src/test/java/fr/ifremer/tutti/service/genericformat/GenericFormatExportServiceAno7992Test.java @@ -26,6 +26,8 @@ package fr.ifremer.tutti.service.genericformat; import com.google.common.io.Files; import fr.ifremer.tutti.persistence.ProgressionModel; +import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModel; +import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry; import fr.ifremer.tutti.persistence.model.ProgramDataModel; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.ServiceDbResource; @@ -37,6 +39,8 @@ import org.junit.Test; import java.io.File; import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; /** * Created on 9/22/14. @@ -50,13 +54,18 @@ public class GenericFormatExportServiceAno7992Test { public static final ServiceDbResource dbResource = ServiceDbResource.readDb("dbAno7992"); public static final String CATCH_FILE_CONTENT - = "Annee;Serie;Serie_Partielle;Code_Station;Id_Operation;Poche;Code_Taxon;Code_Espece_Campagne;Nom_Scientifique;Benthos;Lot_A_Confirmer;V_HV;Num_Ordre_V_HV_H2;Tot_V_HV;Ech_V_HV;Type_Volume_Poids_V_HV;Unite_Volume_Poids_V_HV;Commentaire_V_HV;Class_Tri;Num_Ordre_Class_Tri_H2;Tot_Class_Tri;Ech_Class_Tri;Type_Volume_Poids_Class_Tri;Unite_Volume_Poids_Class_Tri;Commentaire_Class_Tri;Sexe;Num_Ordre_Sexe_H2;Tot_Sexe;Ech_Sexe;Type_Volume_Poids_Sexe;Unite_Volume_Poids_Sexe;Commentaire [...] - "2015;Campagne EVHOE;;T0696;1;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;3.2;;Poids;kg;;NA;;;;;kg;;Male;1;2.54;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;2.54;2.519685;2.3188405;CAM-EVHOE;311;100004;NA;;300;100005;NA;;NA;\n" + - "2015;Campagne EVHOE;;T0696;1;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;3.2;;Poids;kg;;NA;;;;;kg;;Femelle;2;0.22;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;0.22;29.09091;2.3188405;CAM-EVHOE;311;100004;NA;;301;100006;NA;;NA;\n" + - "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Male;1;10.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;10.0;10.0;4.0;CAM-EVHOE;311;100020;305;100021;300;100023;NA;;NA;\n" + - "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Femelle;2;5.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;41;Poids déterminé par calcul - produit/lot - totale - Inconnue;10.0;1;2.0;kg;;1;N;2.0;50.0;10.0;CAM-EVHOE;311;100020;305;100021;301;100024;NA;;NA;\n" + - "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Femelle;2;5.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;41;Poids déterminé par calcul - produit/lot - totale - Inconnue;11.0;2;3.0;kg;;1;N;3.0;33.333332;6.6666665;CAM-EVHOE;311;100020;305;100021;301;100024;NA;;NA;\n" + - "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;P - Petit;2;20.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;20.0;5.0;2.0;CAM-EVHOE;311;100020;307;100022;NA;;NA;;NA;\n"; + = "Annee;Serie;Serie_Partielle;Code_Station;Id_Operation;Poche;Code_Taxon;Code_Espece_Campagne;Nom_Scientifique;Benthos;Lot_A_Confirmer;V_HV;Num_Ordre_V_HV_H2;Tot_V_HV;Ech_V_HV;Type_Volume_Poids_V_HV;Unite_Volume_Poids_V_HV;Commentaire_V_HV;Class_Tri;Num_Ordre_Class_Tri_H2;Tot_Class_Tri;Ech_Class_Tri;Type_Volume_Poids_Class_Tri;Unite_Volume_Poids_Class_Tri;Commentaire_Class_Tri;Sexe;Num_Ordre_Sexe_H2;Tot_Sexe;Ech_Sexe;Type_Volume_Poids_Sexe;Unite_Volume_Poids_Sexe;Commentaire [...] + "2015;Campagne EVHOE;;A;1;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;3.2;;Poids;kg;;NA;;;;;kg;;Male;1;2.54;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;2.54;2.519685;2.3188405;CAM-EVHOE;311;100004;NA;;300;100005;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;1;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;3.2;;Poids;kg;;NA;;;;;kg;;Femelle;2;0.22;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;0.22;29.09091;2.3188405;CAM-EVHOE;311;100004;NA;;301;100006;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Male;1;10.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;41;Poids déterminé par calcul - produit/lot - totale - Inconnue;10.0;1;2.0;kg;;1;N;2.0;100.0;20.0;CAM-EVHOE;311;100020;305;100021;300;100023;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Male;1;10.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;41;Poids déterminé par calcul - produit/lot - totale - Inconnue;11.0;2;3.0;kg;;1;N;3.0;66.666664;13.333333;CAM-EVHOE;311;100020;305;100021;300;100023;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;30.0;;Poids;kg;;Femelle;2;5.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;5.0;40.0;8.0;CAM-EVHOE;311;100020;305;100021;301;100024;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;2;1;1662;TRAC-TRA;Trachurus trachurus;N;N;Vrac;1;100.0;;Poids;kg;;P - Petit;2;20.0;10.0;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;10.0;20.0;8.0;CAM-EVHOE;311;100020;307;100022;NA;;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;3;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;20.0;;Poids;kg;;Male;1;5.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;5.0;40.0;4.0;CAM-EVHOE;311;100033;305;100034;300;100036;NA;;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;3;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;20.0;;Poids;kg;;Femelle;2;15.0;;Poids;kg;;Floches;1;5.0;;Poids;kg;;NA;;;;;kg;;DEAD - Mort;1;1.0;0.5;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;0.5;400.0;32.0;CAM-EVHOE;311;100033;305;100034;301;100037;2496;100038;NA;;2420;100042;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;3;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;20.0;;Poids;kg;;Femelle;2;15.0;;Poids;kg;;Floches;1;5.0;;Poids;kg;;NA;;;;;kg;;ALIVE - Vivant;2;1.5;0.75;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;0.75;266.66666;32.0;CAM-EVHOE;311;100033;305;100034;301;100037;2496;100038;NA;;2421;100043;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;3;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;100.0;;Poids;kg;;G - Gros;1;20.0;;Poids;kg;;Femelle;2;15.0;;Poids;kg;;Cassees;2;2.5;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;2.5;80.0;8.0;CAM-EVHOE;311;100033;305;100034;301;100037;2497;100039;NA;;NA;;NA;;NA;\n" + + "2015;Campagne EVHOE;;A;3;1;949;NEPH-NOR;Nephrops norvegicus;N;N;Vrac;1;100.0;;Poids;kg;;P - Petit;2;30.0;;Poids;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;NA;;;;;kg;;;;;;;;;;?;30.0;6.6666665;4.0;CAM-EVHOE;311;100033;307;100035;NA;;NA;;NA;;NA;;NA;;NA;\n"; protected GenericFormatExportService service; @@ -74,6 +83,7 @@ public class GenericFormatExportServiceAno7992Test { public static final String OPERATION_1_ID = "100000"; public static final String OPERATION_2_ID = "100001"; + public static final String OPERATION_3_ID = "100002"; @Before public void setUp() throws Exception { @@ -91,7 +101,7 @@ public class GenericFormatExportServiceAno7992Test { service = serviceContext.getService(GenericFormatExportService.class); - dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_ID, 2, OPERATION_1_ID,OPERATION_2_ID); + dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_ID, 3, OPERATION_1_ID,OPERATION_2_ID, OPERATION_3_ID); progressionModel = new ProgressionModel(); @@ -111,6 +121,67 @@ public class GenericFormatExportServiceAno7992Test { ProgramDataModel dataToExport = persistenceService.loadCruises(programId, true, cruiseId); + List<SampleCategoryModelEntry> categoryList = new ArrayList<>(); + + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("V_HV"); + sampleCategoryModelEntry.setOrder(0); + sampleCategoryModelEntry.setCategoryId(1428); + categoryList.add(sampleCategoryModelEntry); + } + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("Class_Tri"); + sampleCategoryModelEntry.setOrder(1); + sampleCategoryModelEntry.setCategoryId(198); + categoryList.add(sampleCategoryModelEntry); + } + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("Sexe"); + sampleCategoryModelEntry.setOrder(2); + sampleCategoryModelEntry.setCategoryId(196); + categoryList.add(sampleCategoryModelEntry); + } + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("Etat"); + sampleCategoryModelEntry.setOrder(3); + sampleCategoryModelEntry.setCategoryId(1682); + categoryList.add(sampleCategoryModelEntry); + } + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("Age"); + sampleCategoryModelEntry.setOrder(4); + sampleCategoryModelEntry.setCategoryId(1702); + categoryList.add(sampleCategoryModelEntry); + } + { + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("etat_sante"); + sampleCategoryModelEntry.setOrder(5); + sampleCategoryModelEntry.setCategoryId(1478); + categoryList.add(sampleCategoryModelEntry); + }{ + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("age_coquille"); + sampleCategoryModelEntry.setOrder(6); + sampleCategoryModelEntry.setCategoryId(1418); + categoryList.add(sampleCategoryModelEntry); + }{ + SampleCategoryModelEntry sampleCategoryModelEntry = new SampleCategoryModelEntry(); + sampleCategoryModelEntry.setCode("age2"); + sampleCategoryModelEntry.setOrder(7); + sampleCategoryModelEntry.setCategoryId(101); + categoryList.add(sampleCategoryModelEntry); + } + + categoryList.forEach(sampleCategoryModelEntry -> sampleCategoryModelEntry.load(persistenceService)); + + persistenceService.setSampleCategoryModel(new SampleCategoryModel(categoryList)); + GenericFormatExportConfiguration exportConfiguration = new GenericFormatExportConfiguration(); exportConfiguration.setExportFile(exportFile); exportConfiguration.setExportAttachments(false); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.