aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-15 23:09:44 +0200
commit72231250ed81e10d66bfe70701e64fa5fe50f712 (patch)
tree2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java
Publish
Diffstat (limited to 'container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java')
-rw-r--r--container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java b/container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java
new file mode 100644
index 00000000000..1e684b816aa
--- /dev/null
+++ b/container-core/src/test/java/com/yahoo/processing/rendering/TestContentChannel.java
@@ -0,0 +1,42 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.processing.rendering;
+
+import com.yahoo.jdisc.handler.CompletionHandler;
+import com.yahoo.jdisc.handler.ContentChannel;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a>
+* @since 5.1.9
+*/
+class TestContentChannel implements ContentChannel {
+ private final List<ByteBuffer> buffers = new ArrayList<>();
+ private boolean closed = false;
+
+ @Override
+ public void write(ByteBuffer buf, CompletionHandler handler) {
+ buffers.add(buf);
+ if (handler != null) {
+ handler.completed();
+ }
+ }
+
+ @Override
+ public void close(CompletionHandler handler) {
+ closed = true;
+ if (handler != null) {
+ handler.completed();
+ }
+ }
+
+ public List<ByteBuffer> getBuffers() {
+ return buffers;
+ }
+
+ public boolean isClosed() {
+ return closed;
+ }
+}