Skip to content

Commit

Permalink
Changing isStreamable to isStreaming, as we cannot treat a streaming …
Browse files Browse the repository at this point in the history
…result as a non-streaming one
  • Loading branch information
alexmoore committed Nov 15, 2016
1 parent 78c43f1 commit a797ba6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected StreamableResponse()
* If false, they will appear in the original result collection.
* @return true if the results are to be streamed.
*/
public boolean isStreamable()
public boolean isStreaming()
{
return chunkedResponseIterator != null;
}
Expand All @@ -87,7 +87,7 @@ public boolean isStreamable()
*/
@Override
public Iterator<T> iterator() {
if (isStreamable()) {
if (isStreaming()) {
assert chunkedResponseIterator != null;
return chunkedResponseIterator;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public Response(BinaryValue type, List<BinaryValue> buckets)
@Override
public Iterator<Namespace> iterator()
{
if (isStreamable()) {
if (isStreaming()) {
return super.iterator();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.basho.riak.client.core.util.BinaryValue;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

Expand Down Expand Up @@ -638,7 +637,7 @@ protected Response(Namespace queryLocation,
*/
public Iterator<E> iterator()
{
if (isStreamable()) {
if (isStreaming()) {
return super.iterator();
}

Expand All @@ -663,7 +662,7 @@ protected E convert(SecondaryIndexQueryOperation.Response.Entry e)
*/
public boolean hasContinuation()
{
if (isStreamable())
if (isStreaming())
{
return chunkedResponseIterator.hasContinuation();
}
Expand All @@ -682,7 +681,7 @@ public boolean hasContinuation()
*/
public BinaryValue getContinuation()
{
if (isStreamable())
if (isStreaming())
{
return chunkedResponseIterator.getContinuation();
}
Expand All @@ -702,7 +701,7 @@ public BinaryValue getContinuation()
*/
public boolean hasEntries()
{
if (isStreamable())
if (isStreaming())
{
return chunkedResponseIterator.hasNext();
}
Expand All @@ -718,7 +717,7 @@ public boolean hasEntries()
*/
public final List<E> getEntries()
{
if(isStreamable())
if(isStreaming())
{
throw new IllegalStateException("Use the iterator() while using the streaming API");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public Response(Namespace namespace, List<BinaryValue> keys)
@Override
public Iterator<Location> iterator()
{
if (isStreamable())
if (isStreaming())
{
return super.iterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public Response(Map<Integer, ArrayNode> results)
}

@Override
public boolean isStreamable()
public boolean isStreaming()
{
return responseIterator != null;
}
Expand Down Expand Up @@ -404,7 +404,7 @@ private ArrayNode flattenResults()
@Override
public Iterator<Response> iterator()
{
if (isStreamable()) {
if (isStreaming()) {
return responseIterator;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private Map<CoverageEntry, List<Entry>> retrieveChunkedKeysForCoverageEntry(Riak
readResponse = rc.executeAsyncStreaming(cmd2, pollTimeout).get();
}

assertEquals(useStreaming, readResponse.isStreamable());
assertEquals(useStreaming, readResponse.isStreaming());
final List<Entry> list = new LinkedList<>();
readResponse.forEach( e -> list.add(e));

Expand Down Expand Up @@ -366,7 +366,7 @@ private Map<CoverageEntry, List<Entry>> retrieveChunkedKeysForCoverageEntry(Riak
r = rc.executeAsyncStreaming(cmd2, pollTimeout).get();
}

assertEquals(useStreaming, r.isStreamable());
assertEquals(useStreaming, r.isStreaming());

final List<Entry> entries = new LinkedList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.basho.riak.client.api.RiakClient;
import com.basho.riak.client.core.RiakFuture;
import com.basho.riak.client.core.operations.itest.ITestAutoCleanupBase;
import com.basho.riak.client.api.commands.buckets.StoreBucketProperties;
import com.basho.riak.client.api.commands.kv.StoreValue;
import com.basho.riak.client.api.commands.mapreduce.BucketMapReduce;
Expand All @@ -34,13 +33,9 @@
import com.basho.riak.client.api.commands.mapreduce.filters.TokenizeFilter;
import com.basho.riak.client.core.query.functions.Function;
import com.basho.riak.client.core.util.BinaryValue;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import org.junit.*;

Expand Down Expand Up @@ -178,7 +173,7 @@ private void streamingErlangBucketMR(String bucketType) throws InterruptedExcept
int count = 0;

final MapReduce.Response streamingResponse = streamingFuture.get();
assertTrue(streamingResponse.isStreamable());
assertTrue(streamingResponse.isStreaming());
// The streaming query should return many results which are JSON arrays, each
// containing a piece of the array [0-199].
// Streaming result would look like: [[0], [1,2,3], ... [..., 199]], with the outer
Expand Down

0 comments on commit a797ba6

Please sign in to comment.