Skip to content

Commit

Permalink
Fix test.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuai committed Feb 10, 2015
1 parent 4c76d78 commit d91ecb8
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Map;

import org.apache.spark.sql.sources.SaveMode;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -80,6 +81,19 @@ public void setUp() throws IOException {
df.registerTempTable("jsonTable");
}

@After
public void tearDown() throws IOException {
// Clean up tables and data.
sqlContext.sql("DROP TABLE IF EXISTS javaSavedTable");
sqlContext.sql("DROP TABLE IF EXISTS externalTable");
if (path.exists()) {
path.delete();
}
if (hiveManagedPath.exists()) {
hiveManagedPath.delete();
}
}

@Test
public void saveTableAndQueryIt() {
Map<String, String> options = new HashMap<String, String>();
Expand All @@ -88,8 +102,6 @@ public void saveTableAndQueryIt() {
checkAnswer(
sqlContext.sql("SELECT * FROM javaSavedTable"),
df.collectAsList());

sqlContext.sql("DROP TABLE javaSavedTable");
}

@Test
Expand All @@ -109,9 +121,6 @@ public void saveExternalTableAndQueryIt() {
checkAnswer(
sqlContext.sql("SELECT * FROM externalTable"),
df.collectAsList());

sqlContext.sql("DROP TABLE javaSavedTable");
sqlContext.sql("DROP TABLE externalTable");
}

@Test
Expand All @@ -136,8 +145,5 @@ public void saveExternalTableWithSchemaAndQueryIt() {
checkAnswer(
sqlContext.sql("SELECT * FROM externalTable"),
sqlContext.sql("SELECT b FROM javaSavedTable").collectAsList());

sqlContext.sql("DROP TABLE javaSavedTable");
sqlContext.sql("DROP TABLE externalTable");
}
}

0 comments on commit d91ecb8

Please sign in to comment.