Java Code Examples for org.apache.kylin.common.KylinConfig#destoryInstance()

The following examples show how to use org.apache.kylin.common.KylinConfig#destoryInstance() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImportHBaseData.java    From Kylin with Apache License 2.0 6 votes vote down vote up
public void setup() throws IOException {

        KylinConfig.destoryInstance();
        System.setProperty(KylinConfig.KYLIN_CONF, AbstractKylinTestCase.SANDBOX_TEST_DATA);

        kylinConfig = KylinConfig.getInstanceFromEnv();
        cli = kylinConfig.getCliCommandExecutor();

        String metadataUrl = kylinConfig.getMetadataUrl();
        // split TABLE@HBASE_URL
        int cut = metadataUrl.indexOf('@');
        tableNameBase = metadataUrl.substring(0, cut);
        String hbaseUrl = cut < 0 ? metadataUrl : metadataUrl.substring(cut + 1);

        HConnection conn = HBaseConnection.get(hbaseUrl);
        try {
            hbase = new HBaseAdmin(conn);
            config = hbase.getConfiguration();
            //allTables = hbase.listTables();
        } catch (IOException e) {
            e.printStackTrace();
            throw e;
        }

        uploadTarballToRemote();
    }
 
Example 2
Source File: LocalFileMetadataTestCase.java    From Kylin with Apache License 2.0 6 votes vote down vote up
public static void createTestMetadata(String testDataFolder) {
    KylinConfig.destoryInstance();

    String tempTestMetadataUrl = "../examples/test_metadata";
    try {
        FileUtils.deleteDirectory(new File(tempTestMetadataUrl));
        FileUtils.copyDirectory(new File(testDataFolder), new File(tempTestMetadataUrl));
    } catch (IOException e) {
        e.printStackTrace();
    }

    if (System.getProperty(KylinConfig.KYLIN_CONF) == null && System.getenv(KylinConfig.KYLIN_CONF) == null)
        System.setProperty(KylinConfig.KYLIN_CONF, tempTestMetadataUrl);

    KylinConfig.getInstanceFromEnv().setMetadataUrl(tempTestMetadataUrl);
}
 
Example 3
Source File: CubeMetadataUpgrade.java    From Kylin with Apache License 2.0 5 votes vote down vote up
public CubeMetadataUpgrade(String newMetadataUrl) {
    KylinConfig.destoryInstance();
    System.setProperty(KylinConfig.KYLIN_CONF, newMetadataUrl);
    KylinConfig.getInstanceFromEnv().setMetadataUrl(newMetadataUrl);


    config = KylinConfig.getInstanceFromEnv();
    store = getStore();
}
 
Example 4
Source File: ImportHBaseData.java    From Kylin with Apache License 2.0 5 votes vote down vote up
public void tearDown() {
    // cleanup sandbox disk
    try {
        if (cli != null && importFolder != null) {
            cli.execute("rm -r " + importFolder);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    KylinConfig.destoryInstance();

}
 
Example 5
Source File: ExportHBaseData.java    From Kylin with Apache License 2.0 5 votes vote down vote up
private void setup() throws IOException {
    long currentTIME = System.currentTimeMillis();
    exportFolder = "/tmp/hbase-export/" + currentTIME + "/";
    backupArchive = "/tmp/kylin_" + currentTIME + ".tar.gz";

    KylinConfig.destoryInstance();
    System.setProperty(KylinConfig.KYLIN_CONF, AbstractKylinTestCase.SANDBOX_TEST_DATA);

    kylinConfig = KylinConfig.getInstanceFromEnv();
    cli = kylinConfig.getCliCommandExecutor();

    String metadataUrl = kylinConfig.getMetadataUrl();
    // split TABLE@HBASE_URL
    int cut = metadataUrl.indexOf('@');
    tableNameBase = metadataUrl.substring(0, cut);
    String hbaseUrl = cut < 0 ? metadataUrl : metadataUrl.substring(cut + 1);

    HConnection conn = HBaseConnection.get(hbaseUrl);
    try {
        hbase = new HBaseAdmin(conn);
        config = hbase.getConfiguration();
        allTables = hbase.listTables();
    } catch (IOException e) {
        e.printStackTrace();
        throw e;
    }
}
 
Example 6
Source File: AbstractKylinTestCase.java    From Kylin with Apache License 2.0 4 votes vote down vote up
public static void staticCleanupTestMetadata() {
    cleanupCache();
    System.clearProperty(KylinConfig.KYLIN_CONF);
    KylinConfig.destoryInstance();

}
 
Example 7
Source File: AbstractKylinTestCase.java    From Kylin with Apache License 2.0 3 votes vote down vote up
public static void staticCreateTestMetadata(String kylinConfigFolder) {

        KylinConfig.destoryInstance();

        if (System.getProperty(KylinConfig.KYLIN_CONF) == null && System.getenv(KylinConfig.KYLIN_CONF) == null)
            System.setProperty(KylinConfig.KYLIN_CONF, kylinConfigFolder);

    }