Examples of canExecute()


Examples of java.io.File.canExecute()

       
        private File createRestartScript() throws IOException {
            // FIXME use nodeDir
            File runsh = new File("run.sh");
            String runshNoNice = "run.nonice-for-update.sh";
            if(!(runsh.exists() && runsh.canExecute())) {
                System.err.println("Cannot find run.sh so cannot deploy multi-file update for "+name);
                return null;
            }
            // EVIL HACK
            if(!createRunShNoNice(runsh, new File(runshNoNice))) {
View Full Code Here

Examples of java.io.File.canExecute()

    private File which(String cmd) throws IOException {
        String path = System.getenv("PATH");
        if (path != null) {
          for (String dir : path.split(Pattern.quote(File.pathSeparator))) {
              File command = new File(dir.trim(), cmd);
              if (command.canExecute()) {
                  return command.getAbsoluteFile();
              }
          }
        }
        throw new IOException("No command '" + cmd + "' on path " + path);
View Full Code Here

Examples of java.io.File.canExecute()

        javaExecs.add(System.getProperty("java.home") + "/bin/java");

        List<JavaInfo> result = Lists.newArrayList();
        for (String javaPath : javaExecs) {
            File javaFile = new File(javaPath);
            if (!javaFile.exists() || !javaFile.canExecute()) {
                continue;
            }

            try {
                result.add(new JavaInfo(javaPath));
View Full Code Here

Examples of java.io.File.canExecute()

        String path=System.getenv("PATH");
        String fileSeparator=System.getProperty("file.separator");
        String pathSeparator=System.getProperty("path.separator");
        for(String dir:Splitter.on(pathSeparator).split(path)) {
            File target=new File(dir,cmd);
            if(target.canExecute()) {
                return target.getAbsolutePath();
            }
        }
        return null;
    }
View Full Code Here

Examples of java.io.File.canExecute()

    @Test
    public void executeCommand_delegate() {
        Assume.assumeTrue("not unix-like", SystemUtils.IS_OS_MAC_OSX || SystemUtils.IS_OS_LINUX);

        File touch = new File("/usr/bin/touch");
        Assume.assumeTrue("no 'touch' command", touch.isFile() && touch.canExecute());

        final AtomicBoolean call = new AtomicBoolean();
        MockCommandEmulator.callback(new MockCommandEmulator.Callback() {
            @Override
            public void run(List<String> args) throws IOException, InterruptedException {
View Full Code Here

Examples of java.io.File.canExecute()

                File bin = new File(p);
                if (bin.isDirectory() == false) {
                    continue;
                }
                File command = new File(bin, PATH_HADOOP_COMMAND_FILE);
                if (command.canExecute()) {
                    return command;
                }
            }
        }
        return null;
View Full Code Here

Examples of java.io.File.canExecute()

        Map<String, String> envp = new HashMap<String, String>();
        envp.put("HADOOP_HOME", folder.getRoot().getAbsolutePath());

        File file = ConfigurationProvider.findHadoopCommand(envp);
        assertThat(file, is(notNullValue()));
        assertThat(file.toString(), file.canExecute(), is(true));
    }

    /**
     * search for hadoop command from PATH.
     */
 
View Full Code Here

Examples of java.io.File.canExecute()

        Map<String, String> envp = new HashMap<String, String>();
        envp.put("PATH", new File(folder.getRoot(), "bin").getAbsolutePath());

        File file = ConfigurationProvider.findHadoopCommand(envp);
        assertThat(file, is(notNullValue()));
        assertThat(file.toString(), file.canExecute(), is(true));
    }

    /**
     * search for hadoop command from HADOOP_HOME.
     */
 
View Full Code Here

Examples of java.io.File.canExecute()

        envp.put("HADOOP_HOME", new File(folder.getRoot(), "home").getAbsolutePath());
        envp.put("PATH", new File(folder.getRoot(), "path").getAbsolutePath());

        File file = ConfigurationProvider.findHadoopCommand(envp);
        assertThat(file, is(notNullValue()));
        assertThat(file.toString(), file.canExecute(), is(true));
        assertThat(file.toString(), file.getParentFile().getName(), is("bin"));
    }

    /**
     * search for hadoop command from PATH.
View Full Code Here

Examples of java.io.File.canExecute()

        Map<String, String> envp = new HashMap<String, String>();
        envp.put("PATH", buf.toString());

        File file = ConfigurationProvider.findHadoopCommand(envp);
        assertThat(file, is(notNullValue()));
        assertThat(file.toString(), file.canExecute(), is(true));
        assertThat(file.toString(), file.getParentFile().getName(), is("path2"));
    }

    /**
     * search for confdir from HADOOP_CONF.
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.