Skip to content

Commit

Permalink
fixed bug with deploying Cassandra. Added a demo project to make test…
Browse files Browse the repository at this point in the history
…ing easier
  • Loading branch information
Shiti committed Apr 20, 2016
1 parent b443832 commit 69973b2
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ sbt-cassandra
==============

An auto-plugin that launches [Cassandra](http://cassandra.apache.org) during integration tests.
Note: The plugin does not work on WindowsOS

## Installation ##
Add the following to your `project/plugins.sbt` file:

```scala
addSbtPlugin("com.tuplejump.com.github.hochgi" % "sbt-cassandra" % "1.0.2")
addSbtPlugin("com.tuplejump.com.github.hochgi" % "sbt-cassandra" % "1.0.4")
```

## Usage ##
Expand All @@ -17,6 +18,8 @@ In `build.sbt`, enable the plugin for desired project and specify the version of
```scala
lazy val root = (project in file("."))
.enablePlugins(CassandraITPlugin)
.configs(IntegrationTest)
.settings(Defaults.itSettings: _*)
.settings(cassandraVersion := "3.4")
```

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name := "sbt-cassandra"

description := "SBT plugin to launch and use Cassandra during integration tests"

version := "1.0.3"
version := "1.0.4"

scalaVersion := "2.10.4"

Expand Down
12 changes: 12 additions & 0 deletions demo/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name := "demo"

version := "1.0.0"

scalaVersion := "2.11.8"

lazy val root = (project in file("."))
.enablePlugins(CassandraITPlugin)
.configs(IntegrationTest)
.settings(Defaults.itSettings: _*)
.settings(cassandraVersion := "3.4")

1 change: 1 addition & 0 deletions demo/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version = 0.13.8
3 changes: 3 additions & 0 deletions demo/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
logLevel := Level.Warn

addSbtPlugin("com.tuplejump.com.github.hochgi" % "sbt-cassandra" % "1.0.4")
5 changes: 5 additions & 0 deletions demo/src/it/scala/com/tuplejump/DummySpec.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.tuplejump

class DummySpec{

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ object CassandraITPlugin extends AutoPlugin {

if (cassandraTarGz == null) sys.error("could not load: cassandra tar.gz file.")
logger.info(s"cassandraTarGz: ${cassandraTarGz.getAbsolutePath}")
val fileName: String = cassandraTarGz.getName
val extensionIndex = fileName.indexOf(".tar.gz")
val dirName = fileName.substring(0, extensionIndex)
Process(Seq("tar", "-xzf", cassandraTarGz.getAbsolutePath), targetDir).!
val dirName = "cassandraForIT"
Process(Seq("mkdir", "-p", dirName), targetDir).!
Process(Seq("tar", "-xzf", cassandraTarGz.getAbsolutePath, "-C", dirName,"--strip-components=1"), targetDir).!
val cassHome = targetDir / dirName
//old cassandra versions used log4j, newer versions use logback and are configurable through env vars
val oldLogging = cassHome / "conf" / "log4j-server.properties"
Expand Down

0 comments on commit 69973b2

Please sign in to comment.