This is an automated email from the git hooks/post-receive script. New commit to branch feature1378-MAJ_libs in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit 80f8889ace61f8dae862e25fa72330ab75d69e18 Author: David Cossé <cosse@codelutin.com> Date: Wed Jan 18 10:39:52 2017 +0100 refs #1373 intégration mise à jour topia --- .../org/chorem/lima/business/LimaInterceptor.java | 32 +++++++++++----------- .../org/chorem/lima/business/LimaTestsConfig.java | 2 +- .../src/test/resources/lima-test.properties | 4 +-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java b/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java index 236ca36..8a7264c 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaInterceptor.java @@ -22,14 +22,13 @@ package org.chorem.lima.business; -import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaXAResource; import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; import org.chorem.lima.entity.LimaCallaoTopiaDaoSupplier; +import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; import org.nuiton.topia.persistence.TopiaApplicationContextCache; -import org.nuiton.topia.persistence.TopiaPersistenceContext; import javax.annotation.Resource; import javax.ejb.Stateless; @@ -38,7 +37,6 @@ import javax.interceptor.AroundInvoke; import javax.interceptor.InvocationContext; import javax.transaction.Transaction; import javax.transaction.TransactionManager; -import java.util.Set; /** * Interceptor for topia context transaction. @@ -85,28 +83,30 @@ public class LimaInterceptor { LimaBusinessConfig.getRootContextProperties(), LimaConfigurationHelper.getCreateTopiaContextFunction()); - TopiaPersistenceContext tx; - Set<TopiaPersistenceContext> contexts = rootContext.getPersistenceContexts(); - if (CollectionUtils.isEmpty(contexts)) { - rootContext.newPersistenceContext(); - contexts = rootContext.getPersistenceContexts(); + LimaCallaoTopiaPersistenceContext transaction; + if (rootContext.getPersistenceContexts().isEmpty()) { + transaction = rootContext.newPersistenceContext(); + } else { + transaction = (LimaCallaoTopiaPersistenceContext) rootContext.getPersistenceContexts().iterator().next(); } - tx = contexts.iterator().next(); - DAO_HELPER.set((LimaCallaoTopiaDaoSupplier) tx); + DAO_HELPER.set(transaction); Transaction tr = transactionManager.getTransaction(); // enlist topia xaresource, will commited or rollback // by container - tr.enlistResource(new LimaXAResource(tx)); - } - } + tr.enlistResource(new LimaXAResource(transaction)); + + result = context.proceed(); - try { + DAO_HELPER.remove(); + + } else { + result = context.proceed(); + } + } else { result = context.proceed(); - } finally { - DAO_HELPER.remove(); } return result; diff --git a/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java b/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java index abbed22..eea9c60 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java +++ b/lima-business/src/test/java/org/chorem/lima/business/LimaTestsConfig.java @@ -54,7 +54,7 @@ public class LimaTestsConfig { Map<String, String> toAddIfNotPresent = Maps.newLinkedHashMap(); toAddIfNotPresent.put("topia.service.migration", TopiaFlywayServiceImpl.class.getName()); - toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "true"); + toAddIfNotPresent.put("topia.service.migration." + TopiaFlywayService.USE_MODEL_VERSION, "false"); toAddIfNotPresent.put(TopiaConfigurationConstants.CONFIG_PERSISTENCE_INIT_SCHEMA, "true"); for (Map.Entry<String, String> entry : toAddIfNotPresent.entrySet()) { diff --git a/lima-business/src/test/resources/lima-test.properties b/lima-business/src/test/resources/lima-test.properties index 03593f7..629253b 100644 --- a/lima-business/src/test/resources/lima-test.properties +++ b/lima-business/src/test/resources/lima-test.properties @@ -27,6 +27,4 @@ hibernate.dialect=org.hibernate.dialect.H2Dialect hibernate.connection.username=sa hibernate.connection.password= hibernate.connection.driver_class=org.h2.Driver -hibernate.hbm2ddl.auto=update -# Topia should not create the schema -topia.persistence.initSchema=false +topia.service.migration.flyway.baselineVersion=99999 \ No newline at end of file -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.