com.google.cloud.tools.appengine.AppEngineException Java Examples

The following examples show how to use com.google.cloud.tools.appengine.AppEngineException. 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: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithJava8Runtime_Java8()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project =
      projectCreator.withFacets(JavaFacet.VERSION_1_8).getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
Example #2
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithNoRuntime_Java7_Web25()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator
      .withFacets(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25).getFacetedProject();
  createAppEngineWebWithNoRuntime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25,
      AppEngineStandardFacet.JRE7);
  assertNoJava8Runtime(project);
}
 
Example #3
Source File: AppYamlProjectStagingTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void testCopyDockerContext_runtimeNotJavaNoDockerfile() throws IOException {

  Files.delete(dockerFile);
  try {
    AppYamlProjectStaging.copyDockerContext(config, copyService, "custom");
    fail();
  } catch (AppEngineException ex) {
    assertEquals(
        "Docker directory " + config.getDockerDirectory() + " does not contain Dockerfile.",
        ex.getMessage());
  }

  List<LogRecord> logs = handler.getLogs();
  assertEquals(0, logs.size());

  verifyNoInteractions(copyService);
}
 
Example #4
Source File: Deployment.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
/**
 * Common configuration deployment function.
 *
 * @param filename Yaml file that we want to deploy (cron.yaml, dos.yaml, etc)
 * @param configuration Deployment configuration
 */
@VisibleForTesting
void deployConfig(String filename, DeployProjectConfigurationConfiguration configuration)
    throws AppEngineException {
  Preconditions.checkNotNull(configuration);
  Preconditions.checkNotNull(configuration.getAppEngineDirectory());

  Path deployable = configuration.getAppEngineDirectory().resolve(filename);
  Preconditions.checkArgument(
      Files.isRegularFile(deployable), deployable.toString() + " does not exist.");

  List<String> arguments = new ArrayList<>();
  arguments.add("app");
  arguments.add("deploy");
  arguments.add(deployable.toAbsolutePath().toString());
  arguments.addAll(GcloudArgs.get("server", configuration.getServer()));
  arguments.addAll(GcloudArgs.get("project", configuration.getProjectId()));

  try {
    runner.run(arguments, null);
  } catch (ProcessHandlerException | IOException ex) {
    throw new AppEngineException(ex);
  }
}
 
Example #5
Source File: AppYamlProjectStaging.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
static void copyExtraFiles(AppYamlProjectStageConfiguration config, CopyService copyService)
    throws IOException, AppEngineException {
  List<Path> extraFilesDirectories = config.getExtraFilesDirectory();
  if (extraFilesDirectories == null) {
    return;
  }
  for (Path extraFilesDirectory : extraFilesDirectories) {
    if (!Files.exists(extraFilesDirectory)) {
      throw new AppEngineException(
          "Extra files directory does not exist. Location: " + extraFilesDirectory);
    }
    if (!Files.isDirectory(extraFilesDirectory)) {
      throw new AppEngineException(
          "Extra files location is not a directory. Location: " + extraFilesDirectory);
    }
    Path stagingDirectory = config.getStagingDirectory();
    copyService.copyDirectory(extraFilesDirectory, stagingDirectory);
  }
}
 
Example #6
Source File: StopMojoTest.java    From app-maven-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testStop() throws MojoExecutionException, AppEngineException {

  // wire up
  stopMojo.host = "host";
  stopMojo.port = 124;

  // invoke
  stopMojo.execute();

  // verify
  ArgumentCaptor<StopConfiguration> captor = ArgumentCaptor.forClass(StopConfiguration.class);
  verify(devServerMock).stop(captor.capture());

  Assert.assertEquals("host", captor.getValue().getHost());
  Assert.assertEquals(Integer.valueOf(124), captor.getValue().getPort());
}
 
Example #7
Source File: VersionsTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void stopTest() throws ProcessHandlerException, AppEngineException, IOException {
  Versions appEngineVersion = new Versions(gcloudRunner);
  appEngineVersion.stop(getVersionConfig());

  List<String> args =
      Arrays.asList(
          "app",
          "versions",
          "stop",
          "v1",
          "v2",
          "--service",
          "myService",
          "--project",
          "myProject");

  verify(gcloudRunner, times(1)).run(eq(args), isNull());
}
 
Example #8
Source File: ModelRefreshTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * None of our {@link AppEngineResourceElement#reload()} currently return a different instance, so
 * a configuration file change should not result in a change.
 */
@Test
public void testChildElementPreservedOnChange() throws AppEngineException {
  List<IFile> files = new ArrayList<>();
  IProject project = projectCreator.getProject();
  files.add(ConfigurationFileUtils.createEmptyCronXml(project));
  files.add(ConfigurationFileUtils.createEmptyDatastoreIndexesXml(project));
  files.add(ConfigurationFileUtils.createEmptyDispatchXml(project));
  files.add(ConfigurationFileUtils.createEmptyDosXml(project));
  files.add(ConfigurationFileUtils.createEmptyQueueXml(project));

  AppEngineProjectElement projectElement = AppEngineProjectElement.create(project);
  files.add(projectElement.getDescriptorFile());
  AppEngineResourceElement[] subElements = projectElement.getConfigurations();

  for (IFile file : files) {
    boolean changed = projectElement.resourcesChanged(Collections.singleton(file));
    assertTrue(changed);
    AppEngineResourceElement[] newSubElements = projectElement.getConfigurations();
    Set<Object> difference =
        Sets.symmetricDifference(Sets.newHashSet(subElements), Sets.newHashSet(newSubElements));
    assertThat("all elements should have been preserved", difference, Matchers.hasSize(0));
  }
}
 
Example #9
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/** Verify that appengine-web.xml has <runtime>java8</runtime>. */
private void assertJava8Runtime(IFacetedProject project)
    throws IOException, SAXException, CoreException, AppEngineException {
  IFile appengineWebXml =
      AppEngineConfigurationUtil.findConfigurationFile(
          project.getProject(), new Path("appengine-web.xml"));
  assertNotNull("appengine-web.xml is missing", appengineWebXml);
  assertTrue("appengine-web.xml does not exist", appengineWebXml.exists());
  try (InputStream contents = appengineWebXml.getContents()) {
    String appEngineWebContent =
        CharStreams.toString(new InputStreamReader(contents, StandardCharsets.UTF_8));
    if (originalAppEngineWebContent != null) {
      assertEquals("appengine-web.xml was changed", originalAppEngineWebContent,
          appEngineWebContent);
    }
    AppEngineDescriptor descriptor = AppEngineDescriptor
        .parse(new ByteArrayInputStream(appEngineWebContent.getBytes(StandardCharsets.UTF_8)));
    assertTrue("should have <runtime>java8</runtime>", descriptor.isJava8());
  }
}
 
Example #10
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithJava8Runtime_Java7()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project =
      projectCreator.withFacets(JavaFacet.VERSION_1_7).getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
Example #11
Source File: DeployAllTaskTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeployAllAction_validFileNotInDirAppYaml()
    throws AppEngineException, IOException {
  deployExtension.setAppEngineDirectory(tempFolder.newFolder("appengine"));

  // Make YAMLS
  final Path appYaml = tempFolder.newFile("staging/app.yaml").toPath();
  final Path validInDifferentDirYaml = tempFolder.newFile("queue.yaml").toPath();

  deployAllTask.deployAllAction();

  verify(deploy).deploy(deployCapture.capture());
  DeployConfiguration captured = deployCapture.getValue();
  assertTrue(captured.getDeployables().contains(appYaml));
  assertFalse(captured.getDeployables().contains(validInDifferentDirYaml));
}
 
Example #12
Source File: AppYamlProjectStagingTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void testStageArchive_java11StandardBinaryPath() throws IOException, AppEngineException {
  config =
      AppYamlProjectStageConfiguration.builder()
          .appEngineDirectory(appEngineDirectory)
          .artifact(temporaryFolder.newFile("myscript.sh").toPath())
          .stagingDirectory(stagingDirectory)
          .extraFilesDirectories(extraFilesDirectories)
          .build();

  Files.write(
      appEngineDirectory.resolve("app.yaml"),
      "runtime: java11\nentrypoint: anything\n".getBytes(StandardCharsets.UTF_8),
      StandardOpenOption.CREATE_NEW);

  // mock to watch internal calls
  AppYamlProjectStaging mock = mock(AppYamlProjectStaging.class);
  doCallRealMethod().when(mock).stageArchive(config);

  mock.stageArchive(config);
  verify(mock).stageStandardBinary(config);
}
 
Example #13
Source File: DeployAllTaskTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeployAllAction_appyaml() throws AppEngineException, IOException {
  deployExtension.setAppEngineDirectory(tempFolder.newFolder("appengine"));

  final Path appYaml = tempFolder.newFile("staging/app.yaml").toPath();
  final Path cronYaml = tempFolder.newFile("appengine/cron.yaml").toPath();
  final Path dispatchYaml = tempFolder.newFile("appengine/dispatch.yaml").toPath();
  final Path dosYaml = tempFolder.newFile("appengine/dos.yaml").toPath();
  final Path indexYaml = tempFolder.newFile("appengine/index.yaml").toPath();
  final Path queueYaml = tempFolder.newFile("appengine/queue.yaml").toPath();
  final Path invalidYaml = tempFolder.newFile("appengine/invalid.yaml").toPath();

  deployAllTask.deployAllAction();

  verify(deploy).deploy(deployCapture.capture());
  DeployConfiguration captured = deployCapture.getValue();
  assertTrue(captured.getDeployables().contains(appYaml));
  assertTrue(captured.getDeployables().contains(cronYaml));
  assertTrue(captured.getDeployables().contains(dispatchYaml));
  assertTrue(captured.getDeployables().contains(dosYaml));
  assertTrue(captured.getDeployables().contains(indexYaml));
  assertTrue(captured.getDeployables().contains(queueYaml));
  assertFalse(captured.getDeployables().contains(invalidYaml));
}
 
Example #14
Source File: DeployAllTaskTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeployAllAction_standard() throws AppEngineException, IOException {
  deployExtension.setAppEngineDirectory(stageDir);

  final Path appYaml = tempFolder.newFile("staging/app.yaml").toPath();
  final Path cronYaml = tempFolder.newFile("staging/cron.yaml").toPath();
  final Path dispatchYaml = tempFolder.newFile("staging/dispatch.yaml").toPath();
  final Path dosYaml = tempFolder.newFile("staging/dos.yaml").toPath();
  final Path indexYaml = tempFolder.newFile("staging/index.yaml").toPath();
  final Path queueYaml = tempFolder.newFile("staging/queue.yaml").toPath();
  final Path invalidYaml = tempFolder.newFile("staging/invalid.yaml").toPath();

  deployAllTask.deployAllAction();

  verify(deploy).deploy(deployCapture.capture());
  DeployConfiguration captured = deployCapture.getValue();
  assertTrue(captured.getDeployables().contains(appYaml));
  assertTrue(captured.getDeployables().contains(cronYaml));
  assertTrue(captured.getDeployables().contains(dispatchYaml));
  assertTrue(captured.getDeployables().contains(dosYaml));
  assertTrue(captured.getDeployables().contains(indexYaml));
  assertTrue(captured.getDeployables().contains(queueYaml));
  assertFalse(captured.getDeployables().contains(invalidYaml));
}
 
Example #15
Source File: FlexStagingDelegate.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public IStatus stage(IPath stagingDirectory, IPath safeWorkDirectory,
    MessageConsoleStream stdoutOutputStream, MessageConsoleStream stderrOutputStream,
    IProgressMonitor monitor) {
  SubMonitor subMonitor = SubMonitor.convert(monitor, 100);

  boolean result = stagingDirectory.toFile().mkdirs();
  if (!result) {
    return StatusUtil.error(this, "Could not create staging directory " + stagingDirectory);
  }

  try {
    IPath deployArtifact = getDeployArtifact(safeWorkDirectory, subMonitor.newChild(40));
    CloudSdkStagingHelper.stageFlexible(appEngineDirectory, deployArtifact, stagingDirectory,
        subMonitor.newChild(60));
    return Status.OK_STATUS;
  } catch (AppEngineException | CoreException ex) {
    return StatusUtil.error(this, Messages.getString("deploy.job.staging.failed"), ex);
  } finally {
    subMonitor.done();
  }
}
 
Example #16
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithJava8Runtime_Java7_Web25()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator
      .withFacets(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25).getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
Example #17
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithNoRuntime_Java7()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project =
      projectCreator.withFacets(JavaFacet.VERSION_1_7).getFacetedProject();
  createAppEngineWebWithNoRuntime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25,
      AppEngineStandardFacet.JRE7);
  assertNoJava8Runtime(project);
}
 
Example #18
Source File: DevServerTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void testPrepareCommand_noFlagsJava7()
    throws AppEngineException, ProcessHandlerException, IOException {

  RunConfiguration configuration =
      RunConfiguration.builder(ImmutableList.of(java7Service)).build();

  List<String> expectedFlags =
      ImmutableList.of(
          "--allow_remote_shutdown", "--disable_update_check", java7Service.toString());
  List<String> expectedJvmArgs =
      ImmutableList.of(
          "-javaagent:"
              + fakeJavaSdkHome.resolve("agent/appengine-agent.jar").toAbsolutePath().toString());

  devServer.run(configuration);

  verify(devAppServerRunner, times(1))
      .run(
          expectedJvmArgs,
          expectedFlags,
          expectedJava7Environment,
          java7Service /* workingDirectory */);
}
 
Example #19
Source File: LocalAppEngineServerBehaviour.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the development server.
 *
 * @param mode the launch mode (see ILaunchManager.*_MODE constants)
 */
void startDevServer(String mode, RunConfiguration devServerRunConfiguration,
    Path javaHomePath, MessageConsoleStream outputStream, MessageConsoleStream errorStream)
    throws CoreException, CloudSdkNotFoundException {

  BiPredicate<InetAddress, Integer> portInUse = (addr, port) -> {
    Preconditions.checkArgument(port >= 0, "invalid port");
    return SocketUtil.isPortInUse(addr, port);
  };

  checkPorts(devServerRunConfiguration, portInUse);

  setServerState(IServer.STATE_STARTING);
  setMode(mode);

  // Create dev app server instance
  initializeDevServer(outputStream, errorStream, javaHomePath);

  // Run server
  try {
    devServer.run(devServerRunConfiguration);
  } catch (AppEngineException ex) {
    Activator.logError("Error starting server: " + ex.getMessage()); //$NON-NLS-1$
    stop(true);
  }
}
 
Example #20
Source File: AppYamlProjectStagingTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void testCopyExtraFiles_directoryIsActuallyAFile() throws IOException {
  Path extraFilesDirectory = temporaryFolder.newFile().toPath();
  assertTrue(Files.isRegularFile(extraFilesDirectory));

  AppYamlProjectStageConfiguration badExtraFilesConfig =
      AppYamlProjectStageConfiguration.builder()
          .appEngineDirectory(appEngineDirectory)
          .artifact(artifact)
          .stagingDirectory(stagingDirectory)
          .extraFilesDirectories(ImmutableList.of(extraFilesDirectory))
          .build();

  try {
    AppYamlProjectStaging.copyExtraFiles(badExtraFilesConfig, copyService);
    fail();
  } catch (AppEngineException ex) {
    assertEquals(
        "Extra files location is not a directory. Location: " + extraFilesDirectory,
        ex.getMessage());
  }
}
 
Example #21
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void appEngineWebWithNoRuntime_Java8_Web31()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator
      .withFacets(JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31).getFacetedProject();
  createAppEngineWebWithNoRuntime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25,
      AppEngineStandardFacet.JRE7);
  assertNoJava8Runtime(project);
}
 
Example #22
Source File: DeploymentTest.java    From appengine-plugins-core with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeploy_booleanFlags()
    throws AppEngineException, ProcessHandlerException, IOException {
  DeployConfiguration configuration =
      DeployConfiguration.builder(Collections.singletonList(appYaml1))
          .promote(false)
          .stopPreviousVersion(false)
          .build();

  deployment.deploy(configuration);

  List<String> expectedCommand =
      ImmutableList.of(
          "app", "deploy", appYaml1.toString(), "--no-promote", "--no-stop-previous-version");

  verify(gcloudRunner, times(1)).run(eq(expectedCommand), isNull());
}
 
Example #23
Source File: AppEngineContentProviderTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetChildren_appEngineStandardProjectElement_default_denialOfService()
    throws AppEngineException {
  ConfigurationFileUtils.createAppEngineWebXml(
      projectCreator.getProject(), "default"); // $NON-NLS-1$
  ConfigurationFileUtils.createEmptyDosXml(projectCreator.getProject());
  AppEngineProjectElement projectElement =
      AppEngineProjectElement.create(projectCreator.getProject());

  Object[] children = fixture.getChildren(projectElement);
  assertNotNull(children);
  assertEquals(1, children.length);
  assertTrue(children[0] instanceof DenialOfServiceDescriptor);

  Object[] grandchildren = fixture.getChildren(children[0]);
  assertNotNull(grandchildren);
  assertEquals("should have no grandchildren", 0, grandchildren.length);
}
 
Example #24
Source File: AppYamlProjectStaging.java    From appengine-plugins-core with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void stageStandardBinary(AppYamlProjectStageConfiguration config)
    throws IOException, AppEngineException {
  CopyService copyService = new CopyService();
  copyExtraFiles(config, copyService);
  copyAppEngineContext(config, copyService);
  copyArtifact(config, copyService);
}
 
Example #25
Source File: AppYamlProjectStaging.java    From appengine-plugins-core with Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
void stageStandardArchive(AppYamlProjectStageConfiguration config)
    throws IOException, AppEngineException {
  CopyService copyService = new CopyService();
  copyExtraFiles(config, copyService);
  copyAppEngineContext(config, copyService);
  copyArtifact(config, copyService);
  copyArtifactJarClasspath(config, copyService);
}
 
Example #26
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void bare_Java8_Web31()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator
      .withFacets(JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31).getFacetedProject();
  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  // ensure facet versions haven't been downgraded
  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
Example #27
Source File: LegacyProcessHandler.java    From appengine-plugins-core with Apache License 2.0 5 votes vote down vote up
@Override
public void handleProcess(Process process) throws ProcessHandlerException {
  Thread stdOutHandler = null;
  Thread stdErrHandler = null;
  try {

    // Only handle stdout or stderr if there are listeners.
    if (!stdOutLineListeners.isEmpty()) {
      stdOutHandler = handleStdOut(process);
    }
    if (!stdErrLineListeners.isEmpty()) {
      stdErrHandler = handleErrOut(process);
    }

    for (ProcessStartListener startListener : startListeners) {
      startListener.onStart(process);
    }

    if (async) {
      asyncRun(process, stdOutHandler, stdErrHandler);
    } else {
      shutdownProcessHook(process);
      syncRun(process, stdOutHandler, stdErrHandler);
    }

  } catch (InterruptedException | AppEngineException ex) {
    throw new ProcessHandlerException(ex);
  }
}
 
Example #28
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void appEngineWebWithJava8Runtime()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator.getFacetedProject();
  createAppEngineWebWithJava8Runtime(project);

  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}
 
Example #29
Source File: AppEngineProjectElementTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testEnvironmentRuntime_xml_java8Runtime() throws CoreException, AppEngineException {
  IProject project = projectCreator.getProject();
  String contents =
      "<appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>"
          + "<runtime>java8</runtime>"
          + "</appengine-web-app>";
  AppEngineConfigurationUtil.createConfigurationFile(
      project, new Path("appengine-web.xml"), contents, true, null);

  AppEngineProjectElement projectElement = AppEngineProjectElement.create(project);
  assertNotNull(projectElement);
  assertEquals("standard", projectElement.getEnvironmentType());
  assertEquals("java8", projectElement.getRuntime());
}
 
Example #30
Source File: ConversionTests.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void bare_Java7_Web31()
    throws CoreException, IOException, InterruptedException, SAXException, AppEngineException {
  IFacetedProject project = projectCreator
      .withFacets(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_31).getFacetedProject();
  Job conversionJob = new AppEngineStandardProjectConvertJob(project);
  conversionJob.schedule();
  conversionJob.join();
  assertIsOk("conversion should never fail", conversionJob.getResult());

  // ensure that java facet upgraded, and web facet versions not downgraded
  assertFacetVersions(project, JavaFacet.VERSION_1_8, WebFacetUtils.WEB_31,
      AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8);
  assertJava8Runtime(project);
}