Java Code Examples for org.apache.kylin.common.util.ClassUtil#addClasspath()

The following examples show how to use org.apache.kylin.common.util.ClassUtil#addClasspath() . 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: SampleCubeSetupTest.java    From Kylin with Apache License 2.0 6 votes vote down vote up
@Before
public void before() throws Exception {

    String confPaths = System.getenv("KYLIN_HBASE_CONF_PATH");
    System.out.println("The conf paths is " + confPaths);
    if (confPaths != null) {
        String[] paths = confPaths.split(":");
        for (String path : paths) {
            if (!StringUtils.isEmpty(path)) {
                try {
                    ClassUtil.addClasspath(new File(path).getAbsolutePath());
                } catch (Exception e) {
                    System.out.println(e.getLocalizedMessage());
                    System.out.println(e.getStackTrace());
                }
            }
        }
    }
}
 
Example 2
Source File: SandboxMetastoreCLI.java    From kylin with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("HADOOP_USER_NAME", "root");
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    if (args.length < 1) {
        printUsage();
        return;
    }

    if ("reset".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "reset" });
    } else if ("download".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "download", args[1] });
    } else if ("fetch".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "fetch", args[1], args[2] });
    } else if ("upload".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "upload", args[1] });
    } else {
        printUsage();
    }
}
 
Example 3
Source File: SandboxMetastoreCLI.java    From kylin-on-parquet-v2 with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    System.setProperty("HADOOP_USER_NAME", "root");
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    if (args.length < 1) {
        printUsage();
        return;
    }

    if ("reset".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "reset" });
    } else if ("download".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "download", args[1] });
    } else if ("fetch".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "fetch", args[1], args[2] });
    } else if ("upload".equalsIgnoreCase(args[0])) {
        ResourceTool.main(new String[] { "upload", args[1] });
    } else {
        printUsage();
    }
}
 
Example 4
Source File: DeployLocalMetaToRemoteTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }
}
 
Example 5
Source File: BuildCubeWithEngineTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, "../examples/test_case_data/sandbox");
    System.setProperty("hdp.version", "2.2.0.0-2041"); // mapred-site.xml ref this
}
 
Example 6
Source File: BuildCubeWithStreamV2.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static void beforeClass(String confDir) throws Exception {
    logger.info("Adding to classpath: " + new File(confDir).getAbsolutePath());
    ClassUtil.addClasspath(new File(confDir).getAbsolutePath());

    System.setProperty(KylinConfig.KYLIN_CONF, confDir);
    System.setProperty("kylin.hadoop.conf.dir", confDir);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    // use mocked stream data search client
    System.setProperty("kylin.stream.stand-alone.mode", "true");

    // DeployUtil.deployMetadata();

    // setup cube conn and h2 conn
    setupAll();

    try {
        //check hdfs permission
        FileSystem fileSystem = HadoopUtil.getWorkingFileSystem();
        String hdfsWorkingDirectory = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory();
        Path coprocessorDir = new Path(hdfsWorkingDirectory);
        boolean success = fileSystem.mkdirs(coprocessorDir);
        if (!success) {
            throw new IOException("mkdir fails, please check hdfs permission");
        }
    } catch (IOException e) {
        throw new RuntimeException(
                "failed to create kylin.env.hdfs-working-dir, Please make sure the user has right to access "
                        + KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory(),
                e);
    }

    cleanStreamZkRoot();
}
 
Example 7
Source File: BuildCubeWithStream.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }
    HBaseMetadataTestCase.staticCreateTestMetadata(HBaseMetadataTestCase.SANDBOX_TEST_DATA);
}
 
Example 8
Source File: DeployLocalMetaToRemoteTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException("No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }
}
 
Example 9
Source File: KylinConfig.java    From kylin with Apache License 2.0 5 votes vote down vote up
public static void setSandboxEnvIfPossible() {
    File dir1 = new File("../examples/test_case_data/sandbox");
    File dir2 = new File("../../kylin/examples/test_case_data/sandbox");

    if (dir1.exists()) {
        logger.info("Setting sandbox env, KYLIN_CONF=" + dir1.getAbsolutePath());
        ClassUtil.addClasspath(dir1.getAbsolutePath());
        System.setProperty(KylinConfig.KYLIN_CONF, dir1.getAbsolutePath());
    } else if (dir2.exists()) {
        logger.info("Setting sandbox env, KYLIN_CONF=" + dir2.getAbsolutePath());
        ClassUtil.addClasspath(dir2.getAbsolutePath());
        System.setProperty(KylinConfig.KYLIN_CONF, dir2.getAbsolutePath());
    }
}
 
Example 10
Source File: BuildCubeWithStreamV2.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static void beforeClass(String confDir) throws Exception {
    logger.info("Adding to classpath: " + new File(confDir).getAbsolutePath());
    ClassUtil.addClasspath(new File(confDir).getAbsolutePath());

    System.setProperty(KylinConfig.KYLIN_CONF, confDir);
    System.setProperty("kylin.hadoop.conf.dir", confDir);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    // use mocked stream data search client
    System.setProperty("kylin.stream.stand-alone.mode", "true");

    // DeployUtil.deployMetadata();

    // setup cube conn and h2 conn
    setupAll();

    try {
        //check hdfs permission
        FileSystem fileSystem = HadoopUtil.getWorkingFileSystem();
        String hdfsWorkingDirectory = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory();
        Path coprocessorDir = new Path(hdfsWorkingDirectory);
        boolean success = fileSystem.mkdirs(coprocessorDir);
        if (!success) {
            throw new IOException("mkdir fails, please check hdfs permission");
        }
    } catch (IOException e) {
        throw new RuntimeException(
                "failed to create kylin.env.hdfs-working-dir, Please make sure the user has right to access "
                        + KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory(),
                e);
    }

    cleanStreamZkRoot();
}
 
Example 11
Source File: BuildCubeWithStream.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }
    HBaseMetadataTestCase.staticCreateTestMetadata(HBaseMetadataTestCase.SANDBOX_TEST_DATA);
}
 
Example 12
Source File: KylinConfig.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
public static void setSandboxEnvIfPossible() {
    File dir1 = new File("../examples/test_case_data/sandbox");
    File dir2 = new File("../../kylin/examples/test_case_data/sandbox");

    if (dir1.exists()) {
        logger.info("Setting sandbox env, KYLIN_CONF=" + dir1.getAbsolutePath());
        ClassUtil.addClasspath(dir1.getAbsolutePath());
        System.setProperty(KylinConfig.KYLIN_CONF, dir1.getAbsolutePath());
    } else if (dir2.exists()) {
        logger.info("Setting sandbox env, KYLIN_CONF=" + dir2.getAbsolutePath());
        ClassUtil.addClasspath(dir2.getAbsolutePath());
        System.setProperty(KylinConfig.KYLIN_CONF, dir2.getAbsolutePath());
    }
}
 
Example 13
Source File: MultipleDictionaryValueEnumeratorTest.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
}
 
Example 14
Source File: BuildCubeWithEngine.java    From kylin with Apache License 2.0 4 votes vote down vote up
public static void beforeClass(String confDir) throws Exception {
    logger.info("Adding to classpath: " + new File(confDir).getAbsolutePath());
    ClassUtil.addClasspath(new File(confDir).getAbsolutePath());

    fastBuildMode = isFastBuildMode();
    simpleBuildMode = isSimpleBuildMode();
    if (fastBuildMode) {
        logger.info("Will use fast build mode");
    }
    if (simpleBuildMode) {
        logger.info("Will use simple build mode");
    }

    String specifiedEngineType = System.getProperty("engineType");
    if (StringUtils.isNotEmpty(specifiedEngineType)) {
        engineType = Integer.parseInt(specifiedEngineType);
    }

    System.setProperty(KylinConfig.KYLIN_CONF, confDir);
    System.setProperty("SPARK_HOME", "/usr/local/spark"); // need manually create and put spark to this folder on Jenkins
    System.setProperty("kylin.hadoop.conf.dir", confDir);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    HBaseMetadataTestCase.staticCreateTestMetadata(confDir);

    try {
        //check hdfs permission
        FileSystem fileSystem = HadoopUtil.getWorkingFileSystem();
        String hdfsWorkingDirectory = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory();
        Path coprocessorDir = new Path(hdfsWorkingDirectory);
        boolean success = fileSystem.mkdirs(coprocessorDir);
        if (!success) {
            throw new IOException("mkdir fails");
        }
    } catch (IOException e) {
        throw new RuntimeException(
                "failed to create kylin.env.hdfs-working-dir, Please make sure the user has right to access "
                        + KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory(),
                e);
    }
}
 
Example 15
Source File: MultipleDictionaryValueEnumeratorTest.java    From kylin with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty(KylinConfig.KYLIN_CONF, HBaseMetadataTestCase.SANDBOX_TEST_DATA);
}
 
Example 16
Source File: BuildCubeWithEngine.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
public static void beforeClass(String confDir) throws Exception {
    logger.info("Adding to classpath: " + new File(confDir).getAbsolutePath());
    ClassUtil.addClasspath(new File(confDir).getAbsolutePath());

    fastBuildMode = isFastBuildMode();
    simpleBuildMode = isSimpleBuildMode();
    if (fastBuildMode) {
        logger.info("Will use fast build mode");
    }
    if (simpleBuildMode) {
        logger.info("Will use simple build mode");
    }

    String specifiedEngineType = System.getProperty("engineType");
    if (StringUtils.isNotEmpty(specifiedEngineType)) {
        engineType = Integer.parseInt(specifiedEngineType);
    }

    System.setProperty(KylinConfig.KYLIN_CONF, confDir);
    System.setProperty("SPARK_HOME", "/usr/local/spark"); // need manually create and put spark to this folder on Jenkins
    System.setProperty("kylin.hadoop.conf.dir", confDir);
    if (StringUtils.isEmpty(System.getProperty("hdp.version"))) {
        throw new RuntimeException(
                "No hdp.version set; Please set hdp.version in your jvm option, for example: -Dhdp.version=2.4.0.0-169");
    }

    HBaseMetadataTestCase.staticCreateTestMetadata(confDir);

    try {
        //check hdfs permission
        FileSystem fileSystem = HadoopUtil.getWorkingFileSystem();
        String hdfsWorkingDirectory = KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory();
        Path coprocessorDir = new Path(hdfsWorkingDirectory);
        boolean success = fileSystem.mkdirs(coprocessorDir);
        if (!success) {
            throw new IOException("mkdir fails");
        }
    } catch (IOException e) {
        throw new RuntimeException(
                "failed to create kylin.env.hdfs-working-dir, Please make sure the user has right to access "
                        + KylinConfig.getInstanceFromEnv().getHdfsWorkingDirectory(),
                e);
    }
}
 
Example 17
Source File: BuildIIWithEngineTest.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    logger.info("Adding to classpath: " + new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    ClassUtil.addClasspath(new File(HBaseMetadataTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
    System.setProperty("hdp.version", "2.2.0.0-2041"); // mapred-site.xml ref this
}
 
Example 18
Source File: CubeMigrationTests.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() throws Exception {
    super.createTestMetadata();
    ClassUtil.addClasspath(new File(AbstractKylinTestCase.SANDBOX_TEST_DATA).getAbsolutePath());
}
 
Example 19
Source File: ResourceToolTest.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() throws Exception {
    ClassUtil.addClasspath(new File("../examples/test_case_data/hadoop-site").getAbsolutePath());
}