com.google.cloud.tools.managedcloudsdk.UnsupportedOsException Java Examples

The following examples show how to use com.google.cloud.tools.managedcloudsdk.UnsupportedOsException. 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: AppEngineAppYamlPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeploy()
    throws CloudSdkNotFoundException, IOException, ProcessHandlerException,
        UnsupportedOsException {

  BuildResult buildResult =
      GradleRunner.create()
          .withProjectDir(testProjectDir.getRoot())
          .withPluginClasspath()
          .withArguments("appengineDeploy")
          .build();

  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Deployed service [appyaml-project]"));

  deleteProject();
}
 
Example #2
Source File: AppEngineStandardPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeploy()
    throws CloudSdkNotFoundException, IOException, ProcessHandlerException,
        UnsupportedOsException {
  BuildResult buildResult =
      GradleRunner.create()
          .withProjectDir(testProjectDir.getRoot())
          .withPluginClasspath()
          .withArguments("appengineDeploy", "--stacktrace")
          .build();

  Assert.assertThat(
      buildResult.getOutput(),
      CoreMatchers.containsString("Deployed service [standard-project]"));

  deleteProject();
}
 
Example #3
Source File: CloudSdkPreferenceResolver.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public Path getCloudSdkPath() {
  // We only consult the Managed Cloud SDK when it has been explicitly configured, which
  // is done in CloudSdkPreferences.
  if (CloudSdkPreferences.isAutoManaging()) {
    try {
      // It is assumed that clients do not get and use "CloudSdk" while it is being modified.
      return ManagedCloudSdk.newManagedSdk().getSdkHome();
    } catch (UnsupportedOsException ex) {
      logger.log(Level.SEVERE, "Google Cloud SDK not available", ex); // $NON-NLS-1$
      return null;
    }
  }
  String value = preferences.getString(CloudSdkPreferences.CLOUD_SDK_PATH);
  if (!Strings.isNullOrEmpty(value)) {
    return Paths.get(value);
  }
  return null;
}
 
Example #4
Source File: AppEngineAppYamlPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployAll()
    throws CloudSdkNotFoundException, IOException, ProcessHandlerException,
        UnsupportedOsException {

  BuildResult buildResult =
      GradleRunner.create()
          .withProjectDir(testProjectDir.getRoot())
          .withPluginClasspath()
          .withArguments("appengineDeployAll")
          .build();

  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Deployed service [appyaml-project]"));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Custom routings have been updated."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("DoS protection has been updated."));
  Assert.assertThat(
      buildResult.getOutput(),
      CoreMatchers.containsString("Indexes are being rebuilt. This may take a moment."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Cron jobs have been updated."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Task queues have been updated."));

  deleteProject();
}
 
Example #5
Source File: CloudSdkDownloaderTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testNewManagedSdk_specific()
    throws UnsupportedOsException, BadCloudSdkVersionException {
  ManagedCloudSdk sdk = CloudSdkDownloader.newManagedSdkFactory().apply("191.0.0");
  Assert.assertEquals(
      ManagedCloudSdk.newManagedSdk(new Version("191.0.0")).getSdkHome(), sdk.getSdkHome());
}
 
Example #6
Source File: CloudSdkDownloader.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
static Function<String, ManagedCloudSdk> newManagedSdkFactory() {
  return (version) -> {
    try {
      if (Strings.isNullOrEmpty(version)) {
        return ManagedCloudSdk.newManagedSdk();
      } else {
        return ManagedCloudSdk.newManagedSdk(new Version(version));
      }
    } catch (UnsupportedOsException | BadCloudSdkVersionException ex) {
      throw new RuntimeException(ex);
    }
  };
}
 
Example #7
Source File: CloudSdkUpdateJobTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private CloudSdkUpdateJob newCloudSdkUpdateJob() {
  return new CloudSdkUpdateJob(consoleStream, new ReentrantReadWriteLock()) {
    @Override
    protected ManagedCloudSdk getManagedCloudSdk() throws UnsupportedOsException {
      return managedCloudSdk;
    }
  };
}
 
Example #8
Source File: CloudSdkInstallJobTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private CloudSdkInstallJob newCloudSdkInstallJob() {
  return new CloudSdkInstallJob(consoleStream, new ReentrantReadWriteLock(), IStatus.WARNING) {
    @Override
    protected ManagedCloudSdk getManagedCloudSdk() throws UnsupportedOsException {
      return managedCloudSdk;
    }
  };
}
 
Example #9
Source File: ManagedCloudSdkFactoryTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testNewManagedSdk_specific()
    throws UnsupportedOsException, BadCloudSdkVersionException {
  ManagedCloudSdk sdk = new ManagedCloudSdkFactory("191.0.0").newManagedSdk();
  Assert.assertEquals(
      ManagedCloudSdk.newManagedSdk(new Version("191.0.0")).getSdkHome(), sdk.getSdkHome());
}
 
Example #10
Source File: ManagedCloudSdkFactory.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
/** Build a new ManagedCloudSdk from a given version. */
public ManagedCloudSdk newManagedSdk()
    throws UnsupportedOsException, BadCloudSdkVersionException {
  if (Strings.isNullOrEmpty(version)) {
    return ManagedCloudSdk.newManagedSdk();
  } else {
    return ManagedCloudSdk.newManagedSdk(new Version(version));
  }
}
 
Example #11
Source File: AppEngineStandardPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
private static void deleteProject()
    throws UnsupportedOsException, CloudSdkNotFoundException, IOException,
        ProcessHandlerException {
  Path sdkHome = ManagedCloudSdk.newManagedSdk().getSdkHome();
  CloudSdk cloudSdk = new CloudSdk.Builder().sdkPath(sdkHome).build();
  Gcloud.builder(cloudSdk)
      .build()
      .runCommand(Arrays.asList("app", "services", "delete", "standard-project", "--quiet"));
}
 
Example #12
Source File: AppEngineStandardPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployAll()
    throws CloudSdkNotFoundException, UnsupportedOsException, IOException,
        ProcessHandlerException {
  BuildResult buildResult =
      GradleRunner.create()
          .withProjectDir(testProjectDir.getRoot())
          .withPluginClasspath()
          .withArguments("appengineDeployAll")
          .build();

  Assert.assertThat(
      buildResult.getOutput(),
      CoreMatchers.containsString("Deployed service [standard-project]"));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Custom routings have been updated."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("DoS protection has been updated."));
  Assert.assertThat(
      buildResult.getOutput(),
      CoreMatchers.containsString("Indexes are being rebuilt. This may take a moment."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Cron jobs have been updated."));
  Assert.assertThat(
      buildResult.getOutput(), CoreMatchers.containsString("Task queues have been updated."));

  deleteProject();
}
 
Example #13
Source File: AppEngineAppYamlPluginIntegrationTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
private static void deleteProject()
    throws UnsupportedOsException, CloudSdkNotFoundException, IOException,
        ProcessHandlerException {
  Path sdkHome = ManagedCloudSdk.newManagedSdk().getSdkHome();
  CloudSdk cloudSdk = new CloudSdk.Builder().sdkPath(sdkHome).build();
  Gcloud.builder(cloudSdk)
      .build()
      .runCommand(Arrays.asList("app", "services", "delete", "appyaml-project", "--quiet"));
}
 
Example #14
Source File: CloudSdkInstallJobTest.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetManagedCloudSdk() throws UnsupportedOsException {
  // Don't use "newCloudSdkInstallJob()", as it overrides "getManagedCloudSdk()".
  assertNotNull(new CloudSdkInstallJob(consoleStream, new ReentrantReadWriteLock())
      .getManagedCloudSdk());
}
 
Example #15
Source File: ManagedCloudSdkFactoryTest.java    From app-gradle-plugin with Apache License 2.0 4 votes vote down vote up
@Test
public void testNewManagedSdk_null() throws UnsupportedOsException, BadCloudSdkVersionException {
  // There's no way of testing for direct ManagedCloudSdk equality, so compare home paths
  ManagedCloudSdk sdk = new ManagedCloudSdkFactory(null).newManagedSdk();
  Assert.assertEquals(ManagedCloudSdk.newManagedSdk().getSdkHome(), sdk.getSdkHome());
}
 
Example #16
Source File: CloudSdkUpdateJobTest.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetManagedCloudSdk() throws UnsupportedOsException {
  assertNotNull(newCloudSdkUpdateJob().getManagedCloudSdk());
}
 
Example #17
Source File: CloudSdkModifyJob.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected ManagedCloudSdk getManagedCloudSdk() throws UnsupportedOsException {
  return ManagedCloudSdk.newManagedSdk();
}
 
Example #18
Source File: CloudSdkDownloaderTest.java    From app-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Test
public void testNewManagedSdk_null() throws UnsupportedOsException {
  // There's no way of testing for direct ManagedCloudSdk equality, so compare home paths
  ManagedCloudSdk sdk = CloudSdkDownloader.newManagedSdkFactory().apply(null);
  Assert.assertEquals(ManagedCloudSdk.newManagedSdk().getSdkHome(), sdk.getSdkHome());
}