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

Commits:

5 changed files:

Changes:

  • core/persistence/test/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java
    ... ... @@ -98,6 +98,7 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport
    98 98
         }
    
    99 99
     
    
    100 100
         public static List<String> allDatabases(Path path) {
    
    101
    +        Assume.assumeTrue("Skip, avdth root path " + path + " not found", Files.exists(path));
    
    101 102
             try (Stream<Path> pathStream = Files.find(path, 1, (p, b) -> p.toFile().getName().endsWith(".mdb"))) {
    
    102 103
                 List<String> collect = pathStream.map(p -> p.toFile().getName()).sorted().collect(Collectors.toList());
    
    103 104
                 Collections.reverse(collect);
    
    ... ... @@ -127,6 +128,7 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport
    127 128
         public void build() throws SQLException, IOException, MissingReferentialException {
    
    128 129
             log.info(String.format("Start for database: %s", dbName));
    
    129 130
             Path avdthFile = getRootPath().resolve(dbName);
    
    131
    +        Assume.assumeTrue("Skip, avdth file " + avdthFile + " not found", Files.exists(avdthFile));
    
    130 132
             Path scriptPath = TOPIA_TEST_CLASS_RESOURCE.getTestDirectory().toPath().resolve("export-" + dbName.replace(".mdb", ".sql"));
    
    131 133
             Path scriptTemporaryDirectory = scriptPath.getParent().resolve(scriptPath.toFile().getName().replace(".sql", "-tmp"));
    
    132 134
     
    

  • core/persistence/test/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthReferentialBuilderTest.java
    ... ... @@ -39,10 +39,12 @@ import fr.ird.observe.test.spi.DatabaseNameConfiguration;
    39 39
     import fr.ird.observe.test.spi.DatabasePasswordConfiguration;
    
    40 40
     import fr.ird.observe.test.spi.DatabaseVersionConfiguration;
    
    41 41
     import org.junit.Assert;
    
    42
    +import org.junit.Assume;
    
    42 43
     import org.junit.ClassRule;
    
    43 44
     import org.junit.Test;
    
    44 45
     
    
    45 46
     import java.io.IOException;
    
    47
    +import java.nio.file.Files;
    
    46 48
     import java.nio.file.Path;
    
    47 49
     import java.sql.Connection;
    
    48 50
     import java.sql.SQLException;
    
    ... ... @@ -74,6 +76,7 @@ public class AvdthReferentialBuilderTest extends TestSupportWithConfig {
    74 76
             Path avdthFile = AvdthFixtures.getAvdthCachePath()
    
    75 77
                     .resolve("OA")
    
    76 78
                     .resolve("OA_2020_V35.mdb");
    
    79
    +        Assume.assumeTrue("Skip, avdth file " + avdthFile + " not found", Files.exists(avdthFile));
    
    77 80
             Path scriptPath = localTestMethodResource.getTestDirectory().toPath().resolve("export-" + avdthFile.toFile().getName().replace(".mdb", ".sql"));
    
    78 81
             Path scriptTemporaryDirectory = scriptPath.getParent().resolve(scriptPath.toFile().getName().replace(".sql", "-tmp"));
    
    79 82
     
    

  • core/persistence/test/src/test/java/fr/ird/observe/persistence/avdth/referential/AvdthWeightCategoryBuilderTest.java
    ... ... @@ -38,10 +38,12 @@ import fr.ird.observe.test.spi.DatabaseNameConfiguration;
    38 38
     import fr.ird.observe.test.spi.DatabasePasswordConfiguration;
    
    39 39
     import fr.ird.observe.test.spi.DatabaseVersionConfiguration;
    
    40 40
     import org.junit.Assert;
    
    41
    +import org.junit.Assume;
    
    41 42
     import org.junit.ClassRule;
    
    42 43
     import org.junit.Test;
    
    43 44
     
    
    44 45
     import java.io.IOException;
    
    46
    +import java.nio.file.Files;
    
    45 47
     import java.nio.file.Path;
    
    46 48
     import java.sql.Connection;
    
    47 49
     import java.sql.SQLException;
    
    ... ... @@ -70,6 +72,7 @@ public class AvdthWeightCategoryBuilderTest extends TestSupportWithConfig {
    70 72
         public void build() throws SQLException, IOException {
    
    71 73
             Path avdthFile = AvdthFixtures.getAvdthCachePath()
    
    72 74
                     .resolve("avdth-gen-35_74.mdb");
    
    75
    +        Assume.assumeTrue("Skip, avdth file " + avdthFile + " not found", Files.exists(avdthFile));
    
    73 76
             Path scriptPath = localTestMethodResource.getTestDirectory().toPath().resolve("export-" + avdthFile.toFile().getName().replace(".mdb", ".sql"));
    
    74 77
             Path scriptTemporaryDirectory = scriptPath.getParent().resolve(scriptPath.toFile().getName().replace(".sql", "-tmp"));
    
    75 78
     
    

  • core/persistence/test/src/test/java/org/nuiton/topia/persistence/jdbc/JdbcHelperPostgresTest.java
    ... ... @@ -61,10 +61,10 @@ public class JdbcHelperPostgresTest {
    61 61
     
    
    62 62
         @Test
    
    63 63
         public void isTableExist() throws SQLException {
    
    64
    -        boolean actual = jdbcHelper.isTableExist("Public", "Tms_version");
    
    64
    +        boolean actual = jdbcHelper.isTableExist("Common", "database_version");
    
    65 65
             Assert.assertTrue(actual);
    
    66 66
     
    
    67
    -        actual = jdbcHelper.isTableExist("PUBLIC", "tms_version-fake");
    
    67
    +        actual = jdbcHelper.isTableExist("PUBLIC", "database_version-fake");
    
    68 68
             Assert.assertFalse(actual);
    
    69 69
         }
    
    70 70
         @Test
    

  • toolkit/test-api/src/main/java/fr/ird/observe/test/ObserveTestConfiguration.java
    ... ... @@ -33,10 +33,12 @@ import fr.ird.observe.test.spi.DatabaseVersionConfiguration;
    33 33
     import io.ultreia.java4all.util.Version;
    
    34 34
     import io.ultreia.java4all.util.sql.conf.JdbcConfiguration;
    
    35 35
     import io.ultreia.java4all.util.sql.conf.JdbcConfigurationBuilder;
    
    36
    +import org.junit.Assume;
    
    36 37
     
    
    37 38
     import java.lang.reflect.AnnotatedElement;
    
    38 39
     import java.net.MalformedURLException;
    
    39 40
     import java.net.URL;
    
    41
    +import java.nio.file.Files;
    
    40 42
     import java.nio.file.Path;
    
    41 43
     
    
    42 44
     /**
    
    ... ... @@ -145,9 +147,9 @@ public class ObserveTestConfiguration {
    145 147
         }
    
    146 148
     
    
    147 149
         public static JdbcConfiguration pgConfiguration() {
    
    148
    -        return new JdbcConfigurationBuilder().forDatabase(ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_URL),//"jdbc:postgresql://localhost:5432/observe_9",
    
    149
    -                                                          ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_LOGIN),//"obstuna-referentiel",
    
    150
    -                                                          ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_PASSWORD)//";;dm8-referentiel.."
    
    150
    +        return new JdbcConfigurationBuilder().forDatabase(ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_URL),
    
    151
    +                                                          ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_LOGIN),
    
    152
    +                                                          ObserveTestConfiguration.getTestPropertyAsString(ObserveTestConfiguration.PG_PASSWORD)
    
    151 153
             );
    
    152 154
         }
    
    153 155
     
    
    ... ... @@ -155,6 +157,7 @@ public class ObserveTestConfiguration {
    155 157
         public static void injectCredentials() {
    
    156 158
     
    
    157 159
             Path credentialPath = Path.of(ObserveTestConfiguration.getTestPropertyAsString(ToolkitFixtures.TEST_CREDENTIALS_KEY));
    
    160
    +        Assume.assumeTrue("Skip, no credential file found", Files.exists(credentialPath));
    
    158 161
             ToolkitFixtures.injectCredentials(credentialPath,
    
    159 162
                                               ObserveTestConfiguration.PG_URL,
    
    160 163
                                               ObserveTestConfiguration.PG_LOGIN,