From ae4af38c05c19ea680948f75c66e28ba1c0dc8bb Mon Sep 17 00:00:00 2001 From: "J. Brisbin" Date: Wed, 8 Dec 2010 16:42:41 -0600 Subject: [PATCH] Turning on tests, adding hooks to start and stop Riak server. --- spring-data-riak/pom.xml | 4 ++-- .../keyvalue/riak/core/RiakTemplateSpec.groovy | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/spring-data-riak/pom.xml b/spring-data-riak/pom.xml index 1ff0826b5..5b352a9ea 100644 --- a/spring-data-riak/pom.xml +++ b/spring-data-riak/pom.xml @@ -126,7 +126,7 @@ com.springsource.bundlor com.springsource.bundlor.maven - org.spockframework spock-maven @@ -167,7 +167,7 @@ 2.7.7 - --> + diff --git a/spring-data-riak/src/test/groovy/org/springframework/data/keyvalue/riak/core/RiakTemplateSpec.groovy b/spring-data-riak/src/test/groovy/org/springframework/data/keyvalue/riak/core/RiakTemplateSpec.groovy index b5f7f9cb7..56e57bd28 100644 --- a/spring-data-riak/src/test/groovy/org/springframework/data/keyvalue/riak/core/RiakTemplateSpec.groovy +++ b/spring-data-riak/src/test/groovy/org/springframework/data/keyvalue/riak/core/RiakTemplateSpec.groovy @@ -21,6 +21,7 @@ import org.springframework.data.keyvalue.riak.mapreduce.JavascriptMapReduceOpera import org.springframework.data.keyvalue.riak.mapreduce.MapReduceJob import org.springframework.data.keyvalue.riak.mapreduce.RiakMapReducePhase import org.springframework.test.context.ContextConfiguration +import spock.lang.Shared import spock.lang.Specification /** @@ -34,6 +35,19 @@ class RiakTemplateSpec extends Specification { @Autowired RiakKeyValueTemplate riak int run = 1 + @Shared def riakBin = System.getenv("RIAK_BIN") + @Shared def p + + def setupSpec() { + p = "$riakBin start".execute() + p.waitFor() + Thread.sleep(2000) + } + + def cleanupSpec() { + "$riakBin stop".execute() + p.waitFor() + } def "Test Map object"() { @@ -126,10 +140,10 @@ class RiakTemplateSpec extends Specification { when: def val = riak.getWithMetaData("test:test", Map) - def result = val.metaData.properties["Link"].collect { it.contains("riaktag=\"test\"") } + def result = val.metaData.properties["Link"].find { it.contains("riaktag=\"test\"") } then: - 1 == result.size() + null != result }