Tony CHEMIT pushed to branch develop-7.x at ultreiaio / ird-observe

Commits:

12 changed files:

Changes:

  • client-configuration/src/main/java/fr/ird/observe/client/configuration/ClientConfig.java
    ... ... @@ -164,7 +164,7 @@ public class ClientConfig extends GeneratedClientConfig implements NavigationTre
    164 164
             delegate.setConfigFileName(configFileName);
    
    165 165
         }
    
    166 166
     
    
    167
    -    static ClientConfig forTest() {
    
    167
    +    public static ClientConfig forTest() {
    
    168 168
             return new ClientConfig(ApplicationConfigInit.forAllScopesWithout(ApplicationConfigScope.HOME, ApplicationConfigScope.ENV, ApplicationConfigScope.SYSTEM), DEFAULT_OBSERVE_SWING_CONFIGURATION_FILENAME);
    
    169 169
         }
    
    170 170
     
    

  • client-core/src/main/java/fr/ird/observe/client/backup/BackupsManager.java
    ... ... @@ -127,35 +127,34 @@ public class BackupsManager implements Closeable {
    127 127
             this.backupsPath = backupsPath;
    
    128 128
             this.checkBackups.start();
    
    129 129
     
    
    130
    -        try {
    
    131
    -            List<BackupStorage> backups;
    
    132
    -            if (Files.exists(storePath)) {
    
    133
    -                try (BufferedReader reader = Files.newBufferedReader(storePath, StandardCharsets.UTF_8)) {
    
    134
    -                    Type typeOfT = new TypeToken<List<BackupStorage>>() {
    
    135
    -                    }.getType();
    
    136
    -                    backups = new Gson().fromJson(reader, typeOfT);
    
    137
    -                    log.info(String.format("Loaded %d backups from %s", backups.size(), storePath));
    
    138
    -                }
    
    139
    -            } else {
    
    130
    +        List<BackupStorage> backups;
    
    131
    +        if (Files.exists(storePath)) {
    
    132
    +            try (BufferedReader reader = Files.newBufferedReader(storePath, StandardCharsets.UTF_8)) {
    
    133
    +                Type typeOfT = new TypeToken<List<BackupStorage>>() {
    
    134
    +                }.getType();
    
    135
    +                backups = new Gson().fromJson(reader, typeOfT);
    
    136
    +                log.info(String.format("Loaded %d backups from %s", backups.size(), storePath));
    
    137
    +            } catch (Exception e) {
    
    138
    +                log.error("can't load backups...", e);
    
    140 139
                     backups = new LinkedList<>();
    
    141 140
                 }
    
    141
    +        } else {
    
    142
    +            backups = new LinkedList<>();
    
    143
    +        }
    
    142 144
     
    
    143
    -            Iterator<BackupStorage> iterator = backups.iterator();
    
    144
    -            while (iterator.hasNext()) {
    
    145
    -                BackupStorage backupStorage = iterator.next();
    
    146
    -                if (!backupStorage.exists()) {
    
    147
    -                    iterator.remove();
    
    148
    -                    continue;
    
    149
    -                }
    
    150
    -                if (!backupStorage.isVerified()) {
    
    151
    -                    iterator.remove();
    
    152
    -                    addAutomaticBackup(backupStorage.getFile().toPath());
    
    153
    -                }
    
    145
    +        Iterator<BackupStorage> iterator = backups.iterator();
    
    146
    +        while (iterator.hasNext()) {
    
    147
    +            BackupStorage backupStorage = iterator.next();
    
    148
    +            if (!backupStorage.exists()) {
    
    149
    +                iterator.remove();
    
    150
    +                continue;
    
    151
    +            }
    
    152
    +            if (!backupStorage.isVerified()) {
    
    153
    +                iterator.remove();
    
    154
    +                addAutomaticBackup(backupStorage.getFile().toPath());
    
    154 155
                 }
    
    155
    -            this.backups = backups;
    
    156
    -        } catch (IOException e) {
    
    157
    -            throw new ObserveSwingTechnicalException("Can't init backups manager", e);
    
    158 156
             }
    
    157
    +        this.backups = backups;
    
    159 158
         }
    
    160 159
     
    
    161 160
         private List<BackupStorage> discoverAutomaticBackups(Path backupsPath) throws IOException {
    

  • client-runner/src/test/java/fr/ird/observe/client/simple/longline/LonglineDetailCompositionValidatorServiceTest.java
    ... ... @@ -71,7 +71,7 @@ public class LonglineDetailCompositionValidatorServiceTest {
    71 71
                 ObserveSwingApplicationContext.get().close();
    
    72 72
             }
    
    73 73
     
    
    74
    -        ClientConfig config = new ClientConfig();
    
    74
    +        ClientConfig config = ClientConfig.forTest();
    
    75 75
     
    
    76 76
             config.initConfig(new ObserveResourceManager().getResource(ObserveResourceManager.Resource.application));
    
    77 77
     
    

  • persistence/src/main/java/fr/ird/observe/persistence/migration/DataSourceMigrationForVersion_7_2.java
    1
    +package fr.ird.observe.persistence.migration;
    
    2
    +
    
    3
    +/*-
    
    4
    + * #%L
    
    5
    + * ObServe :: Persistence
    
    6
    + * %%
    
    7
    + * Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
    
    8
    + * %%
    
    9
    + * This program is free software: you can redistribute it and/or modify
    
    10
    + * it under the terms of the GNU General Public License as
    
    11
    + * published by the Free Software Foundation, either version 3 of the
    
    12
    + * License, or (at your option) any later version.
    
    13
    + * 
    
    14
    + * This program is distributed in the hope that it will be useful,
    
    15
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17
    + * GNU General Public License for more details.
    
    18
    + * 
    
    19
    + * You should have received a copy of the GNU General Public
    
    20
    + * License along with this program.  If not, see
    
    21
    + * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22
    + * #L%
    
    23
    + */
    
    24
    +
    
    25
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResource;
    
    26
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceExecutor;
    
    27
    +import org.nuiton.version.Versions;
    
    28
    +
    
    29
    +public class DataSourceMigrationForVersion_7_2 extends MigrationVersionResource {
    
    30
    +
    
    31
    +    public DataSourceMigrationForVersion_7_2() {
    
    32
    +        super(Versions.valueOf("7.2"));
    
    33
    +    }
    
    34
    +
    
    35
    +    @Override
    
    36
    +    public void generateSqlScript(MigrationVersionResourceExecutor executor) {
    
    37
    +        executor.addScript("01", "fix_trip_longline_comment");
    
    38
    +    }
    
    39
    +
    
    40
    +}
    
    41
    +

  • persistence/src/main/resources/db/migration/7.2/01_fix_trip_longline_comment-H2.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe :: Persistence
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
    
    6
    +-- %%
    
    7
    +-- This program is free software: you can redistribute it and/or modify
    
    8
    +-- it under the terms of the GNU General Public License as
    
    9
    +-- published by the Free Software Foundation, either version 3 of the
    
    10
    +-- License, or (at your option) any later version.
    
    11
    +-- 
    
    12
    +-- This program is distributed in the hope that it will be useful,
    
    13
    +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +-- GNU General Public License for more details.
    
    16
    +-- 
    
    17
    +-- You should have received a copy of the GNU General Public
    
    18
    +-- License along with this program.  If not, see
    
    19
    +-- <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +-- #L%
    
    21
    +---
    
    22
    +ALTER TABLE observe_longline.trip ADD COLUMN comment2 VARCHAR(1025);
    
    23
    +UPDATE observe_longline.trip set comment2 = comment;
    
    24
    +ALTER TABLE observe_longline.trip DROP COLUMN comment;
    
    25
    +ALTER TABLE observe_longline.trip comment2 RENAME TO  comment;

  • persistence/src/main/resources/db/migration/7.2/01_fix_trip_longline_comment-PG.sql
    1
    +---
    
    2
    +-- #%L
    
    3
    +-- ObServe :: Persistence
    
    4
    +-- %%
    
    5
    +-- Copyright (C) 2008 - 2019 IRD, Code Lutin, Ultreia.io
    
    6
    +-- %%
    
    7
    +-- This program is free software: you can redistribute it and/or modify
    
    8
    +-- it under the terms of the GNU General Public License as
    
    9
    +-- published by the Free Software Foundation, either version 3 of the
    
    10
    +-- License, or (at your option) any later version.
    
    11
    +-- 
    
    12
    +-- This program is distributed in the hope that it will be useful,
    
    13
    +-- but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    14
    +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    15
    +-- GNU General Public License for more details.
    
    16
    +-- 
    
    17
    +-- You should have received a copy of the GNU General Public
    
    18
    +-- License along with this program.  If not, see
    
    19
    +-- <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    20
    +-- #L%
    
    21
    +---
    
    22
    +ALTER TABLE observe_longline.trip ADD COLUMN comment2 VARCHAR(1025);
    
    23
    +UPDATE observe_longline.trip set comment2 = comment;
    
    24
    +ALTER TABLE observe_longline.trip DROP COLUMN comment CASCADE;
    
    25
    +ALTER TABLE observe_longline.trip RENAME comment2 TO comment;

  • pom.xml
    ... ... @@ -149,7 +149,7 @@
    149 149
         <devMode>true</devMode>
    
    150 150
     
    
    151 151
         <!--persistence model version-->
    
    152
    -    <observe.model.version>7.1</observe.model.version>
    
    152
    +    <observe.model.version>7.2</observe.model.version>
    
    153 153
     
    
    154 154
         <!-- build timestamp configuration -->
    
    155 155
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    

  • test/src/main/resources/db/7.2/dataForTestLongline.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.2/dataForTestSeine.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.2/empty_h2.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.2/empty_pg.sql.gz
    No preview for this file type
  • test/src/main/resources/db/7.2/referentiel.sql.gz
    No preview for this file type