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

Commits:

7 changed files:

Changes:

  • client/src/test/java/fr/ird/observe/client/DataSourcesForTestManager.java
    ... ... @@ -10,23 +10,23 @@ package fr.ird.observe.client;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.persistence.migration.ObserveMigrationConfigurationProvider;
    
    26 25
     import fr.ird.observe.services.configuration.topia.ObserveDataSourceConfigurationTopiaH2;
    
    27 26
     import fr.ird.observe.test.TestHelper;
    
    28 27
     import org.apache.commons.logging.Log;
    
    29 28
     import org.apache.commons.logging.LogFactory;
    
    29
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceProvider;
    
    30 30
     import org.nuiton.version.Version;
    
    31 31
     
    
    32 32
     import java.io.File;
    
    ... ... @@ -100,7 +100,7 @@ public class DataSourcesForTestManager {
    100 100
             configurationTopiaH2.setDirectory(localDbFile);
    
    101 101
             configurationTopiaH2.setDbName("obstuna");
    
    102 102
             configurationTopiaH2.setAutoMigrate(true);
    
    103
    -        configurationTopiaH2.setModelVersion(ObserveMigrationConfigurationProvider.get().getLastVersion());
    
    103
    +        configurationTopiaH2.setModelVersion(MigrationVersionResourceProvider.get().getLastVersion());
    
    104 104
             return configurationTopiaH2;
    
    105 105
     
    
    106 106
         }
    
    ... ... @@ -116,7 +116,7 @@ public class DataSourcesForTestManager {
    116 116
         private void deleteDirectory(Path directory) {
    
    117 117
             try {
    
    118 118
                 log.debug(String.format("Delete directory: %s", directory));
    
    119
    -            Files.walk(directory).filter(f->!f.equals(directory)).forEach(f -> {
    
    119
    +            Files.walk(directory).filter(f -> !f.equals(directory)).forEach(f -> {
    
    120 120
                     try {
    
    121 121
                         if (Files.isDirectory(f)) {
    
    122 122
                             deleteDirectory(f);
    

  • persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveMigrationConfigurationProvider.java deleted
    1
    -package fr.ird.observe.persistence.migration;
    
    2
    -
    
    3
    -/*-
    
    4
    - * #%L
    
    5
    - * ObServe :: Persistence
    
    6
    - * %%
    
    7
    - * Copyright (C) 2008 - 2018 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 com.google.common.collect.ImmutableList;
    
    26
    -import org.nuiton.topia.service.migration.resources.MigrationVersionResourceProvider;
    
    27
    -import org.nuiton.version.Version;
    
    28
    -import org.nuiton.version.VersionBuilder;
    
    29
    -
    
    30
    -import java.util.List;
    
    31
    -
    
    32
    -/**
    
    33
    - * Created on 01/08/16.
    
    34
    - *
    
    35
    - * @author Tony Chemit - dev@tchemit.fr
    
    36
    - * @since 5.0
    
    37
    - */
    
    38
    -public final class ObserveMigrationConfigurationProvider {
    
    39
    -
    
    40
    -    private static ObserveMigrationConfigurationProvider INSTANCE;
    
    41
    -
    
    42
    -    private final MigrationVersionResourceProvider resourceProvider;
    
    43
    -
    
    44
    -    private ObserveMigrationConfigurationProvider() {
    
    45
    -        resourceProvider = new MigrationVersionResourceProvider();
    
    46
    -    }
    
    47
    -
    
    48
    -    public static ObserveMigrationConfigurationProvider get() {
    
    49
    -        if (INSTANCE == null) {
    
    50
    -            INSTANCE = new ObserveMigrationConfigurationProvider();
    
    51
    -        }
    
    52
    -        return INSTANCE;
    
    53
    -    }
    
    54
    -
    
    55
    -    public List<Version> getAvailableVersions() {
    
    56
    -        return resourceProvider.getAvailableVersions();
    
    57
    -    }
    
    58
    -
    
    59
    -    public Version getLastVersion() {
    
    60
    -        return resourceProvider.getLastVersion();
    
    61
    -    }
    
    62
    -
    
    63
    -    public ImmutableList<Version> getVersionsAfter(Version current) {
    
    64
    -        return resourceProvider.getVersionsAfter(current);
    
    65
    -    }
    
    66
    -
    
    67
    -    public Version getMinimumVersion() {
    
    68
    -        return VersionBuilder.create("3.0").build();
    
    69
    -    }
    
    70
    -
    
    71
    -}

  • persistence/src/main/java/fr/ird/observe/persistence/migration/ObserveTopiaMigrationServiceAskUserToMigrate.java
    ... ... @@ -35,12 +35,13 @@ import java.util.List;
    35 35
      * @author Tony Chemit - dev@tchemit.fr
    
    36 36
      */
    
    37 37
     @AutoService(TopiaMigrationServiceAskUserToMigrate.class)
    
    38
    +@SuppressWarnings("WeakerAccess")
    
    38 39
     public class ObserveTopiaMigrationServiceAskUserToMigrate implements TopiaMigrationServiceAskUserToMigrate {
    
    39 40
     
    
    40
    -    private final Version minimumVersion = VersionBuilder.create("3.0").build();
    
    41
    +    private static final Version MINIMUM_VERSION = VersionBuilder.create("3.0").build();
    
    41 42
     
    
    42
    -    public Version getMinimumVersion() {
    
    43
    -        return minimumVersion;
    
    43
    +    public static Version getMinimumVersion() {
    
    44
    +        return MINIMUM_VERSION;
    
    44 45
         }
    
    45 46
     
    
    46 47
         @Override
    

  • pom.xml
    ... ... @@ -152,7 +152,7 @@
    152 152
         <maven.build.timestamp.format>dd/MM/yyyy HH:mm z</maven.build.timestamp.format>
    
    153 153
         <buildDate>${maven.build.timestamp}</buildDate>
    
    154 154
     
    
    155
    -    <observeToolkitVersion>3.4-SNAPSHOT</observeToolkitVersion>
    
    155
    +    <observeToolkitVersion>3.5-SNAPSHOT</observeToolkitVersion>
    
    156 156
     
    
    157 157
         <!--<lib.version.java4all.jaxx>3.0-alpha-31</lib.version.java4all.jaxx>-->
    
    158 158
         <!--<lib.version.nuiton.topia>3.4.2-SNAPSHOT</lib.version.nuiton.topia>-->
    

  • services-local/src/main/java/fr/ird/observe/services/local/service/DataSourceServiceLocal.java
    ... ... @@ -33,7 +33,7 @@ import fr.ird.observe.persistence.ObserveEntityEnum;
    33 33
     import fr.ird.observe.persistence.ObserveTopiaApplicationContext;
    
    34 34
     import fr.ird.observe.persistence.ObserveTopiaConfiguration;
    
    35 35
     import fr.ird.observe.persistence.ObserveTopiaConfigurationFactory;
    
    36
    -import fr.ird.observe.persistence.migration.ObserveMigrationConfigurationProvider;
    
    36
    +import fr.ird.observe.persistence.migration.ObserveTopiaMigrationServiceAskUserToMigrate;
    
    37 37
     import fr.ird.observe.services.configuration.DataSourceCreateConfigurationDto;
    
    38 38
     import fr.ird.observe.services.configuration.DataSourceCreateWithNoReferentialImportException;
    
    39 39
     import fr.ird.observe.services.configuration.IncompatibleDataSourceCreateConfigurationException;
    
    ... ... @@ -61,6 +61,7 @@ import org.nuiton.topia.persistence.jdbc.JdbcHelper;
    61 61
     import org.nuiton.topia.persistence.metadata.TopiaMetadataEntity;
    
    62 62
     import org.nuiton.topia.persistence.metadata.TopiaMetadataModel;
    
    63 63
     import org.nuiton.topia.persistence.metadata.TopiaMetadataModelVisitor;
    
    64
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceProvider;
    
    64 65
     import org.nuiton.version.Version;
    
    65 66
     import org.nuiton.version.Versions;
    
    66 67
     
    
    ... ... @@ -614,13 +615,13 @@ public class DataSourceServiceLocal extends ObserveServiceLocal implements DataS
    614 615
                         "write data : " + writeData + ".");
    
    615 616
             }
    
    616 617
     
    
    617
    -        ObserveMigrationConfigurationProvider observeMigrationConfigurationProvider = ObserveMigrationConfigurationProvider.get();
    
    618
    +        MigrationVersionResourceProvider observeMigrationConfigurationProvider = MigrationVersionResourceProvider.get();
    
    618 619
             return new ObserveDataSourceInformation(
    
    619 620
                     true,
    
    620 621
                     writeReferential,
    
    621 622
                     readData,
    
    622 623
                     writeData,
    
    623
    -                observeMigrationConfigurationProvider.getMinimumVersion(),
    
    624
    +                ObserveTopiaMigrationServiceAskUserToMigrate.getMinimumVersion(),
    
    624 625
                     version,
    
    625 626
                     observeMigrationConfigurationProvider.getVersionsAfter(version));
    
    626 627
         }
    

  • services-local/src/test/java/fr/ird/observe/services/local/DataSourcesForTestManager.java
    ... ... @@ -10,23 +10,23 @@ package fr.ird.observe.services.local;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    22 22
      * #L%
    
    23 23
      */
    
    24 24
     
    
    25
    -import fr.ird.observe.persistence.migration.ObserveMigrationConfigurationProvider;
    
    26 25
     import fr.ird.observe.services.configuration.topia.ObserveDataSourceConfigurationTopiaH2;
    
    27 26
     import fr.ird.observe.test.TestHelper;
    
    28 27
     import org.apache.commons.logging.Log;
    
    29 28
     import org.apache.commons.logging.LogFactory;
    
    29
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceProvider;
    
    30 30
     import org.nuiton.version.Version;
    
    31 31
     
    
    32 32
     import java.io.File;
    
    ... ... @@ -100,7 +100,7 @@ public class DataSourcesForTestManager {
    100 100
             configurationTopiaH2.setDirectory(localDbFile);
    
    101 101
             configurationTopiaH2.setDbName("obstuna");
    
    102 102
             configurationTopiaH2.setAutoMigrate(true);
    
    103
    -        configurationTopiaH2.setModelVersion(ObserveMigrationConfigurationProvider.get().getLastVersion());
    
    103
    +        configurationTopiaH2.setModelVersion(MigrationVersionResourceProvider.get().getLastVersion());
    
    104 104
             return configurationTopiaH2;
    
    105 105
     
    
    106 106
         }
    

  • services-local/src/test/java/fr/ird/observe/services/local/service/RigthTest.java
    ... ... @@ -10,12 +10,12 @@ package fr.ird.observe.services.local.service;
    10 10
      * it under the terms of the GNU General Public License as
    
    11 11
      * published by the Free Software Foundation, either version 3 of the
    
    12 12
      * License, or (at your option) any later version.
    
    13
    - * 
    
    13
    + *
    
    14 14
      * This program is distributed in the hope that it will be useful,
    
    15 15
      * but WITHOUT ANY WARRANTY; without even the implied warranty of
    
    16 16
      * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    
    17 17
      * GNU General Public License for more details.
    
    18
    - * 
    
    18
    + *
    
    19 19
      * You should have received a copy of the GNU General Public
    
    20 20
      * License along with this program.  If not, see
    
    21 21
      * <http://www.gnu.org/licenses/gpl-3.0.html>.
    
    ... ... @@ -25,7 +25,6 @@ package fr.ird.observe.services.local.service;
    25 25
     import fr.ird.observe.dto.data.seine.TripSeineDto;
    
    26 26
     import fr.ird.observe.dto.form.Form;
    
    27 27
     import fr.ird.observe.dto.referential.ProgramDto;
    
    28
    -import fr.ird.observe.persistence.migration.ObserveMigrationConfigurationProvider;
    
    29 28
     import fr.ird.observe.services.configuration.ObserveDataSourceConnection;
    
    30 29
     import fr.ird.observe.services.configuration.topia.ObserveDataSourceConfigurationTopiaPG;
    
    31 30
     import fr.ird.observe.services.security.UnauthorizedException;
    
    ... ... @@ -42,6 +41,7 @@ import fr.ird.observe.test.spi.DatabasePasswordConfiguration;
    42 41
     import org.junit.Assert;
    
    43 42
     import org.junit.Ignore;
    
    44 43
     import org.junit.Test;
    
    44
    +import org.nuiton.topia.service.migration.resources.MigrationVersionResourceProvider;
    
    45 45
     
    
    46 46
     /**
    
    47 47
      * FIXME Ca sert à quoi ? et je comprends pas le mot rigth ?
    
    ... ... @@ -102,13 +102,12 @@ public class RigthTest extends ServiceLocalTestSupport {
    102 102
             configurationTopiaPG.setUsername(login);
    
    103 103
             configurationTopiaPG.setPassword('a');
    
    104 104
             configurationTopiaPG.setAutoMigrate(true);
    
    105
    -        configurationTopiaPG.setModelVersion(ObserveMigrationConfigurationProvider.get().getLastVersion());
    
    105
    +        configurationTopiaPG.setModelVersion(MigrationVersionResourceProvider.get().getLastVersion());
    
    106 106
     
    
    107 107
             return configurationTopiaPG;
    
    108 108
     
    
    109 109
         }
    
    110 110
     
    
    111
    -
    
    112 111
         public void testReadData(String login) throws DatabaseConnexionNotAuthorizedException, DatabaseNotFoundException, BabModelVersionException {
    
    113 112
     
    
    114 113
             TripSeineService service = localTestMethodResource.newService(TripSeineService.class);