CAMEL-10883: show that payloads with multiple pauses are not read correctly
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4c043a8b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4c043a8b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4c043a8b Branch: refs/heads/master Commit: 4c043a8b6a174a90dd0767ba8e97bff86c7140b5 Parents: dc42a59 Author: rohan <[email protected]> Authored: Tue Feb 21 14:24:42 2017 +1300 Committer: Andrea Cosentino <[email protected]> Committed: Thu Feb 23 10:00:24 2017 +0100 ---------------------------------------------------------------------- .../DefaultUndertowHttpBindingTest.java | 21 ++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4c043a8b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/DefaultUndertowHttpBindingTest.java ---------------------------------------------------------------------- diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/DefaultUndertowHttpBindingTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/DefaultUndertowHttpBindingTest.java index 797196f..e8e1726 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/DefaultUndertowHttpBindingTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/DefaultUndertowHttpBindingTest.java @@ -49,11 +49,28 @@ public class DefaultUndertowHttpBindingTest { .collect(Collectors.joining()))); } + @Test(timeout = 1000) + public void readEntireMultiDelayedWithPausePayload() throws Exception { + String[] delayedPayloads = new String[] { + "first ", + "", + "second", + }; + + StreamSourceChannel source = source(delayedPayloads); + + DefaultUndertowHttpBinding binding = new DefaultUndertowHttpBinding(); + String result = new String(binding.readFromChannel(source)); + + assertThat(result, is( + Stream.of(delayedPayloads) + .collect(Collectors.joining()))); + } + private StreamSourceChannel source(final String[] delayedPayloads) { - XnioIoThread thread = thread(); Thread sourceThread = Thread.currentThread(); - return new EmptyStreamSourceChannel(thread) { + return new EmptyStreamSourceChannel(thread()) { int chunk = 0; @Override
