Skip to content

Commit e1e38ad

Browse files
committed
Merge branch 'develop' of github.com:twitter/storehaus into develop
2 parents 84ae9e3 + bcbd9dd commit e1e38ad

File tree

7 files changed

+59
-88
lines changed

7 files changed

+59
-88
lines changed

storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseLongStore.scala

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.twitter.storehaus.hbase
1919
import org.apache.hadoop.hbase.client.HTablePool
2020
import com.twitter.storehaus.Store
2121
import com.twitter.util.{Future, Time}
22-
import com.twitter.bijection.Injection._
2322
import org.apache.hadoop.conf.Configuration
2423

2524
/**

storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStore.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ import org.apache.hadoop.hbase.client._
2020
import org.apache.hadoop.conf.Configuration
2121
import org.apache.hadoop.hbase.{HColumnDescriptor, HTableDescriptor, HBaseConfiguration}
2222
import com.twitter.bijection.hbase.HBaseInjections.string2BytesInj
23-
import com.twitter.bijection.Conversion._
2423
import com.twitter.bijection.Injection
2524
import com.twitter.util.{FuturePool, Future}
26-
import scala.Some
2725
import java.util.concurrent.Executors
2826

2927
/**
@@ -62,7 +60,7 @@ trait HBaseStore {
6260
def validateConfiguration() {
6361
import org.apache.commons.lang.StringUtils.isNotEmpty
6462

65-
require(!quorumNames.isEmpty, "Zookeeper quorums are required")
63+
require(quorumNames.nonEmpty, "Zookeeper quorums are required")
6664
require(isNotEmpty(columnFamily), "column family is required")
6765
require(isNotEmpty(column), "column is required")
6866
}

storehaus-hbase/src/main/scala/com/twitter/storehaus/hbase/HBaseStringStore.scala

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package com.twitter.storehaus.hbase
1919
import org.apache.hadoop.hbase.client._
2020
import com.twitter.storehaus.Store
2121
import com.twitter.util.{Future, Time}
22-
import com.twitter.bijection.Injection._
2322
import org.apache.hadoop.conf.Configuration
2423

2524
/**

storehaus-hbase/src/test/scala/com/twitter/storehaus/hbase/DefaultHBaseCluster.scala

+10-7
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@ import com.twitter.util.Closable
2727
*/
2828
trait DefaultHBaseCluster[C <: Closable] extends CloseableCleanup[C] {
2929
val quorumNames = Seq("localhost:2181")
30-
val table = "summing_bird"
31-
val columnFamily = "sb"
32-
val column = "aggregate"
30+
val table = "table"
31+
val columnFamily = "columnFamily"
32+
val column = "column"
3333
val createTable = true
34-
val testingUtil = new HBaseTestingUtility()
34+
val testingUtil = {
35+
val tu = new HBaseTestingUtility()
36+
tu.startMiniCluster()
37+
tu
38+
}
3539
val conf = testingUtil.getConfiguration
3640
val pool = new HTablePool(conf, 1)
3741

38-
override def cleanup() = {
42+
override def cleanup(): Unit = {
3943
super.cleanup()
40-
/* testingUtil.shutdownMiniZKCluster()
41-
testingUtil.shutdownMiniCluster()*/
44+
testingUtil.shutdownMiniCluster()
4245
}
4346
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2014 Twitter inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.twitter.storehaus.hbase
18+
19+
import com.twitter.storehaus.Store
20+
import com.twitter.storehaus.testing.generator.NonEmpty
21+
import com.twitter.util.Await
22+
import org.scalacheck.{Arbitrary, Gen, Properties}
23+
import org.scalacheck.Prop._
24+
25+
/**
26+
* @author Mansur Ashraf
27+
* @since 9/8/13
28+
*/
29+
object HBaseStoreProperties extends Properties("HBaseStore")
30+
with DefaultHBaseCluster[Store[String, String]] {
31+
32+
def putAndGetTest[K: Arbitrary, V: Arbitrary : Equiv](
33+
store: Store[K, V], pairs: Gen[List[(K, Option[V])]]) =
34+
forAll(pairs) { examples =>
35+
examples.forall {
36+
case (k, v) =>
37+
Await.result(store.put((k, v)))
38+
val found = Await.result(store.get(k))
39+
Equiv[Option[V]].equiv(found, v)
40+
}
41+
}
42+
43+
val closeable =
44+
HBaseStringStore(quorumNames, table, columnFamily, column, createTable, pool, conf, 4)
45+
property("HBaseStore[String, String]") =
46+
putAndGetTest(closeable, NonEmpty.Pairing.alphaStrs())
47+
}

storehaus-hbase/src/test/scala/com/twitter/storehaus/hbase/HBaseStringStoreProperties.scala

-74
This file was deleted.

storehaus-leveldb/src/test/scala/com/twitter/storehaus/leveldb/LevelDBStoreProperties.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ object LevelDBStoreProperties extends Properties("LevelDBStore") {
2121
pairs: Gen[List[(Array[Byte], Option[Array[Byte]])]]) =
2222
forAll(pairs) { examples: List[(Array[Byte], Option[Array[Byte]])] =>
2323
examples.forall {
24-
case (k, v) => {
24+
case (k, v) =>
2525
Await.result(store.put(k, v))
2626
val found = Await.result(store.get(k))
2727
found match {
2828
case Some(a) => util.Arrays.equals(a, v.get)
2929
case None => found == v
3030
}
31-
}
3231
}
3332
}
3433

0 commit comments

Comments
 (0)