Skip to content

Commit 4cca684

Browse files
committed
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
1 parent 88be3dd commit 4cca684

File tree

6 files changed

+52
-30
lines changed

6 files changed

+52
-30
lines changed

build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ subprojects { subproject ->
8282

8383

8484
ext {
85-
activeMqVersion = '5.11.0'
85+
activeMqVersion = '5.11.1'
8686
aspectjVersion = '1.8.4'
8787
apacheSshdVersion = '0.13.0'
88-
boonVersion = '0.31'
88+
boonVersion = '0.33'
8989
chronicleVersion = '3.4.3'
9090
commonsDbcpVersion = '1.4'
9191
commonsIoVersion = '2.4'
@@ -97,7 +97,7 @@ subprojects { subproject ->
9797
groovyVersion = '2.4.4'
9898
guavaVersion = '18.0'
9999
hamcrestVersion = '1.3'
100-
hazelcastVersion = '3.4.2'
100+
hazelcastVersion = '3.5.1'
101101
hibernateVersion = '4.3.10.Final'
102102
hsqldbVersion = '2.3.2'
103103
h2Version = '1.4.180'
@@ -113,7 +113,7 @@ subprojects { subproject ->
113113
jsonpathVersion = '2.0.0'
114114
junitVersion = '4.11'
115115
jythonVersion = '2.5.3'
116-
kryoShadedVersion = '3.0.0'
116+
kryoShadedVersion = '3.0.3'
117117
log4jVersion = '1.2.17'
118118
mockitoVersion = '1.9.5'
119119
mysqlVersion = '5.1.34'
@@ -136,10 +136,10 @@ subprojects { subproject ->
136136
springDataMongoVersion = '1.7.2.RELEASE'
137137
springDataRedisVersion = '1.5.2.RELEASE'
138138
springGemfireVersion = '1.6.0.RELEASE'
139-
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '4.0.1.RELEASE'
139+
springSecurityVersion = project.hasProperty('springSecurityVersion') ? project.springSecurityVersion : '4.0.2.RELEASE'
140140
springSocialTwitterVersion = '1.1.0.RELEASE'
141141
springRetryVersion = '1.1.2.RELEASE'
142-
springVersion = project.hasProperty('springVersion') ? project.springVersion : '4.2.0.BUILD-SNAPSHOT'
142+
springVersion = project.hasProperty('springVersion') ? project.springVersion : '4.2.0.RELEASE'
143143
springWsVersion = '2.2.1.RELEASE'
144144
xmlUnitVersion = '1.5'
145145
xstreamVersion = '1.4.7'

spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/PojoCodec.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import java.util.Collections;
2020
import java.util.List;
2121

22+
import org.objenesis.strategy.StdInstantiatorStrategy;
23+
2224
import org.springframework.util.CollectionUtils;
2325

2426
import com.esotericsoftware.kryo.Kryo;
@@ -31,6 +33,7 @@
3133
* {@link KryoRegistrar}s.
3234
*
3335
* @author David Turanski
36+
* @author Artem Bilan
3437
* @since 4.2
3538
*/
3639
public class PojoCodec extends AbstractKryoCodec {
@@ -96,6 +99,7 @@ protected <T> T doDecode(Kryo kryo, Input input, Class<T> type) {
9699

97100
@Override
98101
protected void configureKryoInstance(Kryo kryo) {
102+
kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
99103
if (this.kryoRegistrar != null) {
100104
this.kryoRegistrar.registerTypes(kryo);
101105
}

spring-integration-core/src/test/java/org/springframework/integration/codec/CompositeCodecTests.java renamed to spring-integration-core/src/test/java/org/springframework/integration/codec/kryo/CompositeCodecTests.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/*
22
* Copyright 2015 the original author or authors.
33
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
1515
*/
1616

17-
package org.springframework.integration.codec;
17+
package org.springframework.integration.codec.kryo;
1818

1919
import static org.junit.Assert.assertEquals;
2020

@@ -25,7 +25,8 @@
2525
import org.junit.Before;
2626
import org.junit.Test;
2727

28-
import org.springframework.integration.codec.kryo.PojoCodec;
28+
import org.springframework.integration.codec.Codec;
29+
import org.springframework.integration.codec.CompositeCodec;
2930

3031
/**
3132
* @author David Turanski

spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdelIntegrationTests.java renamed to spring-integration-mail/src/test/java/org/springframework/integration/mail/config/ImapIdleIntegrationTests.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,21 +16,23 @@
1616
package org.springframework.integration.mail.config;
1717

1818
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.assertTrue;
20+
import static org.mockito.Matchers.any;
1921
import static org.mockito.Mockito.doAnswer;
2022
import static org.mockito.Mockito.doReturn;
2123
import static org.mockito.Mockito.mock;
2224
import static org.mockito.Mockito.spy;
23-
import static org.mockito.Mockito.verify;
2425
import static org.mockito.Mockito.when;
2526

2627
import java.lang.reflect.Field;
28+
import java.util.concurrent.CountDownLatch;
29+
import java.util.concurrent.TimeUnit;
2730
import java.util.concurrent.atomic.AtomicBoolean;
2831

2932
import javax.mail.Folder;
3033
import javax.mail.Message;
3134

3235
import org.junit.Test;
33-
import org.mockito.Mockito;
3436
import org.mockito.invocation.InvocationOnMock;
3537
import org.mockito.stubbing.Answer;
3638

@@ -39,13 +41,15 @@
3941
import org.springframework.integration.mail.ImapMailReceiver;
4042
import org.springframework.integration.test.util.TestUtils;
4143
import org.springframework.util.ReflectionUtils;
44+
4245
/**
4346
* @author Oleg Zhurakousky
47+
* @author Artem Bilan
4448
*/
45-
public class ImapIdelIntegrationTests {
49+
public class ImapIdleIntegrationTests {
4650

4751
@Test
48-
public void testWithTransactionSynchronization() throws Exception{
52+
public void testWithTransactionSynchronization() throws Exception {
4953
final AtomicBoolean block = new AtomicBoolean(false);
5054
ClassPathXmlApplicationContext context =
5155
new ClassPathXmlApplicationContext("imap-idle-mock-integration-config.xml", this.getClass());
@@ -61,7 +65,7 @@ public void testWithTransactionSynchronization() throws Exception{
6165
// to emulate the behavior of IDLE
6266

6367
public Object answer(InvocationOnMock invocation) throws Throwable {
64-
if (block.get()){
68+
if (block.get()) {
6569
Thread.sleep(5000);
6670
}
6771
block.set(true);
@@ -83,17 +87,29 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
8387
mrField.set(adapter, receiver);
8488
// end mock setup
8589

90+
final CountDownLatch txProcessorLatch = new CountDownLatch(1);
91+
doAnswer(new Answer<Object>() {
92+
93+
@Override
94+
public Object answer(InvocationOnMock invocation) throws Throwable {
95+
txProcessorLatch.countDown();
96+
return null;
97+
}
98+
99+
}).when(processor).process(any(Message.class));
100+
86101
adapter.start();
87102

88-
Thread.sleep(1000);
89-
// validating that TXpost processor was invoked
103+
assertTrue(txProcessorLatch.await(10, TimeUnit.SECONDS));
90104

91105
adapter.stop();
92106
context.destroy();
93-
verify(processor, Mockito.times(1)).process(m1);
107+
94108
}
95109

96-
public static interface PostTransactionProcessor {
97-
public void process(Message mailMessage);
110+
public interface PostTransactionProcessor {
111+
112+
void process(Message mailMessage);
98113
}
114+
99115
}

spring-integration-mail/src/test/java/org/springframework/integration/mail/config/imap-idle-mock-integration-config.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
</int:transaction-synchronization-factory>
2121

2222
<bean id="syncProcessor" class="org.mockito.Mockito" factory-method="mock">
23-
<constructor-arg value="org.springframework.integration.mail.config.ImapIdelIntegrationTests.PostTransactionProcessor"/>
23+
<constructor-arg
24+
value="org.springframework.integration.mail.config.ImapIdleIntegrationTests.PostTransactionProcessor"/>
2425
</bean>
2526

2627
<bean id="transactionManager" class="org.springframework.integration.transaction.PseudoTransactionManager"/>

spring-integration-test/src/main/java/org/springframework/integration/test/rule/Log4jLevelAdjuster.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public Log4jLevelAdjuster(Level level, Class<?>... classes) {
5656

5757
public Log4jLevelAdjuster(Level level, String... categories) {
5858
this.level = level;
59-
this.classes = new Class[0];
59+
this.classes = new Class<?>[0];
6060
this.categories = categories;
6161
}
6262

0 commit comments

Comments
 (0)