From bdab0aa1d3c0e93d7c8bdfdbf294ac96fff65aa2 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Thu, 29 Dec 2016 11:58:20 -0500 Subject: [PATCH] MongoDbInboundChAdapterIntTests race condition Since we can have a result message in the `replyChannel` before the TX commit, a subsequent adapter `stop()` causes the current task interruption, therefore TX rallback. That's why we see `semaphore.acquire()` interruption and don't see message in the `afterCommitChannel` **Cherry-pick to 4.3.x** --- .../config/MongoDbInboundChannelAdapterIntegrationTests.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java index 8f3ece7cc0..d7684653da 100644 --- a/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java +++ b/spring-integration-mongodb/src/test/java/org/springframework/integration/mongodb/config/MongoDbInboundChannelAdapterIntegrationTests.java @@ -25,6 +25,7 @@ import java.util.List; import org.bson.Document; import org.junit.Test; import org.junit.runner.RunWith; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.parsing.BeanDefinitionParsingException; @@ -218,11 +219,10 @@ public class MongoDbInboundChannelAdapterIntegrationTests extends MongoDbAvailab assertNotNull(replyChannel.receive(10000)); assertNull(replyChannel.receive(100)); - this.inboundAdapterWithOnSuccessDisposition.stop(); - assertNotNull(this.afterCommitChannel.receive(10000)); assertNull(this.mongoTemplate.findOne(new Query(Criteria.where("name").is("Bob")), Person.class, "data")); + this.inboundAdapterWithOnSuccessDisposition.stop(); this.replyChannel.purge(null); }