Skip to content

Commit

Permalink
Merge branch 'release/0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Nievelt committed May 15, 2015
2 parents 75a7cbd + df7f964 commit e814142
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: scala
sudo: false
scala:
- 2.10.4
- 2.10.5
before_script:
- mysql -u root -e "create database storehaus_test;"
- mysql -u root -e "create user 'storehaususer'@'localhost' identified by 'test1234';"
Expand Down
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Storehaus #

### Version 0.11.0 ###
* Add correct String/ChannelBuffer injections #257
* initial scalatest migration #260
* Remove usage of twitter's maven repo, travis seems to dislike it -- mayb... #261
* Bijection 0.8.0, algebird 0.10.0, scalding 0.14.0, and scala 2.10.5

### Version 0.10.0 ###
* Use latest scalding, algebird, and bijection versions: https://github.com/twitter/storehaus/pull/255
* Use new Travis CI container infrastructure: https://github.com/twitter/storehaus/pull/254
Expand Down
55 changes: 30 additions & 25 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ import AssemblyKeys._
object StorehausBuild extends Build {
def withCross(dep: ModuleID) =
dep cross CrossVersion.binaryMapped {
case "2.9.3" => "2.9.2" // TODO: hack because twitter hasn't built things against 2.9.3
case version if version startsWith "2.10" => "2.10" // TODO: hack because sbt is broken
case x => x
}

def specs2Import(scalaVersion: String) = scalaVersion match {
case version if version startsWith "2.9" => "org.specs2" %% "specs2" % "1.12.4.1" % "test"
case version if version startsWith "2.10" => "org.specs2" %% "specs2" % "1.13" % "test"
}
val extraSettings =
Project.defaultSettings ++ Boilerplate.settings ++ assemblySettings ++ mimaDefaultSettings

Expand All @@ -57,16 +51,15 @@ object StorehausBuild extends Build {

val sharedSettings = extraSettings ++ ciSettings ++ Seq(
organization := "com.twitter",
scalaVersion := "2.10.4",
version := "0.10.0",
crossScalaVersions := Seq("2.10.4"),
scalaVersion := "2.10.5",
version := "0.11.0",
crossScalaVersions := Seq("2.10.5"),
javacOptions ++= Seq("-source", "1.6", "-target", "1.6"),
javacOptions in doc := Seq("-source", "1.6"),
libraryDependencies <+= scalaVersion(specs2Import(_)),
libraryDependencies += "org.scalatest" %% "scalatest" % scalatestVersion % "test",
resolvers ++= Seq(
Opts.resolver.sonatypeSnapshots,
Opts.resolver.sonatypeReleases,
"Twitter Maven" at "http://maven.twttr.com",
"Conjars Repository" at "http://conjars.org/repo"
),
parallelExecution in Test := true,
Expand Down Expand Up @@ -117,12 +110,15 @@ object StorehausBuild extends Build {
def youngestForwardCompatible(subProj: String) =
Some(subProj)
.filterNot(unreleasedModules.contains(_))
.map { s => "com.twitter" % ("storehaus-" + s + "_2.10") % "0.10.0" }
.map { s => "com.twitter" % ("storehaus-" + s + "_2.10") % "0.11.0" }

val algebirdVersion = "0.9.0"
val bijectionVersion = "0.7.2"
val algebirdVersion = "0.10.0"
val bijectionVersion = "0.8.0"
val utilVersion = "6.22.0"
val scaldingVersion = "0.13.1"
val scaldingVersion = "0.14.0"
val finagleVersion = "6.22.0"
val scalatestVersion = "2.2.4"
val specs2Version = "1.13"
lazy val storehaus = Project(

id = "storehaus",
Expand Down Expand Up @@ -182,19 +178,23 @@ object StorehausBuild extends Build {
"com.twitter" %% "algebird-core" % algebirdVersion,
"com.twitter" %% "bijection-core" % bijectionVersion,
"com.twitter" %% "bijection-netty" % bijectionVersion,
Finagle.module("memcached")
"com.twitter" %% "finagle-memcached" % finagleVersion excludeAll(
// we don't use this and its not on maven central.
ExclusionRule("com.twitter.common.zookeeper"),
ExclusionRule("com.twitter.common")
)
)
).dependsOn(storehausAlgebra % "test->test;compile->compile")

lazy val storehausMySQL = module("mysql").settings(
libraryDependencies += Finagle.module("mysql")
libraryDependencies += "com.twitter" %% "finagle-mysql" % finagleVersion
).dependsOn(storehausAlgebra % "test->test;compile->compile")

lazy val storehausRedis = module("redis").settings(
libraryDependencies ++= Seq (
"com.twitter" %% "bijection-core" % bijectionVersion,
"com.twitter" %% "bijection-netty" % bijectionVersion,
Finagle.module("redis")
"com.twitter" %% "finagle-redis" % finagleVersion
),
// we don't want various tests clobbering each others keys
parallelExecution in Test := false
Expand Down Expand Up @@ -234,7 +234,8 @@ object StorehausBuild extends Build {
ExclusionRule("com.sun.jdmk","jmxtools"),
ExclusionRule( "com.sun.jmx","jmxri"),
ExclusionRule( "javax.jms","jms")
)
),
"org.specs2" %% "specs2" % specs2Version % "test"
),
// we don't want various tests clobbering each others keys
parallelExecution in Test := false
Expand All @@ -247,7 +248,8 @@ object StorehausBuild extends Build {
"org.apache.kafka" % "kafka_2.9.2" % "0.8.0" % "provided" excludeAll(
ExclusionRule(organization = "com.sun.jdmk"),
ExclusionRule(organization = "com.sun.jmx"),
ExclusionRule(organization = "javax.jms"))
ExclusionRule(organization = "javax.jms")),
"org.specs2" %% "specs2" % specs2Version % "test"
),
// we don't want various tests clobbering each others keys
parallelExecution in Test := false
Expand Down Expand Up @@ -279,8 +281,10 @@ object StorehausBuild extends Build {
settings = sharedSettings ++ Seq(
name := "storehaus-testing",
previousArtifact := youngestForwardCompatible("testing"),
libraryDependencies ++= Seq("org.scalacheck" %% "scalacheck" % "1.10.0" withSources(),
withCross("com.twitter" %% "util-core" % utilVersion))
libraryDependencies ++= Seq(
"org.scalacheck" %% "scalacheck" % "1.10.0" withSources(),
withCross("com.twitter" %% "util-core" % utilVersion)
)
)
)

Expand All @@ -289,13 +293,14 @@ object StorehausBuild extends Build {
"com.google.code.java-allocation-instrumenter" % "java-allocation-instrumenter" % "2.0",
"com.google.code.gson" % "gson" % "1.7.1",
"com.twitter" %% "bijection-core" % bijectionVersion,
"com.twitter" %% "algebird-core" % algebirdVersion),
javaOptions in run <++= (fullClasspath in Runtime) map { cp => Seq("-cp", sbt.Build.data(cp).mkString(":")) }
"com.twitter" %% "algebird-core" % algebirdVersion
),
javaOptions in run <++= (fullClasspath in Runtime) map { cp => Seq("-cp", sbt.Build.data(cp).mkString(":")) }
).dependsOn(storehausCore, storehausAlgebra, storehausCache)

lazy val storehausHttp = module("http").settings(
libraryDependencies ++= Seq(
Finagle.module("http"),
"com.twitter" %% "finagle-http" % finagleVersion,
"com.twitter" %% "bijection-netty" % bijectionVersion
)
).dependsOn(storehausCore)
Expand Down
11 changes: 0 additions & 11 deletions project/Finagle.scala

This file was deleted.

4 changes: 2 additions & 2 deletions sbt
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ declare -r default_jvm_opts="-Dfile.encoding=UTF8 -XX:MaxPermSize=384m -Xms512m
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
declare -r latest_28="2.8.2"
declare -r latest_29="2.9.3"
declare -r latest_210="2.10.3"
declare -r latest_211="2.11.0-M5"
declare -r latest_210="2.10.5"
declare -r latest_211="2.11.5"

declare -r script_path=$(get_script_path "$BASH_SOURCE")
declare -r script_dir="$(dirname $script_path)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

package com.twitter.storehaus.cache

import org.specs2.mutable._
import org.scalatest.{Matchers, WordSpec}

class HHFilteredCacheTest extends Specification {
class HHFilteredCacheTest extends WordSpec with Matchers {
def checkCache[K, V](pairs: Seq[(K, V)], m: Map[K, V])(implicit cache: MutableCache[K, V]) = {
pairs.foldLeft(cache)(_ += _)
val res = cache.iterator.toMap
cache.clear
res must be_==(m)
res should equal(m)
}

"HHFilteredCache works properly" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

package com.twitter.storehaus.cache

import org.specs2.mutable._
import org.scalatest.{Matchers, WordSpec}

class LRUCacheTest extends Specification {
class LRUCacheTest extends WordSpec with Matchers {
def checkCache[K, V](pairs: Seq[(K, V)], m: Map[K, V])(implicit cache: Cache[K, V]) =
pairs.foldLeft(cache)(_ + _).toMap must be_==(m)
pairs.foldLeft(cache)(_ + _).toMap should equal(m)

"LRUCache works properly with threshold 2" in {
implicit val cache = Cache.lru[String, Int](2)
Expand All @@ -36,7 +36,7 @@ class LRUCacheTest extends Specification {
Seq("a" -> 1, "b" -> 2, "b" -> 3),
Map("a" -> 1, "b" -> 3)
)
((cache + ("a" -> 1) + ("b" -> 2)).hit("a") + ("c" -> 3)).toMap
.must(be_==(Map("a" -> 1, "c" -> 3)))
val result = ((cache + ("a" -> 1) + ("b" -> 2)).hit("a") + ("c" -> 3)).toMap
result should equal(Map("a" -> 1, "c" -> 3))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package com.twitter.storehaus.cache

import org.specs2.mutable._
import org.scalatest.{Matchers, WordSpec}

class MutableLRUCacheTest extends Specification {
class MutableLRUCacheTest extends WordSpec with Matchers {
def freshCache = MutableLRUCache[String, Int](2)

def checkCache(pairs: Seq[(String, Int)], results: Seq[Boolean]) = {
val cache = freshCache
pairs.foreach(cache += _)
pairs.map { case (k, _) => cache.contains(k) } must be_==(results)
pairs.map { case (k, _) => cache.contains(k) } should equal(results)
}

"MutableLRUCache works properly with threshold 2" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@

package com.twitter.storehaus.cache

import org.specs2.mutable._
import org.scalatest.{Matchers, WordSpec}
import com.twitter.util.Duration

class MutableTTLCacheTest extends Specification {
class MutableTTLCacheTest extends WordSpec with Matchers {

"TTLCache exhibits proper TTL-ness" in {
val ttl: Duration = Duration.fromMilliseconds(500)
val cache = MutableCache.ttl[String, Int](ttl, 100)
cache += ("a" -> 1)
cache += ("b" -> 2)
cache.toNonExpiredMap must be_==(Map("a" -> 1, "b" -> 2))
cache.toNonExpiredMap should equal(Map("a" -> 1, "b" -> 2))
Thread.sleep(ttl.inMilliseconds)
cache += ("c" -> 3)
cache.toNonExpiredMap must be_==(Map("c" -> 3))
cache.toNonExpiredMap should equal(Map("c" -> 3))
}

"TTLCache does not return an expired value" in {
val ttl: Duration = Duration.fromMilliseconds(500)
val cache = MutableCache.ttl[String, Int](ttl, 100)
cache += ("a" -> 10)
cache.get("a") must be_==(Some(10))
cache.get("a") should equal(Some(10))
Thread.sleep(ttl.inMilliseconds)
cache.get("a") must be_==(None)
cache.get("a") should equal(None)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@

package com.twitter.storehaus.cache

import org.specs2.mutable._
import org.scalatest.{Matchers, WordSpec}
import com.twitter.util.Duration


class TTLCacheTest extends Specification {
class TTLCacheTest extends WordSpec with Matchers {
val ttlMS = 600
val cache = Cache.ttl[String, Int](Duration.fromMilliseconds(ttlMS))

"TTLCache exhibits proper TTL-ness" in {
val abCache = cache.putClocked("a" -> 1)._2.putClocked("b" -> 2)._2
abCache.toNonExpiredMap must be_==(Map("a" -> 1, "b" -> 2))
abCache.toNonExpiredMap should equal(Map("a" -> 1, "b" -> 2))
Thread.sleep(ttlMS)
(abCache.putClocked("c" -> 3)._2).toNonExpiredMap must be_==(Map("c" -> 3))
(abCache.putClocked("c" -> 3)._2).toNonExpiredMap should equal(Map("c" -> 3))
}

"TTLCache does not return an expired value" in {
val withV = cache.putClocked("a" -> 10)._2
withV.getNonExpired("a") must be_==(Some(10))
withV.getNonExpired("a") should equal(Some(10))
Thread.sleep(ttlMS)
withV.getNonExpired("a") must be_==(None)
withV.getNonExpired("a") should equal(None)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@ import org.elasticsearch.common.settings.ImmutableSettings
import java.util.UUID
import java.io.File
import org.elasticsearch.node.NodeBuilder._
import org.specs2.specification.Scope
import org.json4s.{native, NoTypeHints}


/**
* @author Mansur Ashraf
* @since 1/13/14
*/
trait DefaultElasticContext extends Scope {
trait DefaultElasticContext {

val tempFile = File.createTempFile("elasticsearchtests", "tmp")
val homeDir = new File(tempFile.getParent + "/" + UUID.randomUUID().toString)
Expand Down
Loading

0 comments on commit e814142

Please sign in to comment.