Package com.alibaba.otter.shared.common.utils.cmd.Exec

Examples of com.alibaba.otter.shared.common.utils.cmd.Exec.Result


public class ExecIntegration extends BaseOtterTest {

    @Test
    public void testSample() {
        try {
            Result result = Exec.execute("dir");// liunx和windows度支持的命令
            want.object(result).notNull();
            want.string(result.getStdout()).notBlank();
        } catch (Exception e) {
            want.fail();
        }

    }
View Full Code Here


    @Test
    public void testAppender() {
        String tmp = System.getProperty("java.io.tmpdir", "/tmp");
        try {
            Result result = Exec.execute("dir", tmp + "/exec.log");// liunx和windows度支持的命令
            want.object(result).notNull();
            want.string(result.getStdout()).notBlank();
        } catch (Exception e) {
            e.printStackTrace();
            want.fail();
        }
View Full Code Here

    @Test
    public void testInput() {
        String tmp = System.getProperty("java.io.tmpdir", "/tmp");
        try {
            Result result = Exec.execute("dir", tmp + "/exec.log", tmp.getBytes());// liunx和windows度支持的命令
            want.object(result).notNull();
            want.string(result.getStdout()).notBlank();
        } catch (Exception e) {
            want.fail();
        }

    }
View Full Code Here

    @Test
    public void testUserDir() {
        String tmp = System.getProperty("java.io.tmpdir", "/tmp");
        try {
            Result result = Exec.execute("dir", tmp + "/exec.log", tmp.getBytes(), new File(tmp));// liunx和windows度支持的命令
            want.object(result).notNull();
            want.string(result.getStdout()).notBlank();
        } catch (Exception e) {
            want.fail();
        }

    }
View Full Code Here

        autoKeeperData.joinWatch(address, autoKeeperWatchStats);

    }

    public static String collector(String[] command) {
        Result result = null;
        try {
            result = Exec.execute(command);
            if (result.getExitCode() == 0) {
                return result.getStdout();
            } else {
                return result.getStderr();
            }
        } catch (Exception e) {
            throw new ManagerException(e);
        }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.common.utils.cmd.Exec.Result

Copyright © 2018 www.massapicom. 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.