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

Commits:

4 changed files:

Changes:

  • core/api/services/src/main/java/fr/ird/observe/services/service/data/ps/AvdthDataImportResult.java
    ... ... @@ -87,10 +87,6 @@ public class AvdthDataImportResult implements ObserveDto {
    87 87
             this.notReadResult = notReadResult;
    
    88 88
             this.exportResult = exportResult;
    
    89 89
             this.sqlResultPath = sqlResultPath;
    
    90
    -        // Used for debugging...
    
    91
    -//        if (!exportResult.isEmpty()) {
    
    92
    -//            System.out.println(exportResult.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining("\n")));
    
    93
    -//        }
    
    94 90
         }
    
    95 91
     
    
    96 92
         public Path getMessageFile() {
    

  • core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectWriter.java
    ... ... @@ -192,9 +192,7 @@ public class FloatingObjectWriter extends DataWriter<FloatingObject, FloatingObj
    192 192
             super.toResult(resultBuilder);
    
    193 193
             toResult(resultBuilder, FloatingObjectPart.class, getReader().getFloatingObjectPartCount());
    
    194 194
             toResult(resultBuilder, TransmittingBuoy.class, getReader().getTransmittingBuoyCount());
    
    195
    -//        getReader().getBadVesselActivityCodes().forEach((k,v)-> {
    
    196
    -//            resultBuilder.put(String.format("Bad Vessel activity used to build FAD from ACTIVITY.C_OPERA %s used but ObServe not allow fad.", k), v.getValue());
    
    197
    -//        });
    
    195
    +        getReader().getBadVesselActivityCodes().forEach((k,v)-> resultBuilder.put(String.format("Bad Vessel activity used to build FAD from ACTIVITE.C_OPERA %s used but this vessel activity does not allow fad in ObServe.", k), v.getValue()));
    
    198 196
         }
    
    199 197
     }
    
    200 198
     

  • core/persistence/test/src/test/java/fr/ird/observe/persistence/avdth/data/AvdthDataBuilderTestSupport.java
    ... ... @@ -26,19 +26,21 @@ import com.google.gson.Gson;
    26 26
     import com.google.gson.GsonBuilder;
    
    27 27
     import fr.ird.observe.dto.ObserveUtil;
    
    28 28
     import fr.ird.observe.dto.ProgressionModel;
    
    29
    -import fr.ird.observe.services.service.data.ps.AvdthDataImportConfiguration;
    
    30
    -import fr.ird.observe.services.service.data.ps.AvdthDataImportResult;
    
    31
    -import fr.ird.observe.services.service.data.ps.MissingReferentialException;
    
    32 29
     import fr.ird.observe.dto.referential.ReferentialLocale;
    
    33 30
     import fr.ird.observe.entities.ObserveTopiaPersistenceContext;
    
    34 31
     import fr.ird.observe.entities.data.ps.common.Trip;
    
    35 32
     import fr.ird.observe.persistence.avdth.AvdthFixtures;
    
    36 33
     import fr.ird.observe.persistence.test.PersistenceTestSupportWrite;
    
    34
    +import fr.ird.observe.services.service.data.ps.AvdthDataImportConfiguration;
    
    35
    +import fr.ird.observe.services.service.data.ps.AvdthDataImportResult;
    
    36
    +import fr.ird.observe.services.service.data.ps.MissingReferentialException;
    
    37 37
     import fr.ird.observe.test.DatabaseName;
    
    38 38
     import fr.ird.observe.test.IgnoreTestClassRule;
    
    39 39
     import fr.ird.observe.test.spi.CopyDatabaseConfiguration;
    
    40 40
     import fr.ird.observe.test.spi.DatabaseNameConfiguration;
    
    41 41
     import io.ultreia.java4all.util.SortedProperties;
    
    42
    +import org.apache.logging.log4j.LogManager;
    
    43
    +import org.apache.logging.log4j.Logger;
    
    42 44
     import org.junit.AfterClass;
    
    43 45
     import org.junit.Assert;
    
    44 46
     import org.junit.Assume;
    
    ... ... @@ -56,6 +58,7 @@ import java.util.Collections;
    56 58
     import java.util.List;
    
    57 59
     import java.util.Map;
    
    58 60
     import java.util.stream.Collectors;
    
    61
    +import java.util.stream.Stream;
    
    59 62
     
    
    60 63
     /**
    
    61 64
      * Created on 24/05/2021.
    
    ... ... @@ -65,7 +68,7 @@ import java.util.stream.Collectors;
    65 68
      */
    
    66 69
     @RunWith(Parameterized.class)
    
    67 70
     public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupportWrite {
    
    68
    -
    
    71
    +    private static final Logger log = LogManager.getLogger(AvdthDataBuilderTestSupport.class);
    
    69 72
         @ClassRule
    
    70 73
         public static final IgnoreTestClassRule IGNORE2 = new IgnoreTestClassRule("Persistence Avdth", "persistence.avdth.test.skip");
    
    71 74
     
    
    ... ... @@ -95,8 +98,8 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport
    95 98
         }
    
    96 99
     
    
    97 100
         public static List<String> allDatabases(Path path) {
    
    98
    -        try {
    
    99
    -            List<String> collect = Files.find(path, 1, (p, b) -> p.toFile().getName().endsWith(".mdb")).map(p -> p.toFile().getName()).sorted().collect(Collectors.toList());
    
    101
    +        try (Stream<Path> pathStream = Files.find(path, 1, (p, b) -> p.toFile().getName().endsWith(".mdb"))) {
    
    102
    +            List<String> collect = pathStream.map(p -> p.toFile().getName()).sorted().collect(Collectors.toList());
    
    100 103
                 Collections.reverse(collect);
    
    101 104
                 return collect;
    
    102 105
             } catch (IOException e) {
    
    ... ... @@ -142,8 +145,12 @@ public abstract class AvdthDataBuilderTestSupport extends PersistenceTestSupport
    142 145
             try {
    
    143 146
                 result = ImportEngine.run(configuration, localTestMethodResource.getTopiaApplicationContext());
    
    144 147
                 String resultAsGson = gson.toJson(result);
    
    145
    -            log.info(String.format("Import result:\n%s", resultAsGson));
    
    146
    -            log.info(String.format("Import messages:\n%s", result.getMessageFile()));
    
    148
    +            log.debug(String.format("Import result:\n%s", resultAsGson));
    
    149
    +            // Used for debugging...
    
    150
    +            Map<String, Integer> exportResult = result.getExportResult();
    
    151
    +            if (!exportResult.isEmpty()) {
    
    152
    +                log.info(String.format("Export result:\n%s", exportResult.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.joining("\n"))));
    
    153
    +            }
    
    147 154
             } finally {
    
    148 155
                 ObserveUtil.cleanMemory();
    
    149 156
             }
    

  • core/persistence/test/src/test/resources/log4j2.xml
    ... ... @@ -46,6 +46,9 @@
    46 46
         <Logger name="org.nuiton.topia.persistence.security.SecurityScriptHelper" level="info" additivity="false">
    
    47 47
           <AppenderRef ref="console"/>
    
    48 48
         </Logger>
    
    49
    +    <Logger name="fr.ird.observe.persistence.avdth.data.AvdthDataBuilderTestSupport" level="info" additivity="false">
    
    50
    +      <AppenderRef ref="console"/>
    
    51
    +    </Logger>
    
    49 52
         <Logger name="fr.ird.observe.persistence.test" level="info" additivity="false">
    
    50 53
           <AppenderRef ref="console"/>
    
    51 54
         </Logger>