INT-3789: Upgrade to SF 4.2 and other fixes
JIRA: https://jira.spring.io/browse/INT-3789 * Hazelcast -> `3.5.1` * ActiveMq -> `5.11.1` * Boon -> `0.33` * Spring Security -> `4.0.2` * Kryo -> `3.0.3` * Fix missed polishing for the `Log4jLevelAdjuster` according required generics: https://build.spring.io/browse/INT-MJATS41-348 * Fix `ImapIdelIntegrationTests` sporadic failure * Fix `Kryo` Codec stuff according to the changes in the latest Kryo version
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,21 +16,23 @@
|
||||
package org.springframework.integration.mail.config;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import javax.mail.Folder;
|
||||
import javax.mail.Message;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
||||
@@ -39,13 +41,15 @@ import org.springframework.integration.mail.ImapIdleChannelAdapter;
|
||||
import org.springframework.integration.mail.ImapMailReceiver;
|
||||
import org.springframework.integration.test.util.TestUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* @author Oleg Zhurakousky
|
||||
* @author Artem Bilan
|
||||
*/
|
||||
public class ImapIdelIntegrationTests {
|
||||
public class ImapIdleIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void testWithTransactionSynchronization() throws Exception{
|
||||
public void testWithTransactionSynchronization() throws Exception {
|
||||
final AtomicBoolean block = new AtomicBoolean(false);
|
||||
ClassPathXmlApplicationContext context =
|
||||
new ClassPathXmlApplicationContext("imap-idle-mock-integration-config.xml", this.getClass());
|
||||
@@ -61,7 +65,7 @@ public class ImapIdelIntegrationTests {
|
||||
// to emulate the behavior of IDLE
|
||||
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
if (block.get()){
|
||||
if (block.get()) {
|
||||
Thread.sleep(5000);
|
||||
}
|
||||
block.set(true);
|
||||
@@ -83,17 +87,29 @@ public class ImapIdelIntegrationTests {
|
||||
mrField.set(adapter, receiver);
|
||||
// end mock setup
|
||||
|
||||
final CountDownLatch txProcessorLatch = new CountDownLatch(1);
|
||||
doAnswer(new Answer<Object>() {
|
||||
|
||||
@Override
|
||||
public Object answer(InvocationOnMock invocation) throws Throwable {
|
||||
txProcessorLatch.countDown();
|
||||
return null;
|
||||
}
|
||||
|
||||
}).when(processor).process(any(Message.class));
|
||||
|
||||
adapter.start();
|
||||
|
||||
Thread.sleep(1000);
|
||||
// validating that TXpost processor was invoked
|
||||
assertTrue(txProcessorLatch.await(10, TimeUnit.SECONDS));
|
||||
|
||||
adapter.stop();
|
||||
context.destroy();
|
||||
verify(processor, Mockito.times(1)).process(m1);
|
||||
|
||||
}
|
||||
|
||||
public static interface PostTransactionProcessor {
|
||||
public void process(Message mailMessage);
|
||||
public interface PostTransactionProcessor {
|
||||
|
||||
void process(Message mailMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,8 @@
|
||||
</int:transaction-synchronization-factory>
|
||||
|
||||
<bean id="syncProcessor" class="org.mockito.Mockito" factory-method="mock">
|
||||
<constructor-arg value="org.springframework.integration.mail.config.ImapIdelIntegrationTests.PostTransactionProcessor"/>
|
||||
<constructor-arg
|
||||
value="org.springframework.integration.mail.config.ImapIdleIntegrationTests.PostTransactionProcessor"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.integration.transaction.PseudoTransactionManager"/>
|
||||
|
||||
Reference in New Issue
Block a user