Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: ab8d238d by Tony Chemit at 2021-11-29T11:02:35+01:00 En création d'échantillon LL logbook, le bouton Annuler n'est pas immédiatement disponible - Closes #2128 - - - - - 68c17bcc by Tony Chemit at 2021-11-29T12:26:26+01:00 Mise en place d'un cache avdth pour les données de tests. Il n'y a plus rien dans le projet :) - - - - - 13 changed files: - .gitignore - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUI.jcss - client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUI.jcss - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUI.jcss - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetUI.jcss - client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetUI.jcss - client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetUI.jcss - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/AvdthFixtures.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthReferentialBuilderTest.java - models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthWeightCategoryBuilderTest.java - pom.xml - tests/test/src/main/filtered-resources/observetest.properties Changes: ===================================== .gitignore ===================================== @@ -20,9 +20,3 @@ /src/site/markdown/CHANGELOG.md /src/site/markdown/*Config.md /src/site/resources/*Config.properties -/tests/test/src/main/resources/tck/ -/tests/test/src/main/resources/tck/* -/tests/test/src/main/resources/tck/*/* -/tests/test/src/main/resources/tck-update/ -/models/persistence/java/src/test/resources/avdth/ -/models/persistence/.mvn/avdth/ ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/edit/ContentEditUI.jcss ===================================== @@ -22,14 +22,13 @@ #states { editable:true; - modified:{getValidator().isChanged()}; - valid:{getValidator().isValid()}; enabled:{!states.isReadingMode()}; } #actions { visible:{states.isEditable()}; } + #extraActions { visible:false; } ===================================== client/datasource/editor/api/src/main/java/fr/ird/observe/client/datasource/editor/api/content/data/table/ContentTableUI.jcss ===================================== @@ -24,7 +24,7 @@ valid:{getValidator().isValid() && getValidatorTable().isValid()}; modified:{tableModel.isModified() || getValidator().isChanged()}; canSaveRow:{getValidatorTable().isChanged() && getValidatorTable().isValid()}; - canResetRow:{getValidatorTable().isChanged()}; + canResetRow:{tableModel.isCreate() || getValidatorTable().isChanged()}; editable:true; enabled:{!states.isReadingMode()}; } @@ -70,8 +70,8 @@ } #resetEntry { - enabled:{tableModel.isCreate() || states.isCanResetRow()}; visible:{tableModel.isEditable() && (tableModel.isCreate() || !tableModel.isEmpty())}; + enabled:{states.isCanResetRow()}; } #saveEntry { @@ -94,7 +94,7 @@ #reset { visible:{states.isEnabled()}; - enabled:{states.isModified()}; + enabled:{states.isModified() || tableModel.isCreate()}; } #save { ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/ActivitySampleUI.jcss ===================================== @@ -22,7 +22,7 @@ #states { samplePartUIModel:{samplePartUI.getModel()}; - modified:{validator.isChanged() || samplePartStates.isModified()}; + modified:{validator.isChanged() || samplePartStates.isModified() || samplePartStates.isCanResetRow()}; valid:{validator.isValid() && samplePartStates.isValid()}; } ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetUI.jcss ===================================== @@ -20,6 +20,11 @@ * #L% */ +#states { + modified:{getValidator().isChanged()}; + valid:{getValidator().isValid()}; +} + DateTimeEditor { showReset:true; } ===================================== client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/observation/SetUI.jcss ===================================== @@ -20,6 +20,11 @@ * #L% */ +#states { + modified:{getValidator().isChanged()}; + valid:{getValidator().isValid()}; +} + #shooterSpeed { enabled:{Objects.equals(true, bean.getShooterUsed())}; } ===================================== client/datasource/editor/ps/src/main/java/fr/ird/observe/client/datasource/editor/ps/data/observation/SetUI.jcss ===================================== @@ -20,6 +20,11 @@ * #L% */ +#states { + modified:{getValidator().isChanged()}; + valid:{getValidator().isValid()}; +} + #startTime { propertyDayDate: {SetDto.PROPERTY_START_SET_DATE}; propertyTimeDate: {SetDto.PROPERTY_START_SET_TIME}; ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/AvdthFixtures.java ===================================== @@ -23,7 +23,9 @@ package fr.ird.observe.persistence.avdth; */ import fr.ird.observe.test.ObserveFixtures; +import fr.ird.observe.test.ObserveTestConfiguration; +import java.nio.file.Path; import java.util.Map; /** @@ -35,7 +37,7 @@ import java.util.Map; public class AvdthFixtures extends ObserveFixtures { public static final Map<String, String> AVDTH = loadFixturesMap("avdth"); - + public static final String AVDTH_CACHE_PATH = "observetest.avdth.cache.path"; /** * To force prepare even if prepare step is not valid. */ @@ -48,9 +50,21 @@ public class AvdthFixtures extends ObserveFixtures { * To launch import for all years. */ public static final boolean IMPORT_ALL_YEARS = Boolean.parseBoolean(System.getProperty("test_allYears", "false")); + /** + * Root path of avdth databases. + */ + private static Path avdthCachePath; + + public static Path getAvdthCachePath() { + if (avdthCachePath == null) { + avdthCachePath = Path.of(ObserveTestConfiguration.getTestPropertyAsString(AVDTH_CACHE_PATH)); + } + return avdthCachePath; + } public static void assertAvdthFixture(String fixtureName, Object actual) { String expected = AVDTH.get(fixtureName); assertFixture(fixtureName, expected, actual); } + } ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java ===================================== @@ -47,7 +47,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -97,11 +96,7 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport } public static Path getPath(String type) { - return new File("").getAbsoluteFile().toPath() - .getParent() - .resolve(".mvn") - .resolve("avdth") - .resolve(type); + return AvdthFixtures.getAvdthCachePath().resolve(type); } protected abstract Path getRootPath(); ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthReferentialBuilderTest.java ===================================== @@ -36,7 +36,6 @@ import fr.ird.observe.test.spi.DatabaseNameConfiguration; import org.junit.Assert; import org.junit.Test; -import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.sql.Connection; @@ -53,10 +52,7 @@ public class AvdthReferentialBuilderTest extends PersistenceTestSupportRead { @Test public void build() throws SQLException, IOException { - Path avdthFile = new File("").getAbsoluteFile().toPath() - .getParent() - .resolve(".mvn") - .resolve("avdth") + Path avdthFile = AvdthFixtures.getAvdthCachePath() .resolve("OA") .resolve("OA_2020_V35.mdb"); Path scriptPath = localTestMethodResource.getTestDirectory().toPath().resolve("export-" + avdthFile.toFile().getName().replace(".mdb", ".sql")); ===================================== models/persistence/avdth/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthWeightCategoryBuilderTest.java ===================================== @@ -35,7 +35,6 @@ import fr.ird.observe.test.spi.DatabaseNameConfiguration; import org.junit.Assert; import org.junit.Test; -import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.sql.Connection; @@ -52,10 +51,7 @@ public class AvdthWeightCategoryBuilderTest extends PersistenceTestSupportRead { @Test public void build() throws SQLException, IOException { - Path avdthFile = new File("").getAbsoluteFile().toPath() - .getParent() - .resolve(".mvn") - .resolve("avdth") + Path avdthFile = AvdthFixtures.getAvdthCachePath() .resolve("avdth-gen-35_74.mdb"); Path scriptPath = localTestMethodResource.getTestDirectory().toPath().resolve("export-" + avdthFile.toFile().getName().replace(".mdb", ".sql")); Path scriptTemporaryDirectory = scriptPath.getParent().resolve(scriptPath.toFile().getName().replace(".sql", "-tmp")); ===================================== pom.xml ===================================== @@ -140,11 +140,15 @@ <persistence.model.version>9.0</persistence.model.version> <!--persistence previous model version used for tck migration--> <persistence.previous.model.version>8.0</persistence.previous.model.version> - <!-- tck file name to use --> <tck.filename>tck-v${persistence.model.version}.zip</tck.filename> <tck.updated.filename>updated-${tck.filename}</tck.updated.filename> <tck.remote.path>/var/www/html/private/ird-observe/db</tck.remote.path> <tck.cache.path>${user.home}/.mvn/tck-cache/${model.name}/tck</tck.cache.path> + <!-- FIXME Create new mojo to deal with avdth cache like for tck --> + <avdth.filename>avdth-v${persistence.model.version}.zip</avdth.filename> + <!-- FIXME Create new mojo to deal with avdth cache like for tck --> + <avdth.remote.path>/var/www/html/private/ird-observe/avdth</avdth.remote.path> + <avdth.cache.path>${user.home}/.mvn/tck-cache/${model.name}/avdth</avdth.cache.path> <!-- Do assert in tests--> <test.skipAsserts>false</test.skipAsserts> <runner.modelName>${model.name}</runner.modelName> ===================================== tests/test/src/main/filtered-resources/observetest.properties ===================================== @@ -24,6 +24,7 @@ observetest.build.version=${project.version} observetest.model.version=${persistence.model.version} observetest.previous.model.version=${persistence.previous.model.version} observetest.tck.cache.path=${tck.cache.path} +observetest.avdth.cache.path=${avdth.cache.path} observetest.first.model.version=7.0 observetest.h2.login=sa observetest.h2.password=sa View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8c797b044b3dcc441d978015d... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/8c797b044b3dcc441d978015d... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT (@tchemit)