Turning on tests, adding hooks to start and stop Riak server.

This commit is contained in:
J. Brisbin
2010-12-08 16:42:41 -06:00
parent 892fd53900
commit ae4af38c05
2 changed files with 18 additions and 4 deletions

View File

@@ -126,7 +126,7 @@
<groupId>com.springsource.bundlor</groupId>
<artifactId>com.springsource.bundlor.maven</artifactId>
</plugin>
<!-- For running Groovy/Spock tests
<!-- For running Groovy/Spock tests -->
<plugin>
<groupId>org.spockframework</groupId>
<artifactId>spock-maven</artifactId>
@@ -167,7 +167,7 @@
<version>2.7.7</version>
</dependency>
</dependencies>
</plugin>-->
</plugin>
</plugins>
</build>

View File

@@ -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
}