diff --git a/pom.xml b/pom.xml index 00fb8b9f951df5ca5dda158268491817d358cae4..fdc5d4e1c1e1979556cd23ae61fc51c3c0a062f5 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> --> - <groups>framework,parser,hw1</groups> + <groups>framework,parser,hw1,hw2</groups> </configuration> </plugin> diff --git a/src/test/java/edu/caltech/test/nanodb/functions/TestSimpleFunctions.java b/src/test/java/edu/caltech/test/nanodb/functions/TestSimpleFunctions.java index 8fd4d06c0d04a195861d2db0be5f71424d596853..c1fb03d0d951eba2b22a3412d319e78e2d099a28 100644 --- a/src/test/java/edu/caltech/test/nanodb/functions/TestSimpleFunctions.java +++ b/src/test/java/edu/caltech/test/nanodb/functions/TestSimpleFunctions.java @@ -10,7 +10,7 @@ import edu.caltech.test.nanodb.sql.SqlTestCase; /** * This class tests various functions to ensure that they work correctly. */ -@Test(groups={"sql"}) +@Test(groups={"sql", "hw2"}) public class TestSimpleFunctions extends SqlTestCase { public void testAbs() throws Exception { diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestAggregation.java b/src/test/java/edu/caltech/test/nanodb/sql/TestAggregation.java index d550318c871ae5c3bda7ce494ceb361071f41e5f..bc827ebf67da87ea8c2a508efd7dcb7e6b09fe03 100755 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestAggregation.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestAggregation.java @@ -13,7 +13,7 @@ import edu.caltech.nanodb.server.CommandResult; * many different tables, to see if aggregate expressions work properly. We are * just testing aggregation without any grouping. **/ -@Test +@Test(groups={"sql", "hw2"}) public class TestAggregation extends SqlTestCase { public TestAggregation() { super("setup_testAggregation"); diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestExists.java b/src/test/java/edu/caltech/test/nanodb/sql/TestExists.java index d2948e7d49b54baafdaba7b7dfbcae12ecca0df5..15a00c45ac8a34927a17a12c294c388dee45ea05 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestExists.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestExists.java @@ -11,7 +11,7 @@ import edu.caltech.nanodb.server.CommandResult; * This class exercises the database with some simple EXISTS operations, to * verify that the most basic functionality works. **/ -@Test +@Test(groups={"sql"}) public class TestExists extends SqlTestCase { public TestExists() { super("setup_testExists"); diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestGroupBy.java b/src/test/java/edu/caltech/test/nanodb/sql/TestGroupBy.java index ab110d35a73a7be18d8d1e9b32834b1368cb7027..bcc77bae30f3df041e848e21221c5af0a6bba792 100755 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestGroupBy.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestGroupBy.java @@ -13,7 +13,7 @@ import edu.caltech.nanodb.server.NanoDBServer; * aggregation occurs, we just check to see if the correct columns are grouped * and generated. **/ -@Test +@Test(groups={"sql", "hw2"}) public class TestGroupBy extends SqlTestCase { public TestGroupBy() { super("setup_testGroupBy"); diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestGroupingAndAggregation.java b/src/test/java/edu/caltech/test/nanodb/sql/TestGroupingAndAggregation.java index 2d2350302f3abbb4b01b2273896b422744339dc9..4401ff8784a029520cbf74db792b2abe538e3702 100755 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestGroupingAndAggregation.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestGroupingAndAggregation.java @@ -4,19 +4,18 @@ import org.testng.annotations.Test; import edu.caltech.nanodb.expressions.TupleLiteral; import edu.caltech.nanodb.server.CommandResult; -import edu.caltech.nanodb.server.NanoDBServer; /** * This class exercises the database with both grouping and aggregation * statements, to see if both kinds of expressions can work properly with each * other. **/ -@Test +@Test(groups={"sql", "hw2"}) public class TestGroupingAndAggregation extends SqlTestCase { public TestGroupingAndAggregation() { super ("setup_testGroupingAndAggregation"); } - + /** * This test checks that at least one value was successfully inserted into * the test table. @@ -26,16 +25,16 @@ public class TestGroupingAndAggregation extends SqlTestCase { public void testTableNotEmpty() throws Throwable { testTableNotEmpty("test_group_aggregate_b"); } - + /** * This tests simple aggregation with simple grouping, to see if the query * produces the expected results. - * + * * @throws Exception if any query parsing or execution issues occur. **/ public void testSimpleGroupingAndAggregation() throws Throwable { CommandResult result; - + result = server.doCommand( "SELECT branch_name, MIN(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected1 = { @@ -58,7 +57,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected1, result); assert checkUnorderedResults(expected1, result); - + result = server.doCommand( "SELECT branch_name, MAX(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected2 = { @@ -81,7 +80,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected2, result); assert checkUnorderedResults(expected2, result); - + result = server.doCommand( "SELECT branch_name, AVG(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected3 = { @@ -104,7 +103,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected3, result); assert checkUnorderedResults(expected3, result); - + result = server.doCommand( "SELECT branch_name, COUNT(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected4 = { @@ -127,7 +126,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected4, result); assert checkUnorderedResults(expected4, result); - + result = server.doCommand( "SELECT branch_name, SUM(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected5 = { @@ -150,7 +149,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected5, result); assert checkUnorderedResults(expected5, result); - + result = server.doCommand( "SELECT branch_name, STDDEV(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected6 = { @@ -173,7 +172,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected6, result); assert checkUnorderedResults(expected6, result); - + result = server.doCommand( "SELECT branch_name, VARIANCE(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected7 = { @@ -197,7 +196,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { assert checkSizeResults(expected7, result); assert checkUnorderedResults(expected7, result); } - + /** * This tests complex aggregation with simple grouping, to see if the query * produces the expected results. @@ -206,7 +205,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { **/ public void testComplexGroupingSimpleAggregation() throws Throwable { CommandResult result; - + result = server.doCommand( "SELECT branch_name, MIN(balance), COUNT(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected1 = { @@ -229,10 +228,10 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected1, result); assert checkUnorderedResults(expected1, result); - + result = server.doCommand( "SELECT branch_name, MIN(balance), COUNT(balance), AVG(balance), STDDEV(balance), VARIANCE(balance) FROM test_group_aggregate_b GROUP BY branch_name", true); - + TupleLiteral[] expected2 = { new TupleLiteral( "Belldale" , 60 , 3 , 25353.333333333332 , 29673.94517455039 , 8.805430222222223E8 ), new TupleLiteral( "Bretton" , 410 , 4 , 44352.5 , 33994.819734041834 , 1.15564776875E9 ), @@ -253,7 +252,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected2, result); assert checkUnorderedResults(expected2, result); - + result = server.doCommand( "SELECT branch_name, MIN(balance), COUNT(number) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected3 = { @@ -276,7 +275,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected3, result); assert checkUnorderedResults(expected3, result); - + result = server.doCommand( "SELECT MAX(balance), AVG(balance), COUNT(number) FROM test_group_aggregate_b GROUP BY branch_name", true); TupleLiteral[] expected4 = { @@ -300,7 +299,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { assert checkSizeResults(expected4, result); assert checkUnorderedResults(expected4, result); } - + /** * This tests simple and complex aggregation with multiple groups, to see if * the query produces the expected results. @@ -309,7 +308,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { **/ public void testAggregationMultipleGroups() throws Throwable { CommandResult result; - + result = server.doCommand( "SELECT branch_name, MIN(balance) FROM test_group_aggregate_b GROUP BY branch_name, number", true); TupleLiteral[] expected1 = { @@ -376,7 +375,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected1, result); assert checkUnorderedResults(expected1, result); - + result = server.doCommand( "SELECT branch_name, MIN(balance), COUNT(number) FROM test_group_aggregate_b GROUP BY branch_name, number", true); TupleLiteral[] expected2 = { @@ -444,16 +443,16 @@ public class TestGroupingAndAggregation extends SqlTestCase { assert checkSizeResults(expected2, result); assert checkUnorderedResults(expected2, result); } - + /** * This tests grouping and aggregation with other kinds of SQL commands, to * see if the query produces the expected results. - * + * * @throws Exception if any query parsing or execution issues occur. **/ public void testWithOtherCommands() throws Throwable { CommandResult result; - + result = server.doCommand( "SELECT branch_name, MAX(balance) FROM (SELECT branch_name, balance FROM test_group_aggregate_b) AS b GROUP BY branch_name", true); TupleLiteral[] expected1 = { @@ -476,7 +475,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected1, result); assert checkUnorderedResults(expected1, result); - + result = server.doCommand( "SELECT branch_name, MAX(balance) FROM test_group_aggregate_b GROUP BY branch_name ORDER BY branch_name", true); TupleLiteral[] expected2 = { @@ -500,8 +499,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { assert checkSizeResults(expected2, result); assert checkUnorderedResults(expected2, result); } - - + + /** * This tests complicated aggregation with aggregate functions along with * arithmetic expressions (i.e. SELECT a + MIN(b)) or SELECT MIN(a + b)) @@ -510,7 +509,7 @@ public class TestGroupingAndAggregation extends SqlTestCase { */ public void testComplicatedGroupingAndAggregation() throws Throwable { CommandResult result; - + result = server.doCommand( "SELECT a + MIN(b) FROM test_complicated_group_aggregation GROUP BY a", true); TupleLiteral[] expected = { @@ -520,8 +519,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected, result); assert checkUnorderedResults(expected, result); - - + + result = server.doCommand( "SELECT c, a + SUM(b) FROM test_complicated_group_aggregation GROUP BY c, a", true); TupleLiteral[] expected2 = { @@ -536,8 +535,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected2, result); assert checkUnorderedResults(expected2, result); - - + + result = server.doCommand( "SELECT c, a + AVG(b) + MIN(e) FROM test_complicated_group_aggregation GROUP BY c, a", true); TupleLiteral[] expected3 = { @@ -552,8 +551,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected3, result); assert checkUnorderedResults(expected3, result); - - + + result = server.doCommand( "SELECT c, MIN(a + b) FROM test_complicated_group_aggregation GROUP BY c", true); TupleLiteral[] expected4 = { @@ -567,8 +566,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected4, result); assert checkUnorderedResults(expected4, result); - - + + result = server.doCommand( "SELECT c, MIN(a + e) + MAX(b) FROM test_complicated_group_aggregation GROUP BY c", true); TupleLiteral[] expected5 = { @@ -582,8 +581,8 @@ public class TestGroupingAndAggregation extends SqlTestCase { }; assert checkSizeResults(expected5, result); assert checkUnorderedResults(expected5, result); - - + + result = server.doCommand( "SELECT c, MIN(a) + AVG(e + b) FROM test_complicated_group_aggregation GROUP BY c", true); TupleLiteral[] expected6 = { diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestHaving.java b/src/test/java/edu/caltech/test/nanodb/sql/TestHaving.java index c92604bd19c2870f656c6a1567c4b4556a12fe83..178a019892cc7335d1de173c0ad4154bdd2ee9b0 100755 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestHaving.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestHaving.java @@ -4,14 +4,14 @@ import org.testng.annotations.Test; import edu.caltech.nanodb.expressions.TupleLiteral; import edu.caltech.nanodb.server.CommandResult; -import edu.caltech.nanodb.server.NanoDBServer; + /** * This class exercises the database with both grouping and aggregation * statements, to see if both kinds of expressions can work properly with each * other. **/ -@Test +@Test(groups={"sql", "hw2"}) public class TestHaving extends SqlTestCase { public TestHaving() { super ("setup_testHaving"); @@ -38,7 +38,6 @@ public class TestHaving extends SqlTestCase { result = server.doCommand( "SELECT a, MIN(b) FROM test_having GROUP BY a HAVING MIN(b) < 2000", true); -System.err.println("HAVING RESULTS = " + result.getTuples()); TupleLiteral[] expected1 = { new TupleLiteral( 7 , 990 ), new TupleLiteral( 11 , 980 ), diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestInPredicates.java b/src/test/java/edu/caltech/test/nanodb/sql/TestInPredicates.java index 447c08fe41754db04a35a6e88e48ac5fc547cee5..0ee670bc5765b1a7507b6d5d1cf824474b192635 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestInPredicates.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestInPredicates.java @@ -11,7 +11,6 @@ import edu.caltech.nanodb.server.NanoDBServer; /** * This class exercises the database with various <tt>IN</tt> predicates. **/ -@Test public class TestInPredicates extends SqlTestCase { public TestInPredicates() { super("setup_testExists"); @@ -23,6 +22,7 @@ public class TestInPredicates extends SqlTestCase { * * @throws Exception if any query parsing or execution issues occur. */ + @Test(groups={"sql", "hw2"}) public void testInPredicatesTablesNotEmpty() throws Throwable { testTableNotEmpty("test_exists_1"); testTableNotEmpty("test_exists_2"); @@ -34,6 +34,7 @@ public class TestInPredicates extends SqlTestCase { * * @throws Exception if any query parsing or execution issues occur. */ + @Test(groups={"sql", "hw2"}) public void testInValues() throws Throwable { CommandResult result; TupleLiteral[] expected1 = { @@ -66,6 +67,7 @@ public class TestInPredicates extends SqlTestCase { * * @throws Exception if any query parsing or execution issues occur. */ + @Test(groups={"sql"}) public void testInSubquery() throws Throwable { CommandResult result; TupleLiteral[] expected1 = { diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestNaturalUsingJoins.java b/src/test/java/edu/caltech/test/nanodb/sql/TestNaturalUsingJoins.java index e3a9c2e69fcf8775f9ce0149c4ba1c4494e3ffba..885883a74c9aa6778cd3d334196c3b2d12d281ee 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestNaturalUsingJoins.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestNaturalUsingJoins.java @@ -13,7 +13,7 @@ import org.testng.annotations.Test; * These tests aren't exhaustive; they serve as a smoke-test to verify the * basic behaviors. */ -@Test +@Test(groups={"sql"}) public class TestNaturalUsingJoins extends SqlTestCase { public TestNaturalUsingJoins() { super("setup_testNaturalUsingJoins"); diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestScalarSubquery.java b/src/test/java/edu/caltech/test/nanodb/sql/TestScalarSubquery.java index 67319dbe42dfafd5c307e1e014274f269feeece3..53708109a5079d9250cd7ae1e062737d105d3f23 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestScalarSubquery.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestScalarSubquery.java @@ -13,7 +13,7 @@ import edu.caltech.nanodb.server.CommandResult; * This class exercises the database with some simple scalar subqueries, to * verify that the most basic functionality works. **/ -@Test +@Test(groups={"sql"}) public class TestScalarSubquery extends SqlTestCase { public TestScalarSubquery() { super("setup_testExists"); diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestSelectProject.java b/src/test/java/edu/caltech/test/nanodb/sql/TestSelectProject.java index 0da213f5c41bf26680c9500556263ef855e2ac8b..f1ece10ac0dc684cc55e1cd8821a241a77227f98 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestSelectProject.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestSelectProject.java @@ -13,7 +13,7 @@ import edu.caltech.nanodb.server.NanoDBServer; * statements against a single table, to see if simple selects and * predicates work properly. */ -@Test(groups={"sql"}) +@Test(groups={"sql", "hw2"}) public class TestSelectProject extends SqlTestCase { public TestSelectProject() { diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestSimpleSelects.java b/src/test/java/edu/caltech/test/nanodb/sql/TestSimpleSelects.java index d7937a2b1e7e96c6e1219c364fe3c21ef7e2d56d..699be95a6024708cec41dd2e5266cd4edacafa36 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestSimpleSelects.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestSimpleSelects.java @@ -13,7 +13,7 @@ import edu.caltech.nanodb.server.NanoDBServer; * statements against a single table, to see if simple selects and * predicates work properly. */ -@Test(groups={"sql"}) +@Test(groups={"sql", "hw2"}) public class TestSimpleSelects extends SqlTestCase { public TestSimpleSelects() { diff --git a/src/test/java/edu/caltech/test/nanodb/sql/TestStringMatch.java b/src/test/java/edu/caltech/test/nanodb/sql/TestStringMatch.java index 5f49e319ddb434650414ec397ebea4327bdd3ed0..2bda1f5f630050b424891d9d0c462de600cd4aee 100644 --- a/src/test/java/edu/caltech/test/nanodb/sql/TestStringMatch.java +++ b/src/test/java/edu/caltech/test/nanodb/sql/TestStringMatch.java @@ -12,7 +12,7 @@ import edu.caltech.nanodb.server.CommandResult; * statements against a single table, to see if simple selects and * predicates work properly. */ -@Test(groups={"sql"}) +@Test(groups={"sql", "hw2"}) public class TestStringMatch extends SqlTestCase { public TestStringMatch() { @@ -166,5 +166,4 @@ public class TestStringMatch extends SqlTestCase { "SELECT * FROM test_string_match WHERE s LIKE '_r%'", true); assert checkUnorderedResults(expected2, result); } - }