INT-4349: Allow Number type for int headers
JIRA: https://jira.spring.io/browse/INT-4349 When headers come from the external system there is no guarantee that special headers (e.g. `sequenceNumber`, `priority` etc.) in the expected (`Integer`) type. * Widen `int` headers setting value to the `Number` type * Return primitive `int` for the `sequenceNumber` and `sequenceSize` headers since for them `IntegrationMessageHeaderAccessor` never return null for them * Remove `SequenceNumberComparator` in favor of `MessageSequenceComparator` since they are essentially duplicate each other * Fix tests to deal with primitive `int` already
This commit is contained in:
committed by
Gary Russell
parent
e6225926c4
commit
c65584a007
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -81,6 +81,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 4.0
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@@ -229,12 +230,12 @@ public class ChannelSecurityInterceptorSecuredChannelAnnotationTests {
|
||||
Message<?> receive = this.securedChannelQueue.receive(10000);
|
||||
assertNotNull(receive);
|
||||
IntegrationMessageHeaderAccessor headerAccessor = new IntegrationMessageHeaderAccessor(receive);
|
||||
assertEquals(new Integer(0), headerAccessor.getSequenceNumber());
|
||||
assertEquals(0, headerAccessor.getSequenceNumber());
|
||||
|
||||
receive = this.securedChannelQueue2.receive(10000);
|
||||
assertNotNull(receive);
|
||||
headerAccessor = new IntegrationMessageHeaderAccessor(receive);
|
||||
assertEquals(new Integer(0), headerAccessor.getSequenceNumber());
|
||||
assertEquals(0, headerAccessor.getSequenceNumber());
|
||||
|
||||
this.publishSubscribeChannel.setApplySequence(true);
|
||||
|
||||
@@ -243,12 +244,12 @@ public class ChannelSecurityInterceptorSecuredChannelAnnotationTests {
|
||||
receive = this.securedChannelQueue.receive(10000);
|
||||
assertNotNull(receive);
|
||||
headerAccessor = new IntegrationMessageHeaderAccessor(receive);
|
||||
assertEquals(new Integer(1), headerAccessor.getSequenceNumber());
|
||||
assertEquals(1, headerAccessor.getSequenceNumber());
|
||||
|
||||
receive = this.securedChannelQueue2.receive(10000);
|
||||
assertNotNull(receive);
|
||||
headerAccessor = new IntegrationMessageHeaderAccessor(receive);
|
||||
assertEquals(new Integer(2), headerAccessor.getSequenceNumber());
|
||||
assertEquals(2, headerAccessor.getSequenceNumber());
|
||||
|
||||
this.publishSubscribeChannel.setApplySequence(false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user