com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessOutputLineListener Java Examples

The following examples show how to use com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessOutputLineListener. 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: CloudSdkAppEngineFactory.java    From app-maven-plugin with Apache License 2.0 6 votes vote down vote up
private ProcessHandler newDevAppServerAsyncHandler(int timeout) {
  Path logDir =
      Paths.get(mojo.getMavenProject().getBuild().getDirectory()).resolve("dev-appserver-out");
  if (!Files.exists(logDir)) {
    try {
      logDir = Files.createDirectories(logDir);
    } catch (IOException e) {
      throw new RuntimeException("Failed to create dev-appserver logging directory.");
    }
  }
  File logFile = logDir.resolve("dev_appserver.out").toFile();
  FileOutputLineListener fileListener = new FileOutputLineListener(logFile);
  mojo.getLog().info("Dev App Server output written to : " + logFile);

  ProcessOutputLineListener lineListener = new DefaultProcessOutputLineListener(mojo.getLog());

  return LegacyProcessHandler.builder()
      .addStdOutLineListener(lineListener)
      .addStdOutLineListener(fileListener)
      .addStdErrLineListener(lineListener)
      .addStdErrLineListener(fileListener)
      .setExitListener(new NonZeroExceptionExitListener())
      .buildDevAppServerAsync(timeout);
}
 
Example #2
Source File: CloudSdkAppEngineFactory.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
private ProcessHandler newDefaultProcessHandler() {
  ProcessOutputLineListener lineListener = new DefaultProcessOutputLineListener(mojo.getLog());
  return LegacyProcessHandler.builder()
      .addStdOutLineListener(lineListener)
      .addStdErrLineListener(lineListener)
      .setExitListener(new NonZeroExceptionExitListener())
      .build();
}
 
Example #3
Source File: LocalAppEngineServerBehaviourTest.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
private void simulateOutputParsing(String[] output) {
  ProcessOutputLineListener outputListener = serverBehavior.new DevAppServerOutputListener();
  for (String line : output) {
    outputListener.onOutputLine(line);
  }
}