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

The following examples show how to use com.google.cloud.tools.managedcloudsdk.BadCloudSdkVersionException. 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: 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 #2
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 #3
Source File: FileResourceProviderFactoryTest.java    From appengine-plugins-core with Apache License 2.0 5 votes vote down vote up
@Test
public void testNewFileResourceProvider_versioned()
    throws MalformedURLException, BadCloudSdkVersionException {
  FileResourceProviderFactory factory =
      new FileResourceProviderFactory(new Version("123.123.123"), osInfo, fakeSdkHome);
  FileResourceProvider provider = factory.newFileResourceProvider();

  Assert.assertEquals(
      new URL(
          FileResourceProviderFactory.VERSIONED_BASE_URL
              + "google-cloud-sdk-123.123.123-"
              + versionedFilenameTail),
      provider.getArchiveSource());
  Assert.assertEquals(
      fakeDownloadsDir.resolve("google-cloud-sdk-123.123.123-" + versionedFilenameTail),
      provider.getArchiveDestination());
  Assert.assertEquals(
      fakeSdkHome.resolve("123.123.123"), provider.getArchiveExtractionDestination());
  Assert.assertEquals(
      fakeSdkHome.resolve("123.123.123").resolve("google-cloud-sdk"),
      provider.getExtractedSdkHome());
  Assert.assertEquals(
      fakeSdkHome
          .resolve("123.123.123")
          .resolve("google-cloud-sdk")
          .resolve("bin")
          .resolve(gcloudExecutable),
      provider.getExtractedGcloud());
}
 
Example #4
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 #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: 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());
}