Change test spec to return array from reduce phase
This commit is contained in:
@@ -160,10 +160,10 @@ class RiakTemplateSpec extends Specification {
|
||||
|
||||
given:
|
||||
MapReduceJob job = riak.createMapReduceJob()
|
||||
def mapJs = new JavascriptMapReduceOperation("function(v){ var o=Riak.mapValuesJson(v); return [o[0].integer]; }")
|
||||
def mapJs = new JavascriptMapReduceOperation("function(v){ ejsLog('/tmp/mapred.log', 'map='+JSON.stringify(v)); var o=Riak.mapValuesJson(v); return [1]; }")
|
||||
def mapPhase = new RiakMapReducePhase("map", "javascript", mapJs)
|
||||
|
||||
def reduceJs = new JavascriptMapReduceOperation("function(v){ return v.length; }")
|
||||
def reduceJs = new JavascriptMapReduceOperation("function(v){ ejsLog('/tmp/mapred.log', 'reduce='+JSON.stringify(v)); return [v.length]; }")
|
||||
def reducePhase = new RiakMapReducePhase("reduce", "javascript", reduceJs)
|
||||
|
||||
job.addInputs(["test"]).
|
||||
@@ -172,10 +172,11 @@ class RiakTemplateSpec extends Specification {
|
||||
|
||||
when:
|
||||
println "M/R: ${job.toJson()}"
|
||||
def result = riak.execute(job, Integer)
|
||||
def result = riak.execute(job, List)
|
||||
|
||||
then:
|
||||
1 == result
|
||||
1 == result.size()
|
||||
1 == result[0]
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user