Examples of Tool


Examples of org.apache.avro.tool.Tool

        LOG.info("Deleting " + json);
        FileUtils.deleteQuietly(new File(json));
    }

    private static void generateAvroFile(String schema, String json, String avro, String codec) throws IOException {
        Tool tool = new DataFileWriteTool();
        List<String> args = new ArrayList<String>();
        args.add("--schema-file");
        args.add(schema);
        args.add(json);
        if (codec != null) {
            args.add("--codec");
            args.add(codec);
        }
        try {
            StringBuffer sb = new StringBuffer();
            for (String a : args) {
                sb.append(a);
                sb.append(" ");
            }
            PrintStream out = new PrintStream(avro);
            tool.run(System.in, out, System.err, args);
        } catch (Exception e) {
            LOG.info("Could not generate avro file: " + avro, e);
            throw new IOException();
        }
    }
View Full Code Here

Examples of org.apache.hadoop.util.Tool

    }

    // run the import
    List<String> argv = new ArrayList<String>(Arrays.asList(args));
    argv.add(inputPath.toString());
    Tool tool = new ImportTsv();
    LOG.debug("Running ImportTsv with arguments: " + argv);
    assertEquals(0, ToolRunner.run(conf, tool, argv.toArray(args)));

    // Perform basic validation. If the input args did not include
    // ImportTsv.BULK_OUTPUT_CONF_KEY then validate data in the table.
View Full Code Here

Examples of org.apache.hadoop.util.Tool

            return LAUNCH_ERROR;
        }
        try {
            Configuration conf = options.getConfiguration();
            conf.setClassLoader(options.getApplicationClassLoader());
            Tool tool;
            try {
                tool = ReflectionUtils.newInstance(options.getApplicationClass(), conf);
            } catch (Exception e) {
                LOG.error(MessageFormat.format(
                        "Exception occurred in launcher: {0}{1}",
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * @throws Exception if failed to execute command
     */
    public static void main(String... args) throws Exception {
        LOG.info("[OT-CLEAN-I00000] Start Hadoop FS cleaning tool");
        long start = System.currentTimeMillis();
        Tool tool = new Clean();
        tool.setConf(new Configuration());
        int exit = tool.run(args); // no generic options
        long end = System.currentTimeMillis();
        LOG.info(MessageFormat.format(
                "[OT-CLEAN-I00999] Finish Hadoop FS cleaning tool (exit-code={0}, elapsed={1}ms)",
                exit,
                end - start));
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * list via program entry.
     * @throws Exception if failed
     */
    @Test
    public void run() throws Exception {
        Tool exec = new DirectIoListTransaction(repo);
        indoubt("ex1");
        indoubt("ex2");
        indoubt("ex3");

        assertThat(ToolRunner.run(conf, exec, new String[0]), is(0));
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * Invalid arguments for program entry.
     * @throws Exception if failed
     */
    @Test
    public void run_invalid() throws Exception {
        Tool exec = new DirectIoListTransaction(repo);
        assertThat(ToolRunner.run(conf, exec, new String[] { "1" }), is(not(0)));
    }
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * applies via program entry.
     * @throws Exception if failed
     */
    @Test
    public void run() throws Exception {
        Tool exec = new DirectIoApplyTransaction(repo);

        indoubt("ex1");
        assertThat(count(production1), is(0));
        assertThat(count(production2), is(0));

View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * applies via program entry but failed.
     * @throws Exception if failed
     */
    @Test
    public void run_failure() throws Exception {
        Tool exec = new DirectIoApplyTransaction(repo);
        indoubt("ex1");

        writable(production1, false);
        assertThat(ToolRunner.run(conf, exec, new String[] {"ex1"}), is(not(0)));
    }
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * Invalid arguments for program entry.
     * @throws Exception if failed
     */
    @Test
    public void run_invalid() throws Exception {
        Tool exec = new DirectIoApplyTransaction(repo);
        assertThat(ToolRunner.run(conf, exec, new String[] { }), is(not(0)));
        assertThat(ToolRunner.run(conf, exec, new String[] {"1", "2"}), is(not(0)));
    }
View Full Code Here

Examples of org.apache.hadoop.util.Tool

     * aborts via program entry.
     * @throws Exception if failed
     */
    @Test
    public void run() throws Exception {
        Tool exec = new DirectIoAbortTransaction(repo);

        indoubt("ex1");
        assertThat(count(production1), is(0));
        assertThat(count(production2), is(0));

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.