kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billy...@apache.org
Subject [5/5] kylin git commit: KYLIN-2293, refactor KylinConfig with KylinTestConfig
Date Sun, 18 Dec 2016 06:14:09 GMT
KYLIN-2293, refactor KylinConfig with KylinTestConfig


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

Branch: refs/heads/KYLIN-2293
Commit: ef76d48002132664fd595c9d39f74ef09181d54f
Parents: e14f4e1
Author: Billy Liu <billyliu@apache.org>
Authored: Sun Dec 18 00:14:39 2016 +0800
Committer: Billy Liu <billyliu@apache.org>
Committed: Sun Dec 18 14:13:21 2016 +0800

----------------------------------------------------------------------
 .../org/apache/kylin/common/KylinConfig.java    |  2 +-
 .../apache/kylin/common/KylinConfigBase.java    | 39 --------
 .../org/apache/kylin/common/KylinConfigExt.java |  2 +-
 .../apache/kylin/common/KylinTestConfig.java    | 95 ++++++++++++++++++++
 .../common/util/AbstractKylinTestCase.java      |  9 +-
 .../common/util/LocalFileMetadataTestCase.java  |  4 +-
 .../kylin/common/util/MailServiceTest.java      |  3 +-
 .../org/apache/kylin/cube/CubeDescTest.java     | 62 ++++++-------
 .../apache/kylin/cube/CubeManagerCacheTest.java |  4 +-
 .../org/apache/kylin/cube/CubeManagerTest.java  | 24 ++---
 .../org/apache/kylin/cube/CubeSegmentsTest.java |  2 +-
 .../kylin/cube/common/RowKeySplitterTest.java   |  4 +-
 .../kylin/cube/cuboid/CuboidSchedulerTest.java  |  2 +-
 .../apache/kylin/cube/cuboid/CuboidTest.java    |  2 +-
 .../apache/kylin/cube/kv/RowKeyDecoderTest.java |  6 +-
 .../apache/kylin/cube/kv/RowKeyEncoderTest.java |  6 +-
 .../kylin/cube/project/ProjectManagerTest.java  | 30 +++----
 .../metadata/measure/TopNMeasureTypeTest.java   |  2 +-
 .../kylin/dict/AppendTrieDictionaryTest.java    | 28 +++---
 .../apache/kylin/job/JoinedFlatTableTest.java   |  2 +-
 .../kylin/metadata/MetadataManagerTest.java     | 22 ++---
 .../badquery/BadQueryHistoryManagerTest.java    |  6 +-
 .../kylin/metadata/model/DataModelDescTest.java |  4 +-
 .../kylin/storage/hybrid/HybridManagerTest.java |  2 +-
 .../kylin/engine/mr/steps/CubeReducerTest.java  |  6 +-
 .../engine/mr/steps/MergeCuboidJobTest.java     |  2 +-
 .../engine/mr/steps/MergeCuboidMapperTest.java  |  8 +-
 .../engine/mr/steps/NDCuboidMapperTest.java     |  2 +-
 .../kylin/cube/ITDictionaryManagerTest.java     |  4 +-
 .../kylin/provision/BuildCubeWithEngine.java    |  5 +-
 .../hive/ITHiveSourceTableLoaderTest.java       |  2 +-
 .../source/hive/ITSnapshotManagerTest.java      |  4 +-
 .../kylin/storage/hbase/ITStorageTest.java      |  2 +-
 .../rest/controller/JobControllerTest.java      |  2 +-
 .../rest/controller/ProjectControllerTest.java  | 16 ++--
 .../cube/MeasureTypeOnlyAggrInBaseTest.java     |  2 +-
 .../hbase/steps/CubeHFileMapper2Test.java       |  6 +-
 .../hbase/steps/RowValueDecoderTest.java        |  4 +-
 38 files changed, 244 insertions(+), 183 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
index acd4398..b2df6c5 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfig.java
@@ -71,7 +71,7 @@ public class KylinConfig extends KylinConfigBase {
 
     //Only used in test cases!!! 
     public static void destroyInstance() {
-        logger.info("Destory KylinConfig");
+        logger.info("Destroy KylinConfig");
         dumpStackTrace();
         ENV_INSTANCE = null;
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index 610c2af..1260ef0 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -240,11 +240,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Integer.parseInt(getOptional("kylin.dictionary.append-version-ttl", "259200000"));
     }
 
-    // for test
-    public void setAppendDictEntrySize(int entrySize) {
-        setProperty("kylin.dictionary.append-entry-size", String.valueOf(entrySize));
-    }
-
     public int getCachedSnapshotMaxEntrySize() {
         return Integer.parseInt(getOptional("kylin.snapshot.max-cache-entry", "500"));
     }
@@ -298,10 +293,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Integer.parseInt(getOptional("kylin.cube.max-building-segments", "10"));
     }
 
-    public void setMaxBuildingSegments(int maxBuildingSegments) {
-        setProperty("kylin.cube.max-building-segments", String.valueOf(maxBuildingSegments));
-    }
-
     // ============================================================================
     // JOB
     // ============================================================================
@@ -322,10 +313,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Boolean.parseBoolean(getOptional("kylin.job.use-remote-cli"));
     }
 
-    public void setRunAsRemoteCommand(String v) {
-        setProperty("kylin.job.use-remote-cli", v);
-    }
-
     public int getRemoteHadoopCliPort() {
         return Integer.parseInt(getOptional("kylin.job.remote-cli-port", "22"));
     }
@@ -334,26 +321,14 @@ abstract public class KylinConfigBase implements Serializable {
         return getOptional("kylin.job.remote-cli-hostname");
     }
 
-    public void setRemoteHadoopCliHostname(String v) {
-        setProperty("kylin.job.remote-cli-hostname", v);
-    }
-
     public String getRemoteHadoopCliUsername() {
         return getOptional("kylin.job.remote-cli-username");
     }
 
-    public void setRemoteHadoopCliUsername(String v) {
-        setProperty("kylin.job.remote-cli-username", v);
-    }
-
     public String getRemoteHadoopCliPassword() {
         return getOptional("kylin.job.remote-cli-password");
     }
 
-    public void setRemoteHadoopCliPassword(String v) {
-        setProperty("kylin.job.remote-cli-password", v);
-    }
-
     public String getCliWorkingDir() {
         return getOptional("kylin.job.remote-cli-working-dir");
     }
@@ -381,10 +356,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Boolean.parseBoolean(getOptional("kylin.job.notification-enabled", "false"));
     }
 
-    public void setMailEnabled(boolean enable) {
-        setProperty("kylin.job.notification-enabled", "" + enable);
-    }
-
     public String getMailHost() {
         return getOptional("kylin.job.notification-mail-host", "");
     }
@@ -518,11 +489,6 @@ abstract public class KylinConfigBase implements Serializable {
         return getOptional("kylin.storage.url");
     }
 
-    // for test only
-    public void setStorageUrl(String storageUrl) {
-        setProperty("kylin.storage.url", storageUrl);
-    }
-
     public String getHBaseClusterFs() {
         return getOptional("kylin.storage.hbase.cluster-fs", "");
     }
@@ -578,11 +544,6 @@ abstract public class KylinConfigBase implements Serializable {
         return Integer.parseInt(getOptional("kylin.storage.hbase.max-region-count", "500"));
     }
 
-    // for test only
-    public void setHBaseHFileSizeGB(float size) {
-        setProperty("kylin.storage.hbase.hfile-size-gb", String.valueOf(size));
-    }
-
     public float getHBaseHFileSizeGB() {
         return Float.parseFloat(getOptional("kylin.storage.hbase.hfile-size-gb", "2.0"));
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/main/java/org/apache/kylin/common/KylinConfigExt.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinConfigExt.java b/core-common/src/main/java/org/apache/kylin/common/KylinConfigExt.java
index 6062d91..7493b17 100644
--- a/core-common/src/main/java/org/apache/kylin/common/KylinConfigExt.java
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinConfigExt.java
@@ -40,7 +40,7 @@ public class KylinConfigExt extends KylinConfig {
 
     private KylinConfigExt(KylinConfig base, Map<String, String> overrides) {
         super(base.getAllProperties(), true);
-        if (base.getClass() != KylinConfig.class) {
+        if (base.getClass() != KylinConfig.class && base.getClass().getSuperclass() != KylinConfig.class) {
             throw new IllegalArgumentException();
         }
         this.base = base;

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/main/java/org/apache/kylin/common/KylinTestConfig.java
----------------------------------------------------------------------
diff --git a/core-common/src/main/java/org/apache/kylin/common/KylinTestConfig.java b/core-common/src/main/java/org/apache/kylin/common/KylinTestConfig.java
new file mode 100644
index 0000000..4253835
--- /dev/null
+++ b/core-common/src/main/java/org/apache/kylin/common/KylinTestConfig.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.kylin.common;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KylinTestConfig extends KylinConfig {
+
+    private static final Logger logger = LoggerFactory.getLogger(KylinTestConfig.class);
+
+    // static cached instances
+    private static KylinTestConfig ENV_INSTANCE = null;
+
+    private KylinTestConfig(KylinConfig kylinConfig) {
+        super(kylinConfig.getAllProperties(), true);
+    }
+
+    public static KylinTestConfig getInstanceFromEnv() {
+        synchronized (KylinTestConfig.class) {
+            if (ENV_INSTANCE == null) {
+                try {
+                    KylinConfig kylinConfig= KylinConfig.getInstanceFromEnv();
+                    KylinTestConfig testConfig = new KylinTestConfig(kylinConfig);
+
+                    logger.info("Initialized a new KylinTestConfig from getInstanceFromEnv : " + System.identityHashCode(testConfig));
+                    ENV_INSTANCE = testConfig;
+                } catch (IllegalArgumentException e) {
+                    throw new IllegalStateException("Failed to find KylinTestConfig ", e);
+                }
+            }
+            return ENV_INSTANCE;
+        }
+    }
+
+    //Only used in test cases!!!
+    public static void destroyInstance() {
+        logger.info("Destory KylinTestConfig");
+        ENV_INSTANCE = null;
+        KylinConfig.destroyInstance();
+    }
+
+    public void setAppendDictEntrySize(int entrySize) {
+        setProperty("kylin.dictionary.append-entry-size", String.valueOf(entrySize));
+    }
+
+    public void setHBaseHFileSizeGB(float size) {
+        setProperty("kylin.storage.hbase.hfile-size-gb", String.valueOf(size));
+    }
+
+    public void setMaxBuildingSegments(int maxBuildingSegments) {
+        setProperty("kylin.cube.max-building-segments", String.valueOf(maxBuildingSegments));
+    }
+
+    public void setRunAsRemoteCommand(String v) {
+        setProperty("kylin.job.use-remote-cli", v);
+    }
+
+    public void setRemoteHadoopCliHostname(String v) {
+        setProperty("kylin.job.remote-cli-hostname", v);
+    }
+
+    public void setRemoteHadoopCliUsername(String v) {
+        setProperty("kylin.job.remote-cli-username", v);
+    }
+
+    public void setRemoteHadoopCliPassword(String v) {
+        setProperty("kylin.job.remote-cli-password", v);
+    }
+
+    public void setMailEnabled(boolean enable) {
+        setProperty("kylin.job.notification-enabled", "" + enable);
+    }
+
+    public void setStorageUrl(String storageUrl) {
+        setProperty("kylin.storage.url", storageUrl);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/test/java/org/apache/kylin/common/util/AbstractKylinTestCase.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/AbstractKylinTestCase.java b/core-common/src/test/java/org/apache/kylin/common/util/AbstractKylinTestCase.java
index 2154c32..579a7a1 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/AbstractKylinTestCase.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/AbstractKylinTestCase.java
@@ -21,6 +21,7 @@ package org.apache.kylin.common.util;
 import java.lang.reflect.Method;
 
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.KylinTestConfig;
 
 /**
  * @author ysong1
@@ -43,14 +44,18 @@ public abstract class AbstractKylinTestCase {
 
     public abstract void cleanupTestMetadata() throws Exception;
 
-    public static KylinConfig getTestConfig() {
+    public static KylinConfig getKylinConfig() {
         return KylinConfig.getInstanceFromEnv();
     }
 
+    public static KylinTestConfig getKylinTestConfig() {
+        return KylinTestConfig.getInstanceFromEnv();
+    }
+
     public static void staticCleanupTestMetadata() {
         cleanupCache();
         System.clearProperty(KylinConfig.KYLIN_CONF);
-        KylinConfig.destroyInstance();
+        KylinTestConfig.destroyInstance();
     }
 
     private static void cleanupCache() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java b/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java
index 26e1e86..540043d 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/LocalFileMetadataTestCase.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.KylinTestConfig;
 import org.apache.kylin.common.persistence.ResourceStore;
 
 public class LocalFileMetadataTestCase extends AbstractKylinTestCase {
@@ -44,7 +45,7 @@ public class LocalFileMetadataTestCase extends AbstractKylinTestCase {
     }
 
     public static void staticCreateTestMetadata(String testDataFolder) {
-        KylinConfig.destroyInstance();
+        KylinTestConfig.destroyInstance();
 
         String tempTestMetadataUrl = LOCALMETA_TEMP_DATA;
         try {
@@ -58,6 +59,7 @@ public class LocalFileMetadataTestCase extends AbstractKylinTestCase {
             System.setProperty(KylinConfig.KYLIN_CONF, tempTestMetadataUrl);
 
         KylinConfig.getInstanceFromEnv().setMetadataUrl(tempTestMetadataUrl);
+        KylinTestConfig.getInstanceFromEnv().setMetadataUrl(tempTestMetadataUrl);
     }
 
     public static void cleanAfterClass() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-common/src/test/java/org/apache/kylin/common/util/MailServiceTest.java
----------------------------------------------------------------------
diff --git a/core-common/src/test/java/org/apache/kylin/common/util/MailServiceTest.java b/core-common/src/test/java/org/apache/kylin/common/util/MailServiceTest.java
index f0d5e4f..1c02289 100644
--- a/core-common/src/test/java/org/apache/kylin/common/util/MailServiceTest.java
+++ b/core-common/src/test/java/org/apache/kylin/common/util/MailServiceTest.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.KylinTestConfig;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -45,7 +46,7 @@ public class MailServiceTest extends LocalFileMetadataTestCase {
     @Test
     public void testSendEmail() throws IOException {
 
-        KylinConfig config = KylinConfig.getInstanceFromEnv();
+        KylinTestConfig config = KylinTestConfig.getInstanceFromEnv();
 
         MailService mailservice = new MailService(config);
         boolean sent = sendTestEmail(mailservice);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java b/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java
index 1daa748..d16daa7 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/CubeDescTest.java
@@ -65,7 +65,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
     public void setUp() throws Exception {
         this.createTestMetadata();
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         AggregationGroup g = cubeDesc.getAggregationGroups().get(0);
         SELLER_ID = getColInAggrGroup(g, "SELLER_ID");
         SLR_SEGMENT_CD = getColInAggrGroup(g, "SLR_SEGMENT_CD");
@@ -92,8 +92,8 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testGoodInit() throws Exception {
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
-        cubeDesc.init(getTestConfig());
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -101,11 +101,11 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 includes field not set");
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         String[] temp = null;
         cubeDesc.getAggregationGroups().get(0).setIncludes(temp);
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -113,22 +113,22 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 select rule field not set");
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         SelectRule temp = null;
         cubeDesc.getAggregationGroups().get(0).setSelectRule(temp);
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
     public void testBadInit3() throws Exception {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 'includes' dimensions not include all the dimensions:");
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         String[] temp = Arrays.asList(cubeDesc.getAggregationGroups().get(0).getIncludes()).subList(0, 3).toArray(new String[3]);
         cubeDesc.getAggregationGroups().get(0).setIncludes(temp);
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -136,7 +136,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 has too many combinations, use 'mandatory'/'hierarchy'/'joint' to optimize; or update 'kylin.cube.aggrgroup.max-combination' to a bigger value.");
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         try {
             System.setProperty("kylin.cube.aggrgroup.max-combination", "8");
             cubeDesc.validateAggregationGroups();
@@ -147,18 +147,18 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testBadInit5() throws Exception {
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().mandatory_dims = new String[] { SELLER_ID, META_CATEG_NAME };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
     public void testBadInit6() throws Exception {
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().mandatory_dims = new String[] { SELLER_ID, LSTG_FORMAT_NAME };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -166,10 +166,10 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 require at least 2 dimensions in a joint");
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { new String[] { LSTG_FORMAT_NAME } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -178,10 +178,10 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs));
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { new String[] { META_CATEG_NAME, CATEG_LVL2_NAME } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -189,11 +189,11 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         String[] strs = new String[] { LSTG_FORMAT_NAME, META_CATEG_NAME };
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 hierarchy dimensions overlap with joint dimensions: " + sortStrs(strs));
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchy_dims = new String[][] { new String[] { META_CATEG_NAME, CATEG_LVL2_NAME, CATEG_LVL3_NAME }, new String[] { LSTG_FORMAT_NAME, LSTG_SITE_ID } };
         cubeDesc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { new String[] { META_CATEG_NAME, LSTG_FORMAT_NAME } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -202,10 +202,10 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 a dimension exist in more than one joint: " + sortStrs(strs));
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().joint_dims = new String[][] { new String[] { LSTG_FORMAT_NAME, LSTG_SITE_ID, SLR_SEGMENT_CD }, new String[] { LSTG_FORMAT_NAME, LSTG_SITE_ID, LEAF_CATEG_ID } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -213,10 +213,10 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 require at least 2 dimensions in a hierarchy.");
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchy_dims = new String[][] { new String[] { META_CATEG_NAME } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -225,10 +225,10 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
         thrown.expect(IllegalStateException.class);
         thrown.expectMessage("Aggregation group 0 a dimension exist in more than one hierarchy: " + sortStrs(strs));
 
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         cubeDesc.getAggregationGroups().get(0).getSelectRule().hierarchy_dims = new String[][] { new String[] { META_CATEG_NAME, CATEG_LVL2_NAME, CATEG_LVL3_NAME }, new String[] { META_CATEG_NAME, CATEG_LVL2_NAME } };
 
-        cubeDesc.init(getTestConfig());
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
@@ -242,13 +242,13 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
 
         thrown.expect(IllegalStateException.class);
         CubeDescManager.clearCache();
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("ut_cube_desc_combination_int_overflow");
-        cubeDesc.init(getTestConfig());
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc("ut_cube_desc_combination_int_overflow");
+        cubeDesc.init(getKylinConfig());
     }
 
     @Test
     public void testSerialize() throws Exception {
-        CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc desc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         String str = JsonUtil.writeValueAsIndentString(desc);
         System.out.println(str);
         @SuppressWarnings("unused")
@@ -257,7 +257,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testGetCopyOf() throws Exception {
-        CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc desc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         CubeDesc copyDesc = CubeDesc.getCopyOf(desc);
 
         // uuid is different, set to equals for json comparison
@@ -272,7 +272,7 @@ public class CubeDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testGetCubeDesc() throws Exception {
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc(CUBE_WITH_SLR_DESC);
         Assert.assertNotNull(cubeDesc);
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerCacheTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerCacheTest.java b/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerCacheTest.java
index de3048f..24cf777 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerCacheTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerCacheTest.java
@@ -44,7 +44,7 @@ public class CubeManagerCacheTest extends LocalFileMetadataTestCase {
         MetadataManager.clearCache();
         CubeManager.clearCache();
         ProjectManager.clearCache();
-        cubeManager = CubeManager.getInstance(getTestConfig());
+        cubeManager = CubeManager.getInstance(getKylinConfig());
     }
 
     @After
@@ -73,6 +73,6 @@ public class CubeManagerCacheTest extends LocalFileMetadataTestCase {
     }
 
     public CubeDescManager getCubeDescManager() {
-        return CubeDescManager.getInstance(getTestConfig());
+        return CubeDescManager.getInstance(getKylinConfig());
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java b/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
index 0266067..514ada2 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/CubeManagerTest.java
@@ -59,7 +59,7 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
     @Test
     public void testBasics() throws Exception {
 
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_without_slr_ready");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_without_slr_ready");
         CubeDesc desc = cube.getDescriptor();
         System.out.println(JsonUtil.writeValueAsIndentString(desc));
 
@@ -71,7 +71,7 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
     @Test
     public void testCreateAndDrop() throws Exception {
 
-        KylinConfig config = getTestConfig();
+        KylinConfig config = getKylinConfig();
         CubeManager cubeMgr = CubeManager.getInstance(config);
         ProjectManager prjMgr = ProjectManager.getInstance(config);
         ResourceStore store = getStore();
@@ -86,17 +86,17 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
         assertTrue(prjMgr.listAllRealizations(ProjectInstance.DEFAULT_PROJECT_NAME).contains(createdCube));
 
-        CubeInstance droppedCube = CubeManager.getInstance(getTestConfig()).dropCube("a_whole_new_cube", false);
+        CubeInstance droppedCube = CubeManager.getInstance(getKylinConfig()).dropCube("a_whole_new_cube", false);
         assertTrue(createdCube == droppedCube);
 
         assertTrue(!prjMgr.listAllRealizations(ProjectInstance.DEFAULT_PROJECT_NAME).contains(droppedCube));
 
-        assertNull(CubeManager.getInstance(getTestConfig()).getCube("a_whole_new_cube"));
+        assertNull(CubeManager.getInstance(getKylinConfig()).getCube("a_whole_new_cube"));
     }
 
     @Test
     public void testAutoMergeNormal() throws Exception {
-        CubeManager mgr = CubeManager.getInstance(getTestConfig());
+        CubeManager mgr = CubeManager.getInstance(getKylinConfig());
         CubeInstance cube = mgr.getCube("test_kylin_cube_with_slr_empty");
 
         cube.getDescriptor().setAutoMergeTimeRanges(new long[] { 2000, 6000 });
@@ -129,9 +129,9 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testConcurrentBuildAndMerge() throws Exception {
-        CubeManager mgr = CubeManager.getInstance(getTestConfig());
+        CubeManager mgr = CubeManager.getInstance(getKylinConfig());
         CubeInstance cube = mgr.getCube("test_kylin_cube_with_slr_empty");
-        getTestConfig().setMaxBuildingSegments(10);
+        getKylinTestConfig().setMaxBuildingSegments(10);
         // no segment at first
         assertEquals(0, cube.getSegments().size());
 
@@ -186,8 +186,8 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testConcurrentMergeAndMerge() throws Exception {
-        CubeManager mgr = CubeManager.getInstance(getTestConfig());
-        getTestConfig().setMaxBuildingSegments(10);
+        CubeManager mgr = CubeManager.getInstance(getKylinConfig());
+        getKylinTestConfig().setMaxBuildingSegments(10);
         CubeInstance cube = mgr.getCube("test_kylin_cube_with_slr_empty");
 
         // no segment at first
@@ -245,7 +245,7 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testGetAllCubes() throws Exception {
-        final ResourceStore store = ResourceStore.getStore(getTestConfig());
+        final ResourceStore store = ResourceStore.getStore(getKylinConfig());
         final NavigableSet<String> cubePath = store.listResources(ResourceStore.CUBE_RESOURCE_ROOT);
         assertTrue(cubePath.size() > 1);
 
@@ -255,7 +255,7 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testAutoMergeWithGap() throws Exception {
-        CubeManager mgr = CubeManager.getInstance(getTestConfig());
+        CubeManager mgr = CubeManager.getInstance(getKylinConfig());
         CubeInstance cube = mgr.getCube("test_kylin_cube_with_slr_empty");
 
         cube.getDescriptor().setAutoMergeTimeRanges(new long[] { 2000, 6000 });
@@ -305,6 +305,6 @@ public class CubeManagerTest extends LocalFileMetadataTestCase {
     }
 
     public CubeDescManager getCubeDescManager() {
-        return CubeDescManager.getInstance(getTestConfig());
+        return CubeDescManager.getInstance(getKylinConfig());
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/CubeSegmentsTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/CubeSegmentsTest.java b/core-cube/src/test/java/org/apache/kylin/cube/CubeSegmentsTest.java
index de91dd2..efd80e8 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/CubeSegmentsTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/CubeSegmentsTest.java
@@ -188,6 +188,6 @@ public class CubeSegmentsTest extends LocalFileMetadataTestCase {
     }
 
     private CubeManager mgr() {
-        return CubeManager.getInstance(getTestConfig());
+        return CubeManager.getInstance(getKylinConfig());
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/common/RowKeySplitterTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/common/RowKeySplitterTest.java b/core-cube/src/test/java/org/apache/kylin/cube/common/RowKeySplitterTest.java
index b41f23b..d5054ea 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/common/RowKeySplitterTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/common/RowKeySplitterTest.java
@@ -44,7 +44,7 @@ public class RowKeySplitterTest extends LocalFileMetadataTestCase {
     @Test
     public void testWithSlr() throws Exception {
         //has shard
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
 
         RowKeySplitter rowKeySplitter = new RowKeySplitter(cube.getFirstSegment(), 11, 20);
         // base cuboid rowkey
@@ -57,7 +57,7 @@ public class RowKeySplitterTest extends LocalFileMetadataTestCase {
     @Test
     public void testWithoutSlr() throws Exception {
         //no shard
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
 
         RowKeySplitter rowKeySplitter = new RowKeySplitter(cube.getFirstSegment(), 11, 20);
         // base cuboid rowkey

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
index 7db616e..9fbbdc0 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidSchedulerTest.java
@@ -305,7 +305,7 @@ public class CuboidSchedulerTest extends LocalFileMetadataTestCase {
     }
 
     public CubeDescManager getCubeDescManager() {
-        return CubeDescManager.getInstance(getTestConfig());
+        return CubeDescManager.getInstance(getKylinConfig());
     }
 
     private void printCount(int[] counts) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidTest.java b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidTest.java
index 2e64791..81eb9e6 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/cuboid/CuboidTest.java
@@ -38,7 +38,7 @@ public class CuboidTest extends LocalFileMetadataTestCase {
     }
 
     public CubeDescManager getCubeDescManager() {
-        return CubeDescManager.getInstance(getTestConfig());
+        return CubeDescManager.getInstance(getKylinConfig());
     }
 
     private CubeDesc getTestKylinCubeWithoutSeller() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyDecoderTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyDecoderTest.java b/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyDecoderTest.java
index 1d1d147..2370b2e 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyDecoderTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyDecoderTest.java
@@ -50,7 +50,7 @@ public class RowKeyDecoderTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testDecodeWithoutSlr() throws Exception {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
 
         RowKeyDecoder rowKeyDecoder = new RowKeyDecoder(cube.getFirstSegment());
 
@@ -64,7 +64,7 @@ public class RowKeyDecoderTest extends LocalFileMetadataTestCase {
     @Ignore
     @Test
     public void testDecodeWithSlr() throws Exception {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
 
         RowKeyDecoder rowKeyDecoder = new RowKeyDecoder(cube.getFirstSegment());
 
@@ -77,7 +77,7 @@ public class RowKeyDecoderTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testEncodeAndDecodeWithUtf8() throws IOException {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
         CubeDesc cubeDesc = cube.getDescriptor();
 
         String[] data = new String[8];

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyEncoderTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyEncoderTest.java b/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyEncoderTest.java
index 75e2458..644be21 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyEncoderTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/kv/RowKeyEncoderTest.java
@@ -50,7 +50,7 @@ public class RowKeyEncoderTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testEncodeWithoutSlr() throws Exception {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_READY");
         // CubeSegment seg = cube.getTheOnlySegment();
         CubeDesc cubeDesc = cube.getDescriptor();
         // String data =
@@ -80,7 +80,7 @@ public class RowKeyEncoderTest extends LocalFileMetadataTestCase {
     @Ignore
     @Test
     public void testEncodeWithSlr() throws Exception {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
         // CubeSegment seg = cube.getTheOnlySegment();
         CubeDesc cubeDesc = cube.getDescriptor();
         // String data =
@@ -116,7 +116,7 @@ public class RowKeyEncoderTest extends LocalFileMetadataTestCase {
     @Ignore
     @Test
     public void testEncodeWithSlr2() throws Exception {
-        CubeInstance cube = CubeManager.getInstance(getTestConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
+        CubeInstance cube = CubeManager.getInstance(getKylinConfig()).getCube("TEST_KYLIN_CUBE_WITH_SLR_READY");
         // CubeSegment seg = cube.getTheOnlySegment();
         CubeDesc cubeDesc = cube.getDescriptor();
         // String data =

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/cube/project/ProjectManagerTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/cube/project/ProjectManagerTest.java b/core-cube/src/test/java/org/apache/kylin/cube/project/ProjectManagerTest.java
index 9728e52..19ef740 100644
--- a/core-cube/src/test/java/org/apache/kylin/cube/project/ProjectManagerTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/cube/project/ProjectManagerTest.java
@@ -56,19 +56,19 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
 
     @Test(expected = IllegalStateException.class)
     public void testDropNonemptyProject() throws IOException {
-        ProjectManager.getInstance(getTestConfig()).dropProject("DEFAULT");
+        ProjectManager.getInstance(getKylinConfig()).dropProject("DEFAULT");
     }
 
     @Test(expected = IllegalStateException.class)
     public void testDropNonexistProject() throws IOException {
-        ProjectManager.getInstance(getTestConfig()).dropProject("DEFAULT???");
+        ProjectManager.getInstance(getKylinConfig()).dropProject("DEFAULT???");
     }
 
     @Test
     public void testNewProject() throws Exception {
-        ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig());
-        CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
-        CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getTestConfig());
+        ProjectManager prjMgr = ProjectManager.getInstance(getKylinConfig());
+        CubeManager cubeMgr = CubeManager.getInstance(getKylinConfig());
+        CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getKylinConfig());
 
         int originalProjectCount = prjMgr.listAllProjects().size();
         int originalCubeCount = cubeMgr.listAllCubes().size();
@@ -81,7 +81,7 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
         CubeDesc desc = cubeDescMgr.getCubeDesc("test_kylin_cube_with_slr_desc");
         CubeInstance createdCube = cubeMgr.createCube("cube_in_alien_project", "alien", desc, null);
         assertTrue(createdCube == cubeMgr.getCube("cube_in_alien_project"));
-        ProjectManager proMgr = ProjectManager.getInstance(getTestConfig());
+        ProjectManager proMgr = ProjectManager.getInstance(getKylinConfig());
         Set<IRealization> realizations = proMgr.listAllRealizations("alien");
         assertTrue(realizations.contains(createdCube));
 
@@ -94,12 +94,12 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
         prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "default", null);
         assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 0);
         assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault + 1);
-        assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("default").contains(createdCube));
+        assertTrue(ProjectManager.getInstance(getKylinConfig()).listAllRealizations("default").contains(createdCube));
 
         prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "alien", null);
         assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 1);
         assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault);
-        assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("alien").contains(createdCube));
+        assertTrue(ProjectManager.getInstance(getKylinConfig()).listAllRealizations("alien").contains(createdCube));
 
         CubeInstance droppedCube = cubeMgr.dropCube("cube_in_alien_project", true);
 
@@ -114,9 +114,9 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testExistingProject() throws Exception {
-        ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig());
-        CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
-        CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getTestConfig());
+        ProjectManager prjMgr = ProjectManager.getInstance(getKylinConfig());
+        CubeManager cubeMgr = CubeManager.getInstance(getKylinConfig());
+        CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getKylinConfig());
 
         int originalProjectCount = prjMgr.listAllProjects().size();
         int originalCubeCount = cubeMgr.listAllCubes().size();
@@ -144,8 +144,8 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testProjectsDrop() throws IOException {
-        ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig());
-        CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
+        ProjectManager prjMgr = ProjectManager.getInstance(getKylinConfig());
+        CubeManager cubeMgr = CubeManager.getInstance(getKylinConfig());
 
         CubeInstance cube = cubeMgr.getCube("test_kylin_cube_with_slr_empty");
         assertTrue(prjMgr.getRealizationsByTable("default", "default.test_kylin_fact").contains(cube));
@@ -159,8 +159,8 @@ public class ProjectManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testProjectsLoadAfterProjectChange() throws IOException {
-        ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig());
-        CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
+        ProjectManager prjMgr = ProjectManager.getInstance(getKylinConfig());
+        CubeManager cubeMgr = CubeManager.getInstance(getKylinConfig());
 
         CubeInstance cube = cubeMgr.getCube("test_kylin_cube_with_slr_empty");
         assertTrue(prjMgr.getRealizationsByTable("default", "default.test_kylin_fact").contains(cube));

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-cube/src/test/java/org/apache/kylin/metadata/measure/TopNMeasureTypeTest.java
----------------------------------------------------------------------
diff --git a/core-cube/src/test/java/org/apache/kylin/metadata/measure/TopNMeasureTypeTest.java b/core-cube/src/test/java/org/apache/kylin/metadata/measure/TopNMeasureTypeTest.java
index 593eb6e..4811fe8 100644
--- a/core-cube/src/test/java/org/apache/kylin/metadata/measure/TopNMeasureTypeTest.java
+++ b/core-cube/src/test/java/org/apache/kylin/metadata/measure/TopNMeasureTypeTest.java
@@ -51,7 +51,7 @@ public class TopNMeasureTypeTest extends LocalFileMetadataTestCase {
     @Test
     public void test() {
 
-        CubeDesc desc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("test_kylin_cube_without_slr_left_join_desc");
+        CubeDesc desc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc("test_kylin_cube_without_slr_left_join_desc");
 
         MeasureDesc topSellerMeasure = null;
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-dictionary/src/test/java/org/apache/kylin/dict/AppendTrieDictionaryTest.java
----------------------------------------------------------------------
diff --git a/core-dictionary/src/test/java/org/apache/kylin/dict/AppendTrieDictionaryTest.java b/core-dictionary/src/test/java/org/apache/kylin/dict/AppendTrieDictionaryTest.java
index 0776599..cbad044 100644
--- a/core-dictionary/src/test/java/org/apache/kylin/dict/AppendTrieDictionaryTest.java
+++ b/core-dictionary/src/test/java/org/apache/kylin/dict/AppendTrieDictionaryTest.java
@@ -43,36 +43,32 @@ import java.util.concurrent.TimeUnit;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.kylin.common.KylinConfig;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.apache.kylin.common.KylinTestConfig;
+import org.apache.kylin.common.util.LocalFileMetadataTestCase;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * Created by sunyerui on 16/4/28.
  */
-public class AppendTrieDictionaryTest {
+public class AppendTrieDictionaryTest extends LocalFileMetadataTestCase {
 
     public static final String BASE_DIR = "/tmp/kylin_append_dict";
     public static final String RESOURCE_DIR = "/dict/append_dict_test";
 
-    @BeforeClass
-    public static void setUp() {
-        KylinConfig.destroyInstance();
-        System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/localmeta");
-        KylinConfig config = KylinConfig.getInstanceFromEnv();
+    @Before
+    public void setUp() throws Exception {
+        this.createTestMetadata();
+        KylinTestConfig config =  getKylinTestConfig();
         config.setAppendDictEntrySize(50000);
         config.setProperty("kylin.env.hdfs-working-dir", BASE_DIR);
     }
 
-    @AfterClass
-    public static void tearDown() {
-        cleanup();
-    }
-
-//    @After
-    public void afterTest() {
+    @After
+    public void after() throws Exception {
+        this.cleanupTestMetadata();
         cleanup();
     }
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-job/src/test/java/org/apache/kylin/job/JoinedFlatTableTest.java
----------------------------------------------------------------------
diff --git a/core-job/src/test/java/org/apache/kylin/job/JoinedFlatTableTest.java b/core-job/src/test/java/org/apache/kylin/job/JoinedFlatTableTest.java
index 0faf22a..e487229 100644
--- a/core-job/src/test/java/org/apache/kylin/job/JoinedFlatTableTest.java
+++ b/core-job/src/test/java/org/apache/kylin/job/JoinedFlatTableTest.java
@@ -50,7 +50,7 @@ public class JoinedFlatTableTest extends LocalFileMetadataTestCase {
     @Before
     public void setUp() throws Exception {
         this.createTestMetadata();
-        cube = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready");
+        cube = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_with_slr_ready");
         cubeSegment = cube.getSegments().get(0);
         flatTableDesc = EngineFactory.getJoinedFlatTableDesc(cubeSegment);
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-metadata/src/test/java/org/apache/kylin/metadata/MetadataManagerTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/metadata/MetadataManagerTest.java b/core-metadata/src/test/java/org/apache/kylin/metadata/MetadataManagerTest.java
index 204b4e0..79caaeb 100644
--- a/core-metadata/src/test/java/org/apache/kylin/metadata/MetadataManagerTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/metadata/MetadataManagerTest.java
@@ -49,34 +49,34 @@ public class MetadataManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testListAllTables() throws Exception {
-        List<TableDesc> tables = getInstance(getTestConfig()).listAllTables();
+        List<TableDesc> tables = getInstance(getKylinConfig()).listAllTables();
         Assert.assertNotNull(tables);
         Assert.assertTrue(tables.size() > 0);
     }
 
     @Test
     public void testFindTableByName() throws Exception {
-        TableDesc table = getInstance(getTestConfig()).getTableDesc("EDW.TEST_CAL_DT");
+        TableDesc table = getInstance(getKylinConfig()).getTableDesc("EDW.TEST_CAL_DT");
         Assert.assertNotNull(table);
         Assert.assertEquals("EDW.TEST_CAL_DT", table.getIdentity());
     }
 
     @Test
     public void testGetInstance() throws Exception {
-        Assert.assertNotNull(getInstance(getTestConfig()));
-        Assert.assertNotNull(getInstance(getTestConfig()).listAllTables());
-        Assert.assertTrue(getInstance(getTestConfig()).listAllTables().size() > 0);
+        Assert.assertNotNull(getInstance(getKylinConfig()));
+        Assert.assertNotNull(getInstance(getKylinConfig()).listAllTables());
+        Assert.assertTrue(getInstance(getKylinConfig()).listAllTables().size() > 0);
     }
 
     @Test
     public void testDataModel() throws Exception {
-        DataModelDesc modelDesc = getInstance(getTestConfig()).getDataModelDesc("test_kylin_left_join_model_desc");
+        DataModelDesc modelDesc = getInstance(getKylinConfig()).getDataModelDesc("test_kylin_left_join_model_desc");
         Assert.assertTrue(modelDesc.getDimensions().size() > 0);
     }
 
     @Test
     public void testSnowflakeDataModel() throws Exception {
-        DataModelDesc model = getInstance(getTestConfig()).getDataModelDesc("test_kylin_snowflake_sales_model");
+        DataModelDesc model = getInstance(getKylinConfig()).getDataModelDesc("test_kylin_snowflake_sales_model");
         Assert.assertTrue(model.getDimensions().size() > 0);
 
         try {
@@ -94,7 +94,7 @@ public class MetadataManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testTableSample() throws IOException {
-        TableExtDesc tableExtDesc = getInstance(getTestConfig()).getTableExt("TEST.TEST_TABLE");
+        TableExtDesc tableExtDesc = getInstance(getKylinConfig()).getTableExt("TEST.TEST_TABLE");
         Assert.assertNotNull(tableExtDesc);
 
         List<TableExtDesc.ColumnStats> columnStatsList = new ArrayList<>();
@@ -102,14 +102,14 @@ public class MetadataManagerTest extends LocalFileMetadataTestCase {
         columnStats.setColumnSamples("Max", "Min", "dfadsfdsfdsafds", "d");
         columnStatsList.add(columnStats);
         tableExtDesc.setColumnStats(columnStatsList);
-        getInstance(getTestConfig()).saveTableExt(tableExtDesc);
+        getInstance(getKylinConfig()).saveTableExt(tableExtDesc);
 
-        TableExtDesc tableExtDesc1 = getInstance(getTestConfig()).getTableExt("TEST.TEST_TABLE");
+        TableExtDesc tableExtDesc1 = getInstance(getKylinConfig()).getTableExt("TEST.TEST_TABLE");
         Assert.assertNotNull(tableExtDesc1);
 
         List<TableExtDesc.ColumnStats> columnStatsList1 = tableExtDesc1.getColumnStats();
         Assert.assertEquals(1, columnStatsList1.size());
 
-        getInstance(getTestConfig()).removeTableExt("TEST.TEST_TABLE");
+        getInstance(getKylinConfig()).removeTableExt("TEST.TEST_TABLE");
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java b/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
index 690e1fe..a2f087a 100644
--- a/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/metadata/badquery/BadQueryHistoryManagerTest.java
@@ -44,7 +44,7 @@ public class BadQueryHistoryManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testBasics() throws Exception {
-        BadQueryHistory history = BadQueryHistoryManager.getInstance(getTestConfig()).getBadQueriesForProject("default");
+        BadQueryHistory history = BadQueryHistoryManager.getInstance(getKylinConfig()).getBadQueriesForProject("default");
         System.out.println(JsonUtil.writeValueAsIndentString(history));
 
         NavigableSet<BadQueryEntry> entries = history.getEntries();
@@ -62,7 +62,7 @@ public class BadQueryHistoryManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testAddEntryToProject() throws IOException {
-        KylinConfig kylinConfig = getTestConfig();
+        KylinConfig kylinConfig = getKylinConfig();
         BadQueryHistoryManager manager = BadQueryHistoryManager.getInstance(kylinConfig);
         BadQueryHistory history = manager.addEntryToProject("sql", 1459362239992L, "adj", 100, "server", "t-0", "user", "default");
         NavigableSet<BadQueryEntry> entries = history.getEntries();
@@ -86,7 +86,7 @@ public class BadQueryHistoryManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testUpdateEntryToProject() throws IOException {
-        KylinConfig kylinConfig = getTestConfig();
+        KylinConfig kylinConfig = getKylinConfig();
         BadQueryHistoryManager manager = BadQueryHistoryManager.getInstance(kylinConfig);
 
         manager.addEntryToProject("sql", 1459362239000L, "adj", 100, "server", "t-0", "user", "default");

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-metadata/src/test/java/org/apache/kylin/metadata/model/DataModelDescTest.java
----------------------------------------------------------------------
diff --git a/core-metadata/src/test/java/org/apache/kylin/metadata/model/DataModelDescTest.java b/core-metadata/src/test/java/org/apache/kylin/metadata/model/DataModelDescTest.java
index 0cfa1f4..b6d457d 100644
--- a/core-metadata/src/test/java/org/apache/kylin/metadata/model/DataModelDescTest.java
+++ b/core-metadata/src/test/java/org/apache/kylin/metadata/model/DataModelDescTest.java
@@ -42,7 +42,7 @@ public class DataModelDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testGetCopyOf() throws JsonProcessingException {
-        DataModelDesc desc = MetadataManager.getInstance(getTestConfig()).getDataModelDesc("test_kylin_inner_join_model_desc");
+        DataModelDesc desc = MetadataManager.getInstance(getKylinConfig()).getDataModelDesc("test_kylin_inner_join_model_desc");
         DataModelDesc copyDesc = DataModelDesc.getCopyOf(desc);
 
         // uuid is different, set to equals for json comparison
@@ -57,7 +57,7 @@ public class DataModelDescTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testPartitionDescCopyOf() throws JsonProcessingException {
-        PartitionDesc desc = MetadataManager.getInstance(getTestConfig()).getDataModelDesc("test_kylin_inner_join_model_desc").partitionDesc;
+        PartitionDesc desc = MetadataManager.getInstance(getKylinConfig()).getDataModelDesc("test_kylin_inner_join_model_desc").partitionDesc;
         PartitionDesc copyDesc = PartitionDesc.getCopyOf(desc);
 
         String descStr = JsonUtil.writeValueAsIndentString(desc);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/core-storage/src/test/java/org/apache/kylin/storage/hybrid/HybridManagerTest.java
----------------------------------------------------------------------
diff --git a/core-storage/src/test/java/org/apache/kylin/storage/hybrid/HybridManagerTest.java b/core-storage/src/test/java/org/apache/kylin/storage/hybrid/HybridManagerTest.java
index 6cbcbc4..51740ab 100644
--- a/core-storage/src/test/java/org/apache/kylin/storage/hybrid/HybridManagerTest.java
+++ b/core-storage/src/test/java/org/apache/kylin/storage/hybrid/HybridManagerTest.java
@@ -56,6 +56,6 @@ public class HybridManagerTest extends LocalFileMetadataTestCase {
     }
 
     public HybridManager getHybridManager() {
-        return HybridManager.getInstance(getTestConfig());
+        return HybridManager.getInstance(getKylinConfig());
     }
 }

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/CubeReducerTest.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/CubeReducerTest.java b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/CubeReducerTest.java
index 97dd750..29e98a2 100644
--- a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/CubeReducerTest.java
+++ b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/CubeReducerTest.java
@@ -61,7 +61,7 @@ public class CubeReducerTest extends LocalFileMetadataTestCase {
 
         // hack for distributed cache
         FileUtils.deleteDirectory(new File("../job/meta"));
-        FileUtils.copyDirectory(new File(getTestConfig().getMetadataUrl()), new File("../job/meta"));
+        FileUtils.copyDirectory(new File(getKylinConfig().getMetadataUrl()), new File("../job/meta"));
 
         CuboidReducer reducer = new CuboidReducer();
         reduceDriver = ReduceDriver.newReduceDriver(reducer);
@@ -78,7 +78,7 @@ public class CubeReducerTest extends LocalFileMetadataTestCase {
 
         reduceDriver.getConfiguration().set(BatchConstants.CFG_CUBE_NAME, "test_kylin_cube_with_slr_ready");
 
-        CubeDesc cubeDesc = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
+        CubeDesc cubeDesc = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
         BufferedMeasureCodec codec = new BufferedMeasureCodec(cubeDesc.getMeasures());
 
         Text key1 = new Text("72010ustech");
@@ -118,7 +118,7 @@ public class CubeReducerTest extends LocalFileMetadataTestCase {
         reduceDriver.getConfiguration().set(BatchConstants.CFG_CUBE_NAME, "test_kylin_cube_with_slr_ready");
         reduceDriver.getConfiguration().setInt(BatchConstants.CFG_CUBE_CUBOID_LEVEL, 1);
 
-        CubeDesc cubeDesc = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
+        CubeDesc cubeDesc = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
         MeasureDesc measureDesc = cubeDesc.getMeasures().get(0);
         FunctionDesc functionDesc = measureDesc.getFunction();
         Field field = FunctionDesc.class.getDeclaredField("measureType");

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidJobTest.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidJobTest.java b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidJobTest.java
index 97b1ef2..081b843 100644
--- a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidJobTest.java
+++ b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidJobTest.java
@@ -78,7 +78,7 @@ public class MergeCuboidJobTest extends LocalFileMetadataTestCase {
         FileUtil.fullyDelete(new File(output));
 
         // CubeManager cubeManager =
-        // CubeManager.getInstanceFromEnv(getTestConfig());
+        // CubeManager.getInstanceFromEnv(getKylinConfig());
 
         String[] args = { "-input", baseFolder.getAbsolutePath() + "," + eightFoler.getAbsolutePath(), "-cubename", cubeName, "-segmentname", "20130331080000_20131212080000", "-output", output, "-jobname", jobname };
         assertEquals("Job failed", 0, ToolRunner.run(conf, new MergeCuboidJob(), args));

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java
index 075ec80..835d63d 100644
--- a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java
+++ b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/MergeCuboidMapperTest.java
@@ -87,7 +87,7 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase {
 
         createTestMetadata();
 
-        logger.info("The metadataUrl is : " + getTestConfig());
+        logger.info("The metadataUrl is : " + getKylinConfig());
 
         MetadataManager.clearCache();
         CubeManager.clearCache();
@@ -102,9 +102,9 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase {
         MergeCuboidMapper mapper = new MergeCuboidMapper();
         mapDriver = MapDriver.newMapDriver(mapper);
 
-        cubeManager = CubeManager.getInstance(getTestConfig());
+        cubeManager = CubeManager.getInstance(getKylinConfig());
         cube = cubeManager.getCube("test_kylin_cube_without_slr_left_join_ready_2_segments");
-        dictionaryManager = DictionaryManager.getInstance(getTestConfig());
+        dictionaryManager = DictionaryManager.getInstance(getKylinConfig());
         lfn = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_FORMAT_NAME");
         lsi = cube.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "CAL_DT");
         ssc = cube.getDescriptor().findColumnRef("DEFAULT.TEST_CATEGORY_GROUPINGS", "META_CATEG_NAME");
@@ -167,7 +167,7 @@ public class MergeCuboidMapperTest extends LocalFileMetadataTestCase {
 
         // hack for distributed cache
         //        File metaDir = new File("../job/meta");
-        //        FileUtils.copyDirectory(new File(getTestConfig().getMetadataUrl()), metaDir);
+        //        FileUtils.copyDirectory(new File(getKylinConfig().getMetadataUrl()), metaDir);
         //
         //        mapDriver.getConfiguration().set(BatchConstants.CFG_CUBE_NAME, cubeName);
         //        mapDriver.getConfiguration().set(BatchConstants.CFG_CUBE_SEGMENT_NAME, segmentName);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/NDCuboidMapperTest.java
----------------------------------------------------------------------
diff --git a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/NDCuboidMapperTest.java b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/NDCuboidMapperTest.java
index 815d9b3..de71d40 100644
--- a/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/NDCuboidMapperTest.java
+++ b/engine-mr/src/test/java/org/apache/kylin/engine/mr/steps/NDCuboidMapperTest.java
@@ -54,7 +54,7 @@ public class NDCuboidMapperTest extends LocalFileMetadataTestCase {
 
         // hack for distributed cache
         FileUtils.deleteDirectory(new File("./meta"));
-        FileUtils.copyDirectory(new File(getTestConfig().getMetadataUrl()), new File("./meta"));
+        FileUtils.copyDirectory(new File(getKylinConfig().getMetadataUrl()), new File("./meta"));
 
         NDCuboidMapper mapper = new NDCuboidMapper();
         CuboidReducer reducer = new CuboidReducer();

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/kylin-it/src/test/java/org/apache/kylin/cube/ITDictionaryManagerTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/cube/ITDictionaryManagerTest.java b/kylin-it/src/test/java/org/apache/kylin/cube/ITDictionaryManagerTest.java
index 188a97a..5c691ba 100644
--- a/kylin-it/src/test/java/org/apache/kylin/cube/ITDictionaryManagerTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/cube/ITDictionaryManagerTest.java
@@ -59,8 +59,8 @@ public class ITDictionaryManagerTest extends LocalFileMetadataTestCase {
 
     @Test
     public void basic() throws Exception {
-        dictMgr = DictionaryManager.getInstance(getTestConfig());
-        CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc("test_kylin_cube_without_slr_desc");
+        dictMgr = DictionaryManager.getInstance(getKylinConfig());
+        CubeDesc cubeDesc = CubeDescManager.getInstance(getKylinConfig()).getCubeDesc("test_kylin_cube_without_slr_desc");
         TblColRef col = cubeDesc.findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_FORMAT_NAME");
 
         MockDistinctColumnValuesProvider mockupData = new MockDistinctColumnValuesProvider("A", "B", "C");

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java b/kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java
index 67b62d5..de4a7e5 100644
--- a/kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java
+++ b/kylin-it/src/test/java/org/apache/kylin/provision/BuildCubeWithEngine.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.KylinTestConfig;
 import org.apache.kylin.common.util.ClassUtil;
 import org.apache.kylin.common.util.HBaseMetadataTestCase;
 import org.apache.kylin.common.util.Pair;
@@ -162,11 +163,11 @@ public class BuildCubeWithEngine {
 
     public void build() throws Exception {
         DeployUtil.prepareTestDataForNormalCubes("test_kylin_cube_with_slr_empty");
-        KylinConfig.getInstanceFromEnv().setHBaseHFileSizeGB(1.0f);
+        KylinTestConfig.getInstanceFromEnv().setHBaseHFileSizeGB(1.0f);
         testInner();
         testLeft();
         testViewAsLookup();
-        KylinConfig.getInstanceFromEnv().setHBaseHFileSizeGB(0.0f);
+        KylinTestConfig.getInstanceFromEnv().setHBaseHFileSizeGB(0.0f);
     }
 
     protected ExecutableState waitForJob(String jobId) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/kylin-it/src/test/java/org/apache/kylin/source/hive/ITHiveSourceTableLoaderTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/source/hive/ITHiveSourceTableLoaderTest.java b/kylin-it/src/test/java/org/apache/kylin/source/hive/ITHiveSourceTableLoaderTest.java
index c4f0777..fa6d025 100644
--- a/kylin-it/src/test/java/org/apache/kylin/source/hive/ITHiveSourceTableLoaderTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/source/hive/ITHiveSourceTableLoaderTest.java
@@ -43,7 +43,7 @@ public class ITHiveSourceTableLoaderTest extends HBaseMetadataTestCase {
 
     @Test
     public void test() throws IOException {
-        KylinConfig config = getTestConfig();
+        KylinConfig config = getKylinConfig();
         String[] toLoad = new String[] { "DEFAULT.TEST_KYLIN_FACT", "EDW.TEST_CAL_DT" };
         Set<String> loaded = HiveSourceTableLoader.reloadHiveTables(toLoad, config);
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/kylin-it/src/test/java/org/apache/kylin/source/hive/ITSnapshotManagerTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/source/hive/ITSnapshotManagerTest.java b/kylin-it/src/test/java/org/apache/kylin/source/hive/ITSnapshotManagerTest.java
index 6396749..4bb4133 100644
--- a/kylin-it/src/test/java/org/apache/kylin/source/hive/ITSnapshotManagerTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/source/hive/ITSnapshotManagerTest.java
@@ -44,7 +44,7 @@ public class ITSnapshotManagerTest extends HBaseMetadataTestCase {
     @Before
     public void setup() throws Exception {
         createTestMetadata();
-        snapshotMgr = SnapshotManager.getInstance(getTestConfig());
+        snapshotMgr = SnapshotManager.getInstance(getKylinConfig());
     }
 
     @After
@@ -55,7 +55,7 @@ public class ITSnapshotManagerTest extends HBaseMetadataTestCase {
     @Test
     public void basicTest() throws Exception {
         String tableName = "EDW.TEST_SITES";
-        TableDesc tableDesc = MetadataManager.getInstance(getTestConfig()).getTableDesc(tableName);
+        TableDesc tableDesc = MetadataManager.getInstance(getKylinConfig()).getTableDesc(tableName);
         ReadableTable hiveTable = SourceFactory.createReadableTable(tableDesc);
         String snapshotPath = snapshotMgr.buildSnapshot(hiveTable, tableDesc).getResourcePath();
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/kylin-it/src/test/java/org/apache/kylin/storage/hbase/ITStorageTest.java
----------------------------------------------------------------------
diff --git a/kylin-it/src/test/java/org/apache/kylin/storage/hbase/ITStorageTest.java b/kylin-it/src/test/java/org/apache/kylin/storage/hbase/ITStorageTest.java
index db9d133..3884f88 100644
--- a/kylin-it/src/test/java/org/apache/kylin/storage/hbase/ITStorageTest.java
+++ b/kylin-it/src/test/java/org/apache/kylin/storage/hbase/ITStorageTest.java
@@ -69,7 +69,7 @@ public class ITStorageTest extends HBaseMetadataTestCase {
     public void setUp() throws Exception {
         this.createTestMetadata();
 
-        CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
+        CubeManager cubeMgr = CubeManager.getInstance(getKylinConfig());
         cube = cubeMgr.getCube("test_kylin_cube_without_slr_left_join_empty");
         Assert.assertNotNull(cube);
         storageEngine = StorageFactory.createQuery(cube);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java
index 3cd994b..b6d6f99 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/JobControllerTest.java
@@ -70,7 +70,7 @@ public class JobControllerTest extends ServiceTestBase {
         cubeController.setJobService(jobService);
         cubeController.setCubeService(cubeService);
 
-        KylinConfig testConfig = getTestConfig();
+        KylinConfig testConfig = getKylinConfig();
         cubeManager = CubeManager.getInstance(testConfig);
         cubeDescManager = CubeDescManager.getInstance(testConfig);
         executableDAO = ExecutableDao.getInstance(testConfig);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/server/src/test/java/org/apache/kylin/rest/controller/ProjectControllerTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/kylin/rest/controller/ProjectControllerTest.java b/server/src/test/java/org/apache/kylin/rest/controller/ProjectControllerTest.java
index cd9a524..c176b8e 100644
--- a/server/src/test/java/org/apache/kylin/rest/controller/ProjectControllerTest.java
+++ b/server/src/test/java/org/apache/kylin/rest/controller/ProjectControllerTest.java
@@ -72,16 +72,16 @@ public class ProjectControllerTest extends ServiceTestBase {
         ProjectInstance ret = projectController.saveProject(getProjectRequest(project, null));
 
         Assert.assertEquals(ret.getOwner(), "ADMIN");
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1);
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).listAllProjects().size(), originalProjectCount + 1);
 
         //test update project
         ProjectInstance newProject = new ProjectInstance();
         newProject.setName("new_project_2");
         projectController.updateProject(getProjectRequest(newProject, "new_project"));
 
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1);
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project"), null);
-        Assert.assertNotEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project_2"), null);
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).listAllProjects().size(), originalProjectCount + 1);
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).getProject("new_project"), null);
+        Assert.assertNotEquals(ProjectManager.getInstance(getKylinConfig()).getProject("new_project_2"), null);
 
         //test update project description only
         ProjectInstance newProject2 = new ProjectInstance();
@@ -89,10 +89,10 @@ public class ProjectControllerTest extends ServiceTestBase {
         newProject2.setDescription("hello world");
         projectController.updateProject(getProjectRequest(newProject2, "new_project_2"));
 
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1);
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project"), null);
-        Assert.assertNotEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project_2"), null);
-        Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project_2").getDescription(), "hello world");
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).listAllProjects().size(), originalProjectCount + 1);
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).getProject("new_project"), null);
+        Assert.assertNotEquals(ProjectManager.getInstance(getKylinConfig()).getProject("new_project_2"), null);
+        Assert.assertEquals(ProjectManager.getInstance(getKylinConfig()).getProject("new_project_2").getDescription(), "hello world");
     }
 
     @Test(expected = InternalErrorException.class)

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/MeasureTypeOnlyAggrInBaseTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/MeasureTypeOnlyAggrInBaseTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/MeasureTypeOnlyAggrInBaseTest.java
index f151876..34f361e 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/MeasureTypeOnlyAggrInBaseTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/cube/MeasureTypeOnlyAggrInBaseTest.java
@@ -55,7 +55,7 @@ public class MeasureTypeOnlyAggrInBaseTest extends LocalFileMetadataTestCase {
     private List<FunctionDesc> metrics;
 
     public CubeManager getCubeManager() {
-        return CubeManager.getInstance(getTestConfig());
+        return CubeManager.getInstance(getKylinConfig());
     }
 
     private CubeInstance getTestKylinCubeWithSeller() {

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/CubeHFileMapper2Test.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/CubeHFileMapper2Test.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/CubeHFileMapper2Test.java
index 77b18e2..1319fe2 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/CubeHFileMapper2Test.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/CubeHFileMapper2Test.java
@@ -55,8 +55,8 @@ public class CubeHFileMapper2Test extends LocalFileMetadataTestCase {
         this.createTestMetadata();
         // hack for distributed cache
         FileUtils.deleteDirectory(new File("../job/meta"));
-        FileUtils.copyDirectory(new File(getTestConfig().getMetadataUrl()), new File("../job/meta"));
-        CubeDesc desc = CubeManager.getInstance(getTestConfig()).getCube(cubeName).getDescriptor();
+        FileUtils.copyDirectory(new File(getKylinConfig().getMetadataUrl()), new File("../job/meta"));
+        CubeDesc desc = CubeManager.getInstance(getKylinConfig()).getCube(cubeName).getDescriptor();
         codec = new MeasureCodec(desc.getMeasures());
     }
 
@@ -70,7 +70,7 @@ public class CubeHFileMapper2Test extends LocalFileMetadataTestCase {
     public void testBasic() throws Exception {
 
         Configuration hconf = HadoopUtil.getCurrentConfiguration();
-        Context context = MockupMapContext.create(hconf, getTestConfig().getMetadataUrl(), cubeName, outKV);
+        Context context = MockupMapContext.create(hconf, getKylinConfig().getMetadataUrl(), cubeName, outKV);
 
         CubeHFileMapper mapper = new CubeHFileMapper();
         mapper.setup(context);

http://git-wip-us.apache.org/repos/asf/kylin/blob/ef76d480/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/RowValueDecoderTest.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/RowValueDecoderTest.java b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/RowValueDecoderTest.java
index f0ad6e0..8abab13 100644
--- a/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/RowValueDecoderTest.java
+++ b/storage-hbase/src/test/java/org/apache/kylin/storage/hbase/steps/RowValueDecoderTest.java
@@ -53,7 +53,7 @@ public class RowValueDecoderTest extends LocalFileMetadataTestCase {
 
     @Test
     public void testDecode() throws Exception {
-        CubeDesc cubeDesc = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
+        CubeDesc cubeDesc = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
         HBaseColumnDesc hbaseCol = cubeDesc.getHbaseMapping().getColumnFamily()[0].getColumns()[0];
 
         BufferedMeasureCodec codec = new BufferedMeasureCodec(hbaseCol.getMeasures());
@@ -83,7 +83,7 @@ public class RowValueDecoderTest extends LocalFileMetadataTestCase {
 
     @Test(expected = IllegalArgumentException.class)
     public void testError() throws Exception {
-        CubeDesc cubeDesc = CubeManager.getInstance(getTestConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
+        CubeDesc cubeDesc = CubeManager.getInstance(getKylinConfig()).getCube("test_kylin_cube_with_slr_ready").getDescriptor();
         HBaseColumnDesc hbaseCol = cubeDesc.getHbaseMapping().getColumnFamily()[0].getColumns()[0];
 
         BufferedMeasureCodec codec = new BufferedMeasureCodec(hbaseCol.getMeasures());


Mime
View raw message