aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'scalding/src/test')
-rw-r--r--scalding/src/test/scala/sandcrawler/HBaseStatusCodeCountTest.scala6
-rw-r--r--scalding/src/test/scala/sandcrawler/HBaseStatusCountTest.scala15
2 files changed, 7 insertions, 14 deletions
diff --git a/scalding/src/test/scala/sandcrawler/HBaseStatusCodeCountTest.scala b/scalding/src/test/scala/sandcrawler/HBaseStatusCodeCountTest.scala
index 3291670..d2cf9de 100644
--- a/scalding/src/test/scala/sandcrawler/HBaseStatusCodeCountTest.scala
+++ b/scalding/src/test/scala/sandcrawler/HBaseStatusCodeCountTest.scala
@@ -17,7 +17,7 @@ import parallelai.spyglass.hbase.HBaseSource
import scala._
@RunWith(classOf[JUnitRunner])
-class HBaseStatusCountTest extends FunSpec with TupleConversions {
+class HBaseStatusCodeCountTest extends FunSpec with TupleConversions {
val output = "/tmp/testOutput"
val (testTable, testHost) = ("test-table", "dummy-host:2181")
@@ -44,7 +44,7 @@ class HBaseStatusCountTest extends FunSpec with TupleConversions {
val statusType1Count = sampleData.count(lst => lst(1) == statusType1Bytes)
val statusType2Count = sampleData.count(lst => lst(1) == statusType2Bytes)
- JobTest("sandcrawler.HBaseStatusCountJob")
+ JobTest("sandcrawler.HBaseStatusCodeCountJob")
.arg("test", "")
.arg("app.conf.path", "app.conf")
.arg("output", output)
@@ -55,7 +55,7 @@ class HBaseStatusCountTest extends FunSpec with TupleConversions {
sampleData.map(l => new Tuple(l.map(s => {new ImmutableBytesWritable(s)}):_*)))
.sink[Tuple](TypedTsv[(Long, Long)](output)) {
outputBuffer =>
- it("should return a 2-element list.") {
+ it("should return a correct number of elements.") {
assert(outputBuffer.size === 2)
}
diff --git a/scalding/src/test/scala/sandcrawler/HBaseStatusCountTest.scala b/scalding/src/test/scala/sandcrawler/HBaseStatusCountTest.scala
index b53abeb..7e91af3 100644
--- a/scalding/src/test/scala/sandcrawler/HBaseStatusCountTest.scala
+++ b/scalding/src/test/scala/sandcrawler/HBaseStatusCountTest.scala
@@ -17,7 +17,7 @@ import parallelai.spyglass.hbase.HBaseSource
import scala._
@RunWith(classOf[JUnitRunner])
-class HBaseStatusCodeCountTest extends FunSpec with TupleConversions {
+class HBaseStatusCountTest extends FunSpec with TupleConversions {
val output = "/tmp/testOutput"
val (testTable, testHost) = ("test-table", "dummy-host:2181")
@@ -42,27 +42,20 @@ class HBaseStatusCodeCountTest extends FunSpec with TupleConversions {
val statusType1Count = sampleData.count(lst => lst(1) == statusType1Bytes)
val statusType2Count = sampleData.count(lst => lst(1) == statusType2Bytes)
- JobTest("sandcrawler.HBaseStatusCodeCountJob")
+ JobTest("sandcrawler.HBaseStatusCountJob")
.arg("test", "")
.arg("app.conf.path", "app.conf")
.arg("output", output)
.arg("hbase-table", testTable)
.arg("zookeeper-hosts", testHost)
.arg("debug", "true")
- .source[Tuple](HBaseCountJob.getHBaseSource(testTable, testHost, "grobid0:status_code"),
+ .source[Tuple](HBaseCountJob.getHBaseSource(testTable, testHost, "grobid0:status"),
sampleData.map(l => new Tuple(l.map(s => {new ImmutableBytesWritable(s)}):_*)))
- .sink[Tuple](TypedTsv[(Long, Long)](output)) {
+ .sink[Tuple](TypedTsv[(String, Long)](output)) {
outputBuffer =>
it("should return a 2-element list.") {
assert(outputBuffer.size === 2)
}
-
- // Convert List[Tuple] to Map[Long, Long].
- val counts = outputBuffer.map(t => (t.getLong(0), t.getLong(1))).toMap
- it("should have the appropriate number of each status type") {
- assert(counts(statusType1) == statusType1Count)
- assert(counts(statusType2) == statusType2Count)
- }
}
.run
.finish