Package org.zeroturnaround.exec

Examples of org.zeroturnaround.exec.ProcessExecutor


    System.exit(0);
  }

  public void run() {
    try {
      new ProcessExecutor("java", "-cp", "target/test-classes", WriterLoop.class.getName()).destroyOnExit().start();
      Thread.sleep(SLEEP_AFTER_START);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here


public class WriterLoopStarterBeforeExit {

  private static final long SLEEP_AFTER_START = 2000;

  public static void main(String[] args) throws Exception {
    new ProcessExecutor("java", "-cp", "target/test-classes", WriterLoop.class.getName()).destroyOnExit().start();
    Thread.sleep(SLEEP_AFTER_START);
    // Cause the launched process to be destroyed
    System.exit(0);
  }
View Full Code Here

  private void testDestroyOnExit(Class<?> starter, boolean fileIsAlwaysCreated) throws Exception {
    File file = WriterLoop.getFile();
    if (file.exists())
      FileUtils.forceDelete(file);
    new ProcessExecutor("java", "-cp", SystemUtils.JAVA_CLASS_PATH, starter.getName()).redirectOutputAsInfo().execute();
    // After WriterLoopStarter has finished we expect that WriterLoop is also finished - no-one is updating the file
    if (fileIsAlwaysCreated || file.exists()) {
      checkFileStaysTheSame(file);
      FileUtils.forceDelete(file);
    }
View Full Code Here

                runAssertionCheckScript());
    }

    private int runAssertionCheckScript() throws Exception {
        assertTrue(wordAssertScript.exists());
        return new ProcessExecutor()
                .command(Arrays.asList("cmd", "/C", String.format("\"%s\"", wordAssertScript.getAbsolutePath())))
                .redirectOutput(Slf4jStream.of(LOGGER).asInfo())
                .redirectError(Slf4jStream.of(LOGGER).asInfo())
                .timeout(1L, TimeUnit.MINUTES)
                .exitValueAny()
View Full Code Here

                .getExitValue();
    }

    public void kill() throws Exception {
        assertTrue(wordShutdownScript.exists());
        new ProcessExecutor()
                .command(Arrays.asList("cmd", "/C", String.format("\"%s\"", wordShutdownScript.getAbsolutePath())))
                .redirectOutput(Slf4jStream.of(LOGGER).asInfo())
                .redirectError(Slf4jStream.of(LOGGER).asInfo())
                .timeout(1L, TimeUnit.MINUTES)
                .exitValueAny()
View Full Code Here

                download(new URL("http://media.mongodb.org/zips.json"), file);
            }
        }
        DBCollection zips = getDb().getCollection("zips");
        if (zips.count() == 0) {
            new ProcessExecutor().command(MONGO_IMPORT,
                                          "--db", getDb().getName(),
                                          "--collection", "zipcodes",
                                          "--file", file.getAbsolutePath())
                                 .redirectError(System.err)
                                 .execute();
View Full Code Here

TOP

Related Classes of org.zeroturnaround.exec.ProcessExecutor

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.