[Git][ultreiaio/ird-t3][develop] 3 commits: Améliorations dans la gestion des profils utilisateurs (Pour la création on…
Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: ce678d47 by Tony CHEMIT at 2018-02-20T12:17:58+01:00 Améliorations dans la gestion des profils utilisateurs (Pour la création on deamdne aussi une confirmation du mot de passe) (See #251) - - - - - f886e0cf by Tony CHEMIT at 2018-02-20T12:18:05+01:00 improve configurations (for migration purpose) - - - - - 4a76939e by Tony CHEMIT at 2018-02-20T12:18:05+01:00 fix migrations + add a test for migraiton - - - - - 8 changed files: - t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql - t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql - t3-domain/src/main/resources/t3-datadb.properties - t3-domain/src/main/resources/t3-log4j.conf - t3-domain/src/main/xmi/t3-persistence.properties - + t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java - t3-domain/src/test/resources/log4j.properties - t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp Changes: ===================================== t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql ===================================== --- a/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql +++ b/t3-domain/src/main/resources/db/migration/V3_0_03_fix-LocalMarketPackagingType-ids.sql @@ -18,14 +18,14 @@ -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- #L% --- -INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1, 'Vrac pesé ou non (multispécifique) (sondage)', true); -INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 2, 'Pesée (monospécifique) (pas de sondage)', true); -INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 3, 'Espèce unité (monospécifique) (pas de sondage)', true); -INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 4, 'Paquet non pesé (monospécifique) (pas de sondage)', true); - +-- Trick (we add 1000 to code, we will subtract them later) +INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.1', 0, '2016-01-28 00:00:00', 1001, 'Vrac pesé ou non (multispécifique) (sondage)', true); +INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.2', 0, '2016-01-28 00:00:00', 1002, 'Pesée (monospécifique) (pas de sondage)', true); +INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.3', 0, '2016-01-28 00:00:00', 1003, 'Espèce unité (monospécifique) (pas de sondage)', true); +INSERT INTO localmarketpackagingtype (topiaid, topiaversion, topiacreatedate, code, libelle, status) VALUES ('fr.ird.t3.entities.reference.LocalMarketPackagingType#1454009635523#0.4', 0, '2016-01-28 00:00:00', 1004, 'Paquet non pesé (monospécifique) (pas de sondage)', true); UPDATE Localmarketpackaging SET localmarketpackagingtype = replace(localmarketpackagingtype,'LocalMarketPackaging', 'LocalMarketPackagingType'); - DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.1'; DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.2'; DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.3'; DELETE FROM Localmarketpackagingtype WHERE topiaid = 'fr.ird.t3.entities.reference.LocalMarketPackaging#1454009635523#0.4'; +UPDATE LocalmarketpackagingType SET code = code -1000; \ No newline at end of file ===================================== t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql ===================================== --- a/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql +++ b/t3-domain/src/main/resources/db/migration/V3_0_06_referential-i18n.sql @@ -51,7 +51,6 @@ ALTER TABLE zoneee RENAME COLUMN libelle TO label1; ALTER TABLE zoneee RENAME COLUMN versionlibelle TO versionLabel; ALTER TABLE zonefao RENAME COLUMN libelle TO label1; ALTER TABLE zonefao RENAME COLUMN versionlibelle TO versionLabel; - ALTER TABLE country ADD COLUMN label2 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label2 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label2 VARCHAR(255); @@ -78,7 +77,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label2 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label2 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label2 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label2 VARCHAR(255); - ALTER TABLE country ADD COLUMN label3 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label3 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label3 VARCHAR(255); @@ -105,7 +103,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label3 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label3 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label3 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label3 VARCHAR(255); - ALTER TABLE country ADD COLUMN label4 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label4 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label4 VARCHAR(255); @@ -132,7 +129,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label4 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label4 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label4 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label4 VARCHAR(255); - ALTER TABLE country ADD COLUMN label5 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label5 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label5 VARCHAR(255); @@ -159,7 +155,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label5 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label5 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label5 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label5 VARCHAR(255); - ALTER TABLE country ADD COLUMN label6 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label6 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label6 VARCHAR(255); @@ -186,7 +181,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label6 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label6 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label6 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label6 VARCHAR(255); - ALTER TABLE country ADD COLUMN label7 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label7 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label7 VARCHAR(255); @@ -213,7 +207,6 @@ ALTER TABLE ElementaryCatchFate ADD COLUMN label7 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label7 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label7 VARCHAR(255); ALTER TABLE zonefao ADD COLUMN label7 VARCHAR(255); - ALTER TABLE country ADD COLUMN label8 VARCHAR(255); ALTER TABLE schoolType ADD COLUMN label8 VARCHAR(255); ALTER TABLE fishingContext ADD COLUMN label8 VARCHAR(255); @@ -239,4 +232,4 @@ ALTER TABLE localMarketPackaging ADD COLUMN label8 VARCHAR(255); ALTER TABLE ElementaryCatchFate ADD COLUMN label8 VARCHAR(255); ALTER TABLE zoneet ADD COLUMN label8 VARCHAR(255); ALTER TABLE zoneee ADD COLUMN label8 VARCHAR(255); -ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255); +ALTER TABLE zonefao ADD COLUMN label8 VARCHAR(255); \ No newline at end of file ===================================== t3-domain/src/main/resources/t3-datadb.properties ===================================== --- a/t3-domain/src/main/resources/t3-datadb.properties +++ b/t3-domain/src/main/resources/t3-datadb.properties @@ -37,4 +37,5 @@ hibernate.hikari.registerMbeans=true topia.service.migration=org.nuiton.topia.migration.TopiaMigrationEngine topia.service.migration.callback=fr.ird.t3.services.migration.T3MigrationCallback topia.service.migration.showSql=true +topia.service.migration.showProgression=true ===================================== t3-domain/src/main/resources/t3-log4j.conf ===================================== --- a/t3-domain/src/main/resources/t3-log4j.conf +++ b/t3-domain/src/main/resources/t3-log4j.conf @@ -20,6 +20,7 @@ log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] ( log4j.logger.fr.ird.t3=INFO log4j.logger.fr.ird.t3.services.ioc=WARN log4j.logger.org.nuiton=WARN +log4j.logger.org.nuiton.topia.migration=INFO log4j.logger.org.hibernate.orm.deprecation=ERROR log4j.logger.com.zaxxer.hikari.HikariDataSource=ERROR ===================================== t3-domain/src/main/xmi/t3-persistence.properties ===================================== --- a/t3-domain/src/main/xmi/t3-persistence.properties +++ b/t3-domain/src/main/xmi/t3-persistence.properties @@ -22,7 +22,7 @@ model.tagValue.notGenerateToString=true model.tagValue.generateOperatorForDAOHelper=true model.tagValue.constantPrefix=PROPERTY_ -model.tagValue.version=2.0 +model.tagValue.version=3.0 model.tagValue.indexForeignKeys=true fr.ird.t3.entities.data.Trip.attribute.activity.stereotype=ordered ===================================== t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java ===================================== --- /dev/null +++ b/t3-domain/src/test/java/fr/ird/t3/services/migration/T3MigrationTest.java @@ -0,0 +1,55 @@ +package fr.ird.t3.services.migration; + +/*- + * #%L + * T3 :: Domain + * %% + * Copyright (C) 2010 - 2018 IRD, Code Lutin, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ird.t3.entities.T3TopiaApplicationContext; +import fr.ird.t3.entities.user.JdbcConfiguration; +import fr.ird.t3.entities.user.JdbcConfigurationHelper; +import org.junit.Assert; +import org.junit.Ignore; +import org.junit.Test; + +/** + * Created by tchemit on 20/02/2018. + * + * @author Tony Chemit - dev@tchemit.fr + */ +@Ignore +public class T3MigrationTest { + + @Test + public void migratePostgres() { + + String url = "jdbc:postgresql:t3"; + String login = "t3-admin"; + String password = "a"; + + JdbcConfiguration jdbcConfiguration = JdbcConfigurationHelper.newJdbcConfiguration(); + jdbcConfiguration.setUrl(url); + jdbcConfiguration.setLogin(login); + jdbcConfiguration.setPassword(password); + try (T3TopiaApplicationContext rootContext = T3TopiaApplicationContext.newDb(jdbcConfiguration)) { + Assert.assertNotNull(rootContext); + } + + } +} ===================================== t3-domain/src/test/resources/log4j.properties ===================================== --- a/t3-domain/src/test/resources/log4j.properties +++ b/t3-domain/src/test/resources/log4j.properties @@ -27,3 +27,4 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %5p [%t] # package level log4j.logger.fr.ird.t3=INFO +log4j.logger.org.nuiton.topia.migration=INFO \ No newline at end of file ===================================== t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp ===================================== --- a/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp +++ b/t3-web/src/main/webapp/WEB-INF/jsp/admin/userForm.jsp @@ -130,15 +130,14 @@ <s:hidden key="userEditAction" label=""/> <s:textfield key="user.login" label="%{getText('t3.common.login')}" size="40" requiredLabel="true"/> - <s:textfield key="user.password" label="%{getText('t3.common.password')}" - size="40" requiredLabel="true"/> + <s:textfield key="user.password" label="%{getText('t3.common.password')}" size="40" requiredLabel="true"/> + <s:textfield name="checkPassword" value="" key="t3.common.checkPassword" size="40" requiredLabel="true"/> <s:checkbox key="user.admin" label="%{getText('t3.common.admin')}"/> </fieldset> <br/> <s:submit action="userForm!doCreate" key="t3.action.create" align="right"/> <s:if test="userIsAdmin"> - <s:submit action="userList" key="t3.label.admin.backToUserList" - align="right"/> + <s:submit action="userList" key="t3.label.admin.backToUserList" align="right"/> </s:if> </s:form> </s:if> View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/53c09a9e30ff1c1e2c391b72310c4163... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/compare/53c09a9e30ff1c1e2c391b72310c4163... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT