Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: fab9f566 by Tony Chemit at 2020-12-23T15:28:50+01:00 debug level for report tests - - - - - c0cb65a8 by Tony Chemit at 2020-12-23T15:29:44+01:00 fix bad design in ToPIA: we should not do init stuff in application context, but just do it in a init method outside of the constructor hell hole - - - - - 2 changed files: - services/local-impl/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java - toolkit/persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaApplicationContextSupport.java Changes: ===================================== services/local-impl/src/test/java/fr/ird/observe/services/local/service/actions/report/AbstractReportServiceLocalTest.java ===================================== @@ -140,7 +140,7 @@ public abstract class AbstractReportServiceLocalTest extends ServiceLocalTestSup // on execute le report DataMatrix result = service.executeReport(report, tripIds); - log.info(String.format("Result :\n%s", result.getClipboardContent(true, true, true, ','))); + log.debug(String.format("Result :\n%s", result.getClipboardContent(true, true, true, ','))); // on verifie le resultat testReportResult(result); ===================================== toolkit/persistence/src/main/java/fr/ird/observe/entities/ObserveTopiaApplicationContextSupport.java ===================================== @@ -73,30 +73,26 @@ public abstract class ObserveTopiaApplicationContextSupport<P extends ObserveTop /** * Unique id associated with this application context. */ - protected final String authenticationToken; + protected final String authenticationToken = UUID.randomUUID().toString(); + /** + * Mise à {@code true} quand au moins une connection a été effectuée. + */ + protected boolean open; /** * Meta model support. */ - private transient final SingletonSupplier<TopiaMetadataModelSupport> topiaMetadataModelSupport; + private transient SingletonSupplier<TopiaMetadataModelSupport> topiaMetadataModelSupport; /** * Entity sql support. */ - private transient final SingletonSupplier<TopiaEntitySqlModelSupport> topiaEntitySqlModelSupport; + private transient SingletonSupplier<TopiaEntitySqlModelSupport> topiaEntitySqlModelSupport; /** * Usage model. */ - private transient final SingletonSupplier<TopiaUsageModel> topiaUsageModel; - /** - * Mise à {@code true} quand au moins une connection a été effectuée. - */ - protected boolean open; + private transient SingletonSupplier<TopiaUsageModel> topiaUsageModel; public ObserveTopiaApplicationContextSupport(TopiaConfiguration topiaConfiguration) { super(topiaConfiguration); - this.authenticationToken = UUID.randomUUID().toString(); - this.topiaMetadataModelSupport = SingletonSupplier.of(this::newMetaModelSupport); - this.topiaEntitySqlModelSupport = SingletonSupplier.of(this::newEntitySqlModelSupport); - this.topiaUsageModel = SingletonSupplier.of(this::newUsageModel); } @SuppressWarnings("deprecation") @@ -120,10 +116,16 @@ public abstract class ObserveTopiaApplicationContextSupport<P extends ObserveTop public abstract ImmutableSet<Class<? extends ReferentialDto>> referentialForReplicationDto(); public TopiaUsageModel getTopiaUsageModel() { + if (topiaUsageModel == null) { + topiaUsageModel = SingletonSupplier.of(this::newUsageModel); + } return topiaUsageModel.get(); } public TopiaEntitySqlModelSupport getTopiaEntitySqlModelSupport() { + if (topiaEntitySqlModelSupport == null) { + topiaEntitySqlModelSupport = SingletonSupplier.of(this::newEntitySqlModelSupport); + } return topiaEntitySqlModelSupport.get(); } @@ -132,6 +134,9 @@ public abstract class ObserveTopiaApplicationContextSupport<P extends ObserveTop } protected final TopiaMetadataModelSupport getTopiaMetadataModelSupport() { + if (topiaMetadataModelSupport == null) { + topiaMetadataModelSupport = SingletonSupplier.of(this::newMetaModelSupport); + } return topiaMetadataModelSupport.get(); } View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/dfc7cad31d57f527f4196d25a... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/dfc7cad31d57f527f4196d25a... You're receiving this email because of your account on gitlab.com.
participants (1)
-
Tony CHEMIT