bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [1/2] BIGTOP-1269: Migrating from maven to gradle. Some code refactoring. Adding scala support. Removed hive and mahout code/dependencies.
Date Tue, 27 May 2014 12:40:07 GMT
Repository: bigtop
Updated Branches:
  refs/heads/master 984832ea1 -> 1a851e4ff


http://git-wip-us.apache.org/repos/asf/bigtop/blob/1a851e4f/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestNumericalIdUtils.java
----------------------------------------------------------------------
diff --git a/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestNumericalIdUtils.java
b/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestNumericalIdUtils.java
index c68d471..52b8079 100644
--- a/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestNumericalIdUtils.java
+++ b/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestNumericalIdUtils.java
@@ -15,11 +15,10 @@
  */
 package org.apache.bigtop.bigpetstore.generator;
 
-import junit.framework.Assert;
+import static org.junit.Assert.assertFalse;
 
 import org.apache.bigtop.bigpetstore.generator.TransactionIteratorFactory.STATE;
 import org.apache.bigtop.bigpetstore.util.NumericalIdUtils;
-import org.apache.hadoop.conf.Configuration;
 import org.junit.Test;
 
 public class TestNumericalIdUtils {
@@ -31,6 +30,6 @@ public class TestNumericalIdUtils {
         String strId2= STATE.CO.name()+"_"+ "jay vyas";
         long id2 = NumericalIdUtils.toId(strId2);
         System.out.println(id + " " + id2);
-        Assert.assertFalse(id==id2);
+        assertFalse(id==id2);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/bigtop/blob/1a851e4f/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestPetStoreTransactionGeneratorJob.java
----------------------------------------------------------------------
diff --git a/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestPetStoreTransactionGeneratorJob.java
b/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestPetStoreTransactionGeneratorJob.java
index d1a60b3..d68e36c 100755
--- a/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestPetStoreTransactionGeneratorJob.java
+++ b/bigtop-bigpetstore/src/test/java/org/apache/bigtop/bigpetstore/generator/TestPetStoreTransactionGeneratorJob.java
@@ -15,15 +15,14 @@
  */
 package org.apache.bigtop.bigpetstore.generator;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import java.io.BufferedReader;
 import java.io.DataInputStream;
 import java.io.InputStreamReader;
-import java.lang.management.ManagementFactory;
 import java.util.Date;
 
-import junit.framework.Assert;
-
-import org.apache.bigtop.bigpetstore.generator.BPSGenerator;
 import org.apache.bigtop.bigpetstore.generator.BPSGenerator.props;
 import org.apache.bigtop.bigpetstore.generator.TransactionIteratorFactory.STATE;
 import org.apache.hadoop.conf.Configuration;
@@ -45,7 +44,6 @@ public class TestPetStoreTransactionGeneratorJob {
 
     @Test
     public void test() throws Exception {
-
         System.out.println("memory : " + Runtime.getRuntime().freeMemory()
                 / 1000000);
         if (Runtime.getRuntime().freeMemory() / 1000000 < 75) {
@@ -94,11 +92,11 @@ public class TestPetStoreTransactionGeneratorJob {
         }
 
         // records seen should = 20
-        Assert.assertEquals(records, recordsSeen);
+        assertEquals(records, recordsSeen);
         // Assert that a couple of the states are seen (todo make it
         // comprehensive for all states).
-        Assert.assertTrue(CTseen);
-        Assert.assertTrue(AZseen);
+        assertTrue(CTseen);
+        assertTrue(AZseen);
         log.info("Created " + records + " , file was "
                 + fs.getFileStatus(new Path(output, "part-r-00000")).getLen()
                 + " bytes.");

http://git-wip-us.apache.org/repos/asf/bigtop/blob/1a851e4f/bigtop-bigpetstore/src/test/scala/org/apache/bigtop/bigpetstore/ScalaTestSample.scala
----------------------------------------------------------------------
diff --git a/bigtop-bigpetstore/src/test/scala/org/apache/bigtop/bigpetstore/ScalaTestSample.scala
b/bigtop-bigpetstore/src/test/scala/org/apache/bigtop/bigpetstore/ScalaTestSample.scala
new file mode 100644
index 0000000..aae0b48
--- /dev/null
+++ b/bigtop-bigpetstore/src/test/scala/org/apache/bigtop/bigpetstore/ScalaTestSample.scala
@@ -0,0 +1,18 @@
+package org.apache.bigtop.bigpetstore
+
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.scalatest.junit.JUnitRunner
+import org.scalatest._
+import scala.collection.mutable.Stack
+
+@RunWith(classOf[JUnitRunner])
+class ScalaTestSample extends FlatSpec with Matchers {
+	"This test" should "show an example of what we can do with the scala-test library" in {
+		val stack = new Stack[Int]
+		stack.push(1)
+		stack.push(2)
+		stack.pop() should be(2)
+		stack.pop() should be(1)
+	}
+}


Mime
View raw message