Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe Commits: b89ed2cb by tchemit at 2019-07-16T13:37:58Z move to version 7.1.0 [skip ci] - - - - - 35286e05 by tchemit at 2019-07-16T14:58:30Z [REF] Consolidation du réferentiel common.LengthWeightParameter - Closes #1350 [REF] Consolidation du réferentiel common.LengthLengthParameter - Closes #1351 - - - - - 30 changed files: - client-configuration/pom.xml - client-core/pom.xml - client-runner/pom.xml - dto/pom.xml - observe-i18n/pom.xml - observe-i18n/src/main/i18n/translations/observe_fr_FR.properties - observe/pom.xml - persistence/pom.xml - + persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_1.java - persistence/src/main/models/Observe.model - + persistence/src/main/resources/db/migration/7.1/01_add_not_null_on_length_weight_parameters-common.sql - + persistence/src/main/resources/db/migration/7.1/02_add_not_null_on_length_length_parameters-common.sql - pom.xml - server-configuration/pom.xml - server-core/pom.xml - server-runner/pom.xml - services-client/pom.xml - services-local/pom.xml - services-local/src/main/java/fr/ird/observe/services/local/service/actions/consolidate/ConsolidateDataServiceLocal.java - services-local/src/test/java/fr/ird/observe/services/local/entity/LengthWeightParemetersTest.java - services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java - services/pom.xml - test/pom.xml - test/src/main/java/fr/ird/observe/test/ObserveFixtures.java - + test/src/main/resources/db/7.1/dataForTestLongline.sql.gz - + test/src/main/resources/db/7.1/dataForTestSeine.sql.gz - + test/src/main/resources/db/7.1/empty_h2.sql.gz - + test/src/main/resources/db/7.1/empty_pg.sql.gz - + test/src/main/resources/db/7.1/referentiel.sql.gz - validation/pom.xml Changes: ===================================== client-configuration/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>client-configuration</artifactId> ===================================== client-core/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>client-core</artifactId> ===================================== client-runner/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>client-runner</artifactId> ===================================== dto/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>dto</artifactId> ===================================== observe-i18n/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>observe-i18n</artifactId> ===================================== observe-i18n/src/main/i18n/translations/observe_fr_FR.properties ===================================== @@ -824,7 +824,7 @@ observe.common.LengthLengthParameterDto.types=Relations Taille-Taille observe.common.LengthWeightParameterDto.coefficients=Coefficients observe.common.LengthWeightParameterDto.generalTab=Caractéristiques générales observe.common.LengthWeightParameterDto.lengthWeightFormula=Relation Poids -observe.common.LengthWeightParameterDto.lengthWeightFormulaInformation=La relation poids permet de calculer le poids à partir de la taille +observe.common.LengthWeightParameterDto.lengthWeightFormulaInformation=La relation poids permet de calculer le poids à partir de la taille, elle doit contenir la variable L (length) qui représente la taille d'entrée observe.common.LengthWeightParameterDto.meanLength=Taille moyenne (en cm) observe.common.LengthWeightParameterDto.meanValues=Valeurs moyennes observe.common.LengthWeightParameterDto.meanWeight=Poids moyen (en Kg) @@ -832,7 +832,7 @@ observe.common.LengthWeightParameterDto.otherTab=Autres caractéristiques observe.common.LengthWeightParameterDto.type=Relation Taille-Poids observe.common.LengthWeightParameterDto.types=Relations Taille-Poids observe.common.LengthWeightParameterDto.weightLengthFormula=Relation Taille -observe.common.LengthWeightParameterDto.weightLengthFormulaInformation=La relation taille permet de calculer la taille à partir du poids +observe.common.LengthWeightParameterDto.weightLengthFormulaInformation=La relation taille permet de calculer la taille à partir du poids, elle doit contenir la variable P (poids) qui représente le poids d'entrée observe.common.LightsticksColorDto.type=Couleur de cyalumes observe.common.LightsticksColorDto.types=Couleurs de cyalumes observe.common.LightsticksTypeDto.type=Type de cyalumes ===================================== observe/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>observe</artifactId> ===================================== persistence/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>persistence</artifactId> ===================================== persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_1.java ===================================== @@ -0,0 +1,50 @@ +package fr.ird.observe.persistence.migration; + +/*- + * #%L + * ObServe :: Persistence + * %% + * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program 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 + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.auto.service.AutoService; +import org.nuiton.topia.service.migration.resources.MigrationVersionResource; +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor; +import org.nuiton.version.Versions; + +/** + * Created on 16/07/19. + * + * @author Tony Chemit - dev@tchemit.fr + * @since ? + */ +@AutoService(MigrationVersionResource.class) +public class DataSourceMigrationForVersion_7_1 extends MigrationVersionResource { + + public DataSourceMigrationForVersion_7_1() { + super(Versions.valueOf("7.1")); + } + + @Override + public void generateSqlScript(MigrationVersionResourceExecutor executor) { + executor.addScript("01", "add_not_null_on_length_weight_parameters"); + executor.addScript("02", "add_not_null_on_length_length_parameters"); + } + +} + ===================================== persistence/src/main/models/Observe.model ===================================== @@ -416,19 +416,19 @@ label8 + {*:1} String getLabel(referentialLocale !fr.ird.observe.dto.referential.ReferentialLocale) String referentiel.LengthLengthParameter > referentiel.FormulaSupport | entity -inputOutputFormula + {*:1} String -outputInputFormula + {*:1} String -inputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false -outputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false +inputOutputFormula + {*:1} String | notNull +outputInputFormula + {*:1} String | notNull +inputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false notNull +outputSizeMeasureType {*:1} referentiel.SizeMeasureType | lazy=false notNull abstract referentiel.LengthWeightAble referentiel.LengthWeightParameter > referentiel.FormulaSupport | entity -lengthWeightFormula + {*:1} String -weightLengthFormula + {*:1} String +lengthWeightFormula + {*:1} String | notNull +weightLengthFormula + {*:1} String | notNull meanLength + {*:1} Float meanWeight + {*:1} Float -sizeMeasureType {*:0..1} referentiel.SizeMeasureType | lazy=false +sizeMeasureType {*:0..1} referentiel.SizeMeasureType | lazy=false notNull abstract referentiel.ObserveReferentialEntity > ObserveEntity >> fr.ird.observe.dto.reference.ReferentialDtoReferenceAware | entity code + {*:1} String ===================================== persistence/src/main/resources/db/migration/7.1/01_add_not_null_on_length_weight_parameters-common.sql ===================================== @@ -0,0 +1,35 @@ +--- +-- #%L +-- ObServe :: Persistence +-- %% +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program 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 +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/gpl-3.0.html>. +-- #L% +--- +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.299'; +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.158'; +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.157'; +DELETE FROM observe_common.LengthWeightParameter WHERE topiaId = 'fr.ird.observe.entities.referentiel.LengthWeightParameter#201008191245#0.298'; +UPDATE observe_common.LengthWeightParameter SET sizeMeasureType = 'fr.ird.observe.entities.referentiel.SizeMeasureType#1433499465700#0.0902433863375336' WHERE sizeMeasureType IS NULL; +UPDATE observe_common.LengthWeightParameter SET coefficients = 'a=0.5:b=0.0' WHERE coefficients IS NULL; + +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN sizeMeasureType SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN lengthWeightFormula SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN weightLengthFormula SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN coefficients SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN ocean SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN sex SET NOT NULL; +ALTER TABLE observe_common.LengthWeightParameter ALTER COLUMN species SET NOT NULL; ===================================== persistence/src/main/resources/db/migration/7.1/02_add_not_null_on_length_length_parameters-common.sql ===================================== @@ -0,0 +1,30 @@ +--- +-- #%L +-- ObServe :: Persistence +-- %% +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io +-- %% +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as +-- published by the Free Software Foundation, either version 3 of the +-- License, or (at your option) any later version. +-- +-- This program 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 +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public +-- License along with this program. If not, see +-- <http://www.gnu.org/licenses/gpl-3.0.html>. +-- #L% +--- + +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN inputOutputFormula SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN outputInputFormula SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN inputSizeMeasureType SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN outputSizeMeasureType SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN coefficients SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN species SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN ocean SET NOT NULL; +ALTER TABLE observe_common.LengthLengthParameter ALTER COLUMN sex SET NOT NULL; ===================================== pom.xml ===================================== @@ -31,7 +31,7 @@ <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> <packaging>pom</packaging> <name>ObServe :: Pom</name> @@ -149,7 +149,7 @@ <devMode>true</devMode> <!--persistence model version--> - <observe.model.version>7.0</observe.model.version> + <observe.model.version>7.1</observe.model.version> <!-- build timestamp configuration --> <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format> ===================================== server-configuration/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>server-configuration</artifactId> ===================================== server-core/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>server-core</artifactId> ===================================== server-runner/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>server-runner</artifactId> ===================================== services-client/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>services-client</artifactId> ===================================== services-local/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>services-local</artifactId> ===================================== services-local/src/main/java/fr/ird/observe/services/local/service/actions/consolidate/ConsolidateDataServiceLocal.java ===================================== @@ -665,6 +665,12 @@ public class ConsolidateDataServiceLocal extends ObserveServiceLocal implements log.error(String.format("No size measure type found for TargetLength (%s) will use the one of the species", lengthWeightComputable.getTopiaId())); inputSizeMeasureType = species.getSizeMeasureType(); } + + if (inputSizeMeasureType == null) { + log.error(String.format("No size measure type found for Species (%s), can't continue!", species.getTopiaId())); + return; + } + Optional<LengthWeightParameter> optionalLengthWeightParameter = activityContext.findLengthWeightParameter(species, sex, inputSizeMeasureType); if (!optionalLengthWeightParameter.isPresent()) { ===================================== services-local/src/test/java/fr/ird/observe/services/local/entity/LengthWeightParemetersTest.java ===================================== @@ -31,14 +31,16 @@ import fr.ird.observe.entities.referentiel.Ocean; import fr.ird.observe.entities.referentiel.OceanTopiaDao; import fr.ird.observe.entities.referentiel.Sex; import fr.ird.observe.entities.referentiel.SexTopiaDao; +import fr.ird.observe.entities.referentiel.SizeMeasureType; +import fr.ird.observe.entities.referentiel.SizeMeasureTypeTopiaDao; import fr.ird.observe.entities.referentiel.Species; import fr.ird.observe.entities.referentiel.SpeciesTopiaDao; import fr.ird.observe.persistence.ObserveTopiaDaoSupplier; import fr.ird.observe.persistence.ObserveTopiaPersistenceContext; import fr.ird.observe.services.local.service.ServiceLocalTestSupport; import fr.ird.observe.test.spi.CopyDatabaseConfiguration; -import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -64,6 +66,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { Species species, Ocean ocean, Sex sex, + SizeMeasureType sizeMeasureType, Date startDate, Date endDate) { @@ -72,6 +75,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { entity.setSpecies(species); entity.setSex(sex); entity.setOcean(ocean); + entity.setSizeMeasureType(sizeMeasureType); entity.setStartDate(startDate); entity.setEndDate(endDate); entity.setStatus(ReferenceStatus.enabled); @@ -92,6 +96,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { SpeciesTopiaDao speciesDAO = persistenceContext.getSpeciesDao(); OceanTopiaDao oceanDAO = persistenceContext.getOceanDao(); SexTopiaDao sexDao = persistenceContext.getSexDao(); + SizeMeasureTypeTopiaDao sizeMeasureTypeDao = persistenceContext.getSizeMeasureTypeDao(); Optional<Species> optionalSpecies = Optional.ofNullable(speciesDAO.forFaoCodeEquals("ALB").tryFindUnique().orNull()); Assert.assertTrue("Could not find species with faoCode: DOL", optionalSpecies.isPresent()); @@ -105,6 +110,10 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { Optional<Sex> optionalFemaleSex = Optional.ofNullable(sexDao.forCodeEquals("2").tryFindUnique().orNull()); Assert.assertTrue("Could not find sex with code 2 (female)", optionalFemaleSex.isPresent()); + Optional<SizeMeasureType> optionalSizeMeasureType = Optional.ofNullable(sizeMeasureTypeDao.forCodeEquals("FL").tryFindUnique().orNull()); + Assert.assertTrue("Could not find sizeMeasureType with code FL", optionalSizeMeasureType.isPresent()); + SizeMeasureType sizeMeasureType = optionalSizeMeasureType.get(); + Date firstStartDate = DateUtil.createDate(1, 1, 2010); Date firstEndDate = DateUtil.createDate(31, 12, 2010); Date secondStartDate = DateUtil.createDate(1, 1, 2011); @@ -123,13 +132,13 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { Ocean indianOcean = optionalIndianOcean.orElse(null); // Ajout parametrage Male / Atlantique (2010) - createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, firstStartDate, firstEndDate); + createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, sizeMeasureType,firstStartDate, firstEndDate); // Ajout parametrage Male / Atlantique (après 2010) - createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, secondStartDate, null); + createLengthWeightParameter(lengthWeightParameterDao, species, atlanticOcean, maleSex, sizeMeasureType,secondStartDate, null); // Ajout parametrage Male / Indien (2010) - createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, firstStartDate, firstEndDate); + createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, sizeMeasureType,firstStartDate, firstEndDate); // Ajout parametrage Male / Indien (Après 2010) - createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, secondStartDate, null); + createLengthWeightParameter(lengthWeightParameterDao, species, indianOcean, maleSex, sizeMeasureType,secondStartDate, null); } @@ -149,6 +158,7 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { SpeciesTopiaDao speciesDAO = persistenceContext.getSpeciesDao(); OceanTopiaDao oceanDAO = persistenceContext.getOceanDao(); SexTopiaDao sexDao = persistenceContext.getSexDao(); + SizeMeasureTypeTopiaDao sizeMeasureTypeDao = persistenceContext.getSizeMeasureTypeDao(); Optional<Species> optionalSpecies = Optional.ofNullable(speciesDAO.forFaoCodeEquals("ALB").tryFindUnique().orNull()); Assert.assertTrue("Could not find species with faoCode: DOL", optionalSpecies.isPresent()); @@ -184,47 +194,52 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { Ocean indianOcean = optionalIndianOcean.orElse(null); Ocean pacificOcean = optionalPacificOcean.orElse(null); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2009, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2009, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, undeterminedSex, date2009, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2009, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2010, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2010, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2010, date2010); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2010, date1970); + Optional<SizeMeasureType> optionalSizeMeasureType = Optional.ofNullable(sizeMeasureTypeDao.forCodeEquals("FL").tryFindUnique().orNull()); + Assert.assertTrue("Could not find sizeMeasureType with code FL", optionalSizeMeasureType.isPresent()); + SizeMeasureType sizeMeasureType = optionalSizeMeasureType.get(); + + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2009, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2009, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, undeterminedSex, date2009, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2009, date1970,sizeMeasureType); + + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2010, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2010, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2010, date2010,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2010, date1970,sizeMeasureType); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2011, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2011, date1970); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2011, date2011); - assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2011, date1970); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, null, undeterminedSex, date2011, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, undeterminedSex, undeterminedSex, date2011, date1970,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, maleSex, maleSex, date2011, date2011,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, atlanticOcean, femaleSex, undeterminedSex, date2011, date1970,sizeMeasureType); // this test is now working!!! since we manage now perfectly null-null date range - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, undeterminedSex, date2009, null); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2009, null); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2009, null,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, undeterminedSex, date2009, null,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2009, null,sizeMeasureType); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2010, null); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2010, date2010); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2010, null); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2010, null,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2010, date2010,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2010, null,sizeMeasureType); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2011, null); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2011, date2011); - assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2011, null); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, undeterminedSex, undeterminedSex, date2011, null,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, maleSex, maleSex, date2011, date2011,sizeMeasureType); + assertFoundLengthWeightParameter(persistenceContext, species, indianOcean, femaleSex, undeterminedSex, date2011, null,sizeMeasureType); - assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, undeterminedSex, date2010); - assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, maleSex, date2010); - assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, femaleSex, date2010); + assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, undeterminedSex, date2010,sizeMeasureType); + assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, maleSex, date2010,sizeMeasureType); + assertNotFoundLengthWeightParameter(persistenceContext, species, pacificOcean, femaleSex, date2010,sizeMeasureType); } - protected void assertFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Sex expectedSex, Date date, Date expectedStartDate) { + protected void assertFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Sex expectedSex, Date date, Date expectedStartDate,SizeMeasureType expectedSizeMeasureType) { if (log.isInfoEnabled()) { log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date); } - LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, null); + LengthWeightParameter lengthWeightParameter = LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType); Assert.assertNotNull("length weith parameter not found for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date, lengthWeightParameter); Assert.assertEquals("Expected sex is " + expectedSex.getLabel1() + " but the one found was " + lengthWeightParameter.getSex().getLabel1(), expectedSex, lengthWeightParameter.getSex()); @@ -234,13 +249,13 @@ public class LengthWeightParemetersTest extends ServiceLocalTestSupport { } } - protected void assertNotFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Date date) { + protected void assertNotFoundLengthWeightParameter(ObserveTopiaDaoSupplier supplier, Species species, Ocean ocean, Sex sex, Date date,SizeMeasureType expectedSizeMeasureType) { if (log.isInfoEnabled()) { log.info("Try to find length weith parameter for species " + species.getFaoCode() + " - ocean " + ocean.getLabel1() + " - sex " + (sex == null ? "null" : sex.getLabel1()) + " at " + date); } try { - LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, null); + LengthWeightParameters.findLengthWeightParameter(supplier, species, sex, ocean, date, expectedSizeMeasureType); Assert.fail(); } catch (LengthWeightParameterNotFoundException e) { ===================================== services-local/src/test/java/fr/ird/observe/services/local/service/actions/validate/ValidateServiceLocalTest.java ===================================== @@ -178,7 +178,7 @@ public class ValidateServiceLocalTest extends ServiceLocalTestSupport { assertValidateResult(result, SexDto.class, 2); assertValidateResult(result, SensorBrandDto.class, 1); assertValidateResult(result, LightsticksColorDto.class, 2); - assertValidateResult(result, LengthWeightParameterDto.class, 4); + assertValidateResult(result, LengthWeightParameterDto.class, 3); assertValidateResult(result, LengthLengthParameterDto.class, 0); assertValidateResult(result, GearCaracteristicTypeDto.class, 2); assertValidateResult(result, ObjectOperationDto.class, 2); ===================================== services/pom.xml ===================================== @@ -27,7 +27,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>services</artifactId> ===================================== test/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>test</artifactId> ===================================== test/src/main/java/fr/ird/observe/test/ObserveFixtures.java ===================================== @@ -253,7 +253,7 @@ public class ObserveFixtures { .put("observe_common.harbour", 74L) .put("observe_common.lastupdatedate", 104L) .put("observe_common.lengthlengthparameter", 0L) - .put("observe_common.lengthweightparameter", 365L) + .put("observe_common.lengthweightparameter", 361L) .put("observe_common.ocean", 3L) .put("observe_common.ocean_species", 500L) .put("observe_common.organism", 9L) ===================================== test/src/main/resources/db/7.1/dataForTestLongline.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.1/dataForTestLongline.sql.gz differ ===================================== test/src/main/resources/db/7.1/dataForTestSeine.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.1/dataForTestSeine.sql.gz differ ===================================== test/src/main/resources/db/7.1/empty_h2.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.1/empty_h2.sql.gz differ ===================================== test/src/main/resources/db/7.1/empty_pg.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.1/empty_pg.sql.gz differ ===================================== test/src/main/resources/db/7.1/referentiel.sql.gz ===================================== Binary files /dev/null and b/test/src/main/resources/db/7.1/referentiel.sql.gz differ ===================================== validation/pom.xml ===================================== @@ -26,7 +26,7 @@ <parent> <groupId>fr.ird.observe</groupId> <artifactId>ird-observe</artifactId> - <version>7.0.9-SNAPSHOT</version> + <version>7.1.0-SNAPSHOT</version> </parent> <artifactId>validation</artifactId> View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/cb723884522d89fc9414d96c572... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/compare/cb723884522d89fc9414d96c572... You're receiving this email because of your account on gitlab.com.