tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject tajo git commit: TAJO-1821: Temporary data is not cleared after TestCatalog.
Date Tue, 08 Sep 2015 05:11:48 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 579e9de81 -> 8a27a43ff


TAJO-1821: Temporary data is not cleared after TestCatalog.

Closes #737


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/8a27a43f
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/8a27a43f
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/8a27a43f

Branch: refs/heads/master
Commit: 8a27a43ffe13c3b72d57b66f5fda82d6bb75357c
Parents: 579e9de
Author: Jihoon Son <jihoonson@apache.org>
Authored: Tue Sep 8 14:10:57 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Tue Sep 8 14:10:57 2015 +0900

----------------------------------------------------------------------
 CHANGES                                         |  2 ++
 .../org/apache/tajo/catalog/TestCatalog.java    | 23 ++++++++------------
 .../tajo/catalog/TestLinkedMetadataManager.java | 11 +++++++---
 3 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/8a27a43f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 024be73..f18cda3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -249,6 +249,8 @@ Release 0.11.0 - unreleased
 
   BUG FIXES
 
+    TAJO-1821: Temporary data is not cleared after TestCatalog. (jihoon)
+
     TAJO-1805: In the 'Execute Query' page of web UI, default database 
     should be set as 'default'. (Contributed by Dongkyu Hwangbo, committed 
     by hyunsik)

http://git-wip-us.apache.org/repos/asf/tajo/blob/8a27a43f/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
index 8eb5306..2fb715c 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestCatalog.java
@@ -28,7 +28,6 @@ import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.catalog.proto.CatalogProtos.FunctionType;
 import org.apache.tajo.catalog.proto.CatalogProtos.IndexMethod;
 import org.apache.tajo.catalog.proto.CatalogProtos.PartitionKeyProto;
-import org.apache.tajo.catalog.store.*;
 import org.apache.tajo.common.TajoDataTypes;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
@@ -38,12 +37,12 @@ import org.apache.tajo.exception.UnsupportedCatalogStore;
 import org.apache.tajo.function.Function;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
+import org.apache.tajo.util.Pair;
 import org.apache.tajo.util.TUtil;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.io.File;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -64,18 +63,11 @@ public class TestCatalog {
 	
 	static CatalogServer server;
 	static CatalogService catalog;
+  static String testDir;
 
-  public static TajoConf newTajoConfForCatalogTest() throws IOException, UnsupportedCatalogStore
{
-    return CatalogTestingUtil.configureCatalog(new TajoConf(), setupClusterTestBuildDir().getAbsolutePath());
-  }
-
-  public static File setupClusterTestBuildDir() throws IOException {
-    String randomStr = UUID.randomUUID().toString();
-    String dirStr = CommonTestingUtil.getTestDir(randomStr).toString();
-    File dir = new File(dirStr).getAbsoluteFile();
-    // Have it cleaned up on exit
-    dir.deleteOnExit();
-    return dir;
+  public static Pair<TajoConf, String> newTajoConfForCatalogTest() throws IOException,
UnsupportedCatalogStore {
+    String testDir = CommonTestingUtil.getTestDir().toString();
+    return new Pair<>(CatalogTestingUtil.configureCatalog(new TajoConf(), testDir),
testDir);
   }
 
 	@BeforeClass
@@ -83,9 +75,11 @@ public class TestCatalog {
 
 
     Path defaultTableSpace = CommonTestingUtil.getTestDir();
+    Pair<TajoConf, String> confAndTestDir = newTajoConfForCatalogTest();
+    testDir = confAndTestDir.getSecond();
 
 	  server = new CatalogServer();
-    server.init(newTajoConfForCatalogTest());
+    server.init(confAndTestDir.getFirst());
     server.start();
     catalog = new LocalCatalogWrapper(server);
     if (!catalog.existTablespace(TajoConstants.DEFAULT_TABLESPACE_NAME)) {
@@ -103,6 +97,7 @@ public class TestCatalog {
 	@AfterClass
 	public static void tearDown() throws IOException {
 	  server.stop();
+    CommonTestingUtil.cleanupTestDir(testDir);
 	}
 
   @Test

http://git-wip-us.apache.org/repos/asf/tajo/blob/8a27a43f/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
----------------------------------------------------------------------
diff --git a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
index b23a152..764ac64 100644
--- a/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
+++ b/tajo-catalog/tajo-catalog-server/src/test/java/org/apache/tajo/catalog/TestLinkedMetadataManager.java
@@ -24,13 +24,13 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import org.apache.hadoop.fs.Path;
 import org.apache.tajo.TajoConstants;
-import org.apache.tajo.exception.*;
 import org.apache.tajo.catalog.proto.CatalogProtos;
 import org.apache.tajo.common.TajoDataTypes.Type;
 import org.apache.tajo.conf.TajoConf;
-import org.apache.tajo.error.Errors;
+import org.apache.tajo.exception.*;
 import org.apache.tajo.util.CommonTestingUtil;
 import org.apache.tajo.util.KeyValueSet;
+import org.apache.tajo.util.Pair;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -150,6 +150,7 @@ public class TestLinkedMetadataManager {
 
   static CatalogServer server;
   static CatalogService catalog;
+  static String testDir;
 
   @BeforeClass
   public static void setUp() throws IOException, DuplicateTablespaceException, DuplicateDatabaseException,
@@ -157,9 +158,12 @@ public class TestLinkedMetadataManager {
     TajoConf conf = new TajoConf();
     conf.setVar(TajoConf.ConfVars.CATALOG_ADDRESS, "127.0.0.1:0");
 
+    Pair<TajoConf, String> confAndTestDir = TestCatalog.newTajoConfForCatalogTest();
+    testDir = confAndTestDir.getSecond();
+
     server = new CatalogServer(
         Sets.newHashSet(new MockupMetadataProvider1(), new MockupMetadataProvider2()), Collections.EMPTY_LIST);
-    server.init(TestCatalog.newTajoConfForCatalogTest());
+    server.init(confAndTestDir.getFirst());
     server.start();
     catalog = new LocalCatalogWrapper(server);
 
@@ -176,6 +180,7 @@ public class TestLinkedMetadataManager {
   @AfterClass
   public static void tearDown() throws IOException {
     server.stop();
+    CommonTestingUtil.cleanupTestDir(testDir);
   }
 
   @Test


Mime
View raw message