com.google.cloud.tools.appengine.configuration.DeployConfiguration Java Examples

The following examples show how to use com.google.cloud.tools.appengine.configuration.DeployConfiguration. 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: DeployAllTaskTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
/** Setup DeployAllTaskTest. */
@Before
public void setup() throws IOException {
  Project tempProject = ProjectBuilder.builder().build();
  deployExtension = new DeployExtension(tempProject);
  deployExtension.setDeployTargetResolver(deployTargetResolver);
  deployCapture = ArgumentCaptor.forClass(DeployConfiguration.class);
  stageDir = tempFolder.newFolder("staging");

  deployAllTask = tempProject.getTasks().create("tempDeployAllTask", DeployAllTask.class);
  deployAllTask.setDeployExtension(deployExtension);
  deployAllTask.setGcloud(gcloud);
  deployAllTask.setStageDirectory(stageDir);

  when(gcloud.newDeployment(Mockito.any(ProcessHandler.class))).thenReturn(deploy);
}
 
Example #2
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 #3
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 #4
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 #5
Source File: DeployPreferencesConverter.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
static DeployConfiguration toDeployConfiguration(DeployPreferences preferences,
    List<Path> deployables) {
  DeployConfiguration.Builder builder = DeployConfiguration.builder(deployables);

  builder.projectId(preferences.getProjectId());

  String bucketName = preferences.getBucket();
  if (!Strings.isNullOrEmpty(bucketName)) {
    if (bucketName.startsWith("gs://")) {
      builder.bucket(bucketName);
    } else {
      builder.bucket("gs://" + bucketName);
    }
  }

  builder.promote(preferences.isAutoPromote());
  if (preferences.isAutoPromote()) {
    builder.stopPreviousVersion(preferences.isStopPreviousVersion());
  }

  if (!Strings.isNullOrEmpty(preferences.getVersion())) {
    builder.version(preferences.getVersion());
  }

  return builder.build();
}
 
Example #6
Source File: DeployExtensionTest.java    From app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testToDeployConfiguration_onlyRequiredValuesSet() {
  DeployExtension testExtension = new DeployExtension(testProject);
  testExtension.setDeployTargetResolver(deployTargetResolver);

  testExtension.setProjectId("test-project-id");
  testExtension.setVersion("test-version");

  List<Path> projects = ImmutableList.of(Paths.get("project1"), Paths.get("project2"));
  DeployConfiguration config = testExtension.toDeployConfiguration(projects);

  Assert.assertEquals("processed-project-id", config.getProjectId());
  Assert.assertEquals("processed-version", config.getVersion());

  Assert.assertNull(config.getBucket());
  Assert.assertNull(config.getGcloudMode());
  Assert.assertNull(config.getImageUrl());
  Assert.assertNull(config.getPromote());
  Assert.assertNull(config.getServer());
  Assert.assertNull(config.getStopPreviousVersion());

  Mockito.verify(deployTargetResolver).getProject("test-project-id");
  Mockito.verify(deployTargetResolver).getVersion("test-version");
  Mockito.verifyNoMoreInteractions(deployTargetResolver);
}
 
Example #7
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 #8
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_versionIsEmpty() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_VERSION), anyString())).thenReturn("");
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertNull(configuration.getVersion());
}
 
Example #9
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_bucketNameContainsProtocol() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_BUCKET), anyString()))
      .thenReturn("gs://bucket");
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertThat(configuration.getBucket(), is("gs://bucket"));
}
 
Example #10
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_bucketNameDoesNotContainProtocol() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_BUCKET), anyString()))
      .thenReturn("bucket");
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertThat(configuration.getBucket(), is("gs://bucket"));
}
 
Example #11
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_promote() {
  when(preferences.getBoolean(eq(DeployPreferences.PREF_ENABLE_AUTO_PROMOTE), anyBoolean()))
      .thenReturn(true);
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  Boolean promote = configuration.getPromote();
  assertNotNull(promote);
  assertTrue(promote);
}
 
Example #12
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_promoteNotSetStopPreviousVersionIsUnset() {
  when(preferences.getBoolean(eq(DeployPreferences.PREF_STOP_PREVIOUS_VERSION), anyBoolean()))
      .thenReturn(true);
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertNull(configuration.getStopPreviousVersion());
}
 
Example #13
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_promoteSetStopPreviousVersionIsSet() {
  when(preferences.getBoolean(eq(DeployPreferences.PREF_ENABLE_AUTO_PROMOTE), anyBoolean()))
      .thenReturn(true);
  when(preferences.getBoolean(eq(DeployPreferences.PREF_STOP_PREVIOUS_VERSION), anyBoolean()))
      .thenReturn(true);
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  Boolean stopPreviousVersion = configuration.getStopPreviousVersion();
  assertNotNull(stopPreviousVersion);
  assertTrue(stopPreviousVersion);
}
 
Example #14
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_promoteSetStopPreviousVersionIsUnset() {
  when(preferences.getBoolean(eq(DeployPreferences.PREF_ENABLE_AUTO_PROMOTE), anyBoolean()))
      .thenReturn(true);
  when(preferences.getBoolean(eq(DeployPreferences.PREF_STOP_PREVIOUS_VERSION), anyBoolean()))
      .thenReturn(false);
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  Boolean stopPreviousVersion = configuration.getStopPreviousVersion();
  assertNotNull(stopPreviousVersion);
  assertFalse(stopPreviousVersion);
}
 
Example #15
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_version() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_VERSION), anyString()))
      .thenReturn("version");
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertThat(configuration.getVersion(), is("version"));
}
 
Example #16
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_versionIsNull() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_VERSION), anyString())).thenReturn(null);
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertNull(configuration.getVersion());
}
 
Example #17
Source File: AppDeployerTest.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testBuildDeployConfiguration() {
  AbstractDeployMojo deployMojo = Mockito.mock(AbstractDeployMojo.class);
  Mockito.when(deployMojo.getBucket()).thenReturn("testBucket");
  Mockito.when(deployMojo.getGcloudMode()).thenReturn("beta");
  Mockito.when(deployMojo.getImageUrl()).thenReturn("testImageUrl");
  Mockito.when(deployMojo.getProjectId()).thenReturn("testProjectId");
  Mockito.when(deployMojo.getPromote()).thenReturn(false);
  Mockito.when(deployMojo.getStopPreviousVersion()).thenReturn(false);
  Mockito.when(deployMojo.getServer()).thenReturn("testServer");
  Mockito.when(deployMojo.getVersion()).thenReturn("testVersion");

  ConfigProcessor configProcessor = Mockito.mock(ConfigProcessor.class);
  Mockito.when(configProcessor.processProjectId("testProjectId"))
      .thenReturn("processedTestProjectId");
  Mockito.when(configProcessor.processVersion("testVersion")).thenReturn("processedTestVersion");

  List<Path> deployables = ImmutableList.of(Paths.get("some/path"), Paths.get("some/other/path"));
  DeployConfiguration deployConfig =
      new ConfigBuilder(deployMojo, configProcessor).buildDeployConfiguration(deployables);

  Assert.assertEquals(deployables, deployConfig.getDeployables());
  Assert.assertEquals("beta", deployConfig.getGcloudMode());
  Assert.assertEquals("testBucket", deployConfig.getBucket());
  Assert.assertEquals("testImageUrl", deployConfig.getImageUrl());
  Assert.assertEquals("processedTestProjectId", deployConfig.getProjectId());
  Assert.assertEquals(Boolean.FALSE, deployConfig.getPromote());
  Assert.assertEquals(Boolean.FALSE, deployConfig.getStopPreviousVersion());
  Assert.assertEquals("testServer", deployConfig.getServer());
  Assert.assertEquals("processedTestVersion", deployConfig.getVersion());
}
 
Example #18
Source File: AppDeployer.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
/** Deploy a single application (and no project configuration). */
public void deploy() throws MojoExecutionException {
  stager.stage();

  DeployConfiguration config =
      configBuilder.buildDeployConfiguration(ImmutableList.of(deployMojo.getStagingDirectory()));

  try {
    deployMojo.getAppEngineFactory().deployment().deploy(config);
  } catch (AppEngineException ex) {
    throw new MojoExecutionException("App Engine application deployment failed", ex);
  }
}
 
Example #19
Source File: AppDeployer.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
/** Deploy a single application and any found yaml configuration files. */
public void deployAll() throws MojoExecutionException {
  stager.stage();
  ImmutableList.Builder<Path> computedDeployables = ImmutableList.builder();

  // Look for app.yaml
  Path appYaml = deployMojo.getStagingDirectory().resolve("app.yaml");
  if (!Files.exists(appYaml)) {
    throw new MojoExecutionException("Failed to deploy all: could not find app.yaml.");
  }
  deployMojo.getLog().info("deployAll: Preparing to deploy app.yaml");
  computedDeployables.add(appYaml);

  // Look for config yamls
  String[] configYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"};
  for (String yamlName : configYamls) {
    Path yaml = appengineDirectory.resolve(yamlName);
    if (Files.exists(yaml)) {
      deployMojo.getLog().info("deployAll: Preparing to deploy " + yamlName);
      computedDeployables.add(yaml);
    }
  }

  DeployConfiguration config =
      configBuilder.buildDeployConfiguration(computedDeployables.build());

  try {
    deployMojo.getAppEngineFactory().deployment().deploy(config);
  } catch (AppEngineException ex) {
    throw new MojoExecutionException("Failed to deploy", ex);
  }
}
 
Example #20
Source File: AppDeployer.java    From app-maven-plugin with Apache License 2.0 5 votes vote down vote up
DeployConfiguration buildDeployConfiguration(List<Path> deployables) {
  return DeployConfiguration.builder(deployables)
      .bucket(deployMojo.getBucket())
      .gcloudMode(deployMojo.getGcloudMode())
      .imageUrl(deployMojo.getImageUrl())
      .projectId(configProcessor.processProjectId(deployMojo.getProjectId()))
      .promote(deployMojo.getPromote())
      .server(deployMojo.getServer())
      .stopPreviousVersion(deployMojo.getStopPreviousVersion())
      .version(configProcessor.processVersion(deployMojo.getVersion()))
      .build();
}
 
Example #21
Source File: DeployAllTask.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
/** Task Entrypoint : Deploys the app and all of its config files. */
@TaskAction
public void deployAllAction() throws AppEngineException {
  List<Path> deployables = new ArrayList<>();

  // Look for app.yaml
  Path appYaml = stageDirectory.toPath().resolve("app.yaml");
  if (!Files.isRegularFile(appYaml)) {
    throw new GradleException("Failed to deploy all: app.yaml not found.");
  }
  addDeployable(deployables, appYaml);

  // Look for configuration yamls
  String[] validYamls = {"cron.yaml", "dispatch.yaml", "dos.yaml", "index.yaml", "queue.yaml"};
  for (String yamlName : validYamls) {
    Path yaml = deployExtension.getAppEngineDirectory().toPath().resolve(yamlName);
    if (Files.isRegularFile(yaml)) {
      addDeployable(deployables, yaml);
    }
  }

  // Deploy
  Deployment deploy = gcloud.newDeployment(CloudSdkOperations.getDefaultHandler(getLogger()));

  DeployConfiguration deployConfig = deployExtension.toDeployConfiguration(deployables);
  deploy.deploy(deployConfig);
}
 
Example #22
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_bucketNameIsEmpty() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_BUCKET), anyString())).thenReturn("");
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertNull(configuration.getBucket());
}
 
Example #23
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_bucketNameIsNull() {
  when(preferences.get(eq(DeployPreferences.PREF_CUSTOM_BUCKET), anyString())).thenReturn(null);
  DeployConfiguration configuration =
      DeployPreferencesConverter.toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertNull(configuration.getBucket());
}
 
Example #24
Source File: DeployPreferencesConverterTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_projectId() {
  when(preferences.get(eq(DeployPreferences.PREF_PROJECT_ID), anyString()))
      .thenReturn("projectid");
  DeployConfiguration configuration = DeployPreferencesConverter
      .toDeployConfiguration(new DeployPreferences(preferences), deployables);
  assertThat(configuration.getProjectId(), is("projectid"));
}
 
Example #25
Source File: AppEngineProjectDeployer.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
/**
 * @param optionalConfigurationFilesDirectory if not {@code null}, searches optional configuration
 *     files (such as {@code cron.yaml}) in this directory and deploys them together
 */
public IStatus deploy(IPath stagingDirectory, Path credentialFile,
    DeployPreferences deployPreferences, IPath optionalConfigurationFilesDirectory,
    MessageConsoleStream stdoutOutputStream, IProgressMonitor monitor) {
  if (monitor.isCanceled()) {
    throw new OperationCanceledException();
  }

  SubMonitor progress = SubMonitor.convert(monitor, 1);
  progress.setTaskName(Messages.getString("task.name.deploy.project")); //$NON-NLS-1$
  try {
    List<File> files =
        computeDeployables(stagingDirectory, optionalConfigurationFilesDirectory);
    List<Path> deployables = new ArrayList<>();
    for (File file : files) {
      deployables.add(file.toPath());
    }
    
    DeployConfiguration configuration =
        DeployPreferencesConverter.toDeployConfiguration(deployPreferences, deployables);
    try { 
      Deployment deployment =
          cloudSdkProcessWrapper.getAppEngineDeployment(credentialFile, stdoutOutputStream);
      deployment.deploy(configuration);
    } catch (AppEngineException ex) {
      return StatusUtil.error(this, "Error deploying project: " + ex.getMessage(), ex);
    }
    return cloudSdkProcessWrapper.getExitStatus();
  } finally {
    progress.worked(1);
  }
}
 
Example #26
Source File: DeploymentTest.java    From appengine-plugins-core with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeploy_multipleDeployables()
    throws AppEngineException, ProcessHandlerException, IOException {

  DeployConfiguration configuration =
      DeployConfiguration.builder(Arrays.asList(appYaml1, appYaml2)).build();

  deployment.deploy(configuration);

  List<String> expectedCommand =
      ImmutableList.of("app", "deploy", appYaml1.toString(), appYaml2.toString());

  verify(gcloudRunner, times(1)).run(eq(expectedCommand), isNull());
}
 
Example #27
Source File: DeployExtensionTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testToDeployConfiguration_allValuesSet() {
  DeployExtension testExtension = new DeployExtension(testProject);
  testExtension.setDeployTargetResolver(deployTargetResolver);

  testExtension.setBucket("test-bucket");
  testExtension.setGcloudMode("beta");
  testExtension.setImageUrl("test-img-url");
  testExtension.setProjectId("test-project-id");
  testExtension.setPromote(true);
  testExtension.setServer("test-server");
  testExtension.setStopPreviousVersion(true);
  testExtension.setVersion("test-version");

  List<Path> projects = ImmutableList.of(Paths.get("project1"), Paths.get("project2"));
  DeployConfiguration config = testExtension.toDeployConfiguration(projects);

  Assert.assertEquals(projects, config.getDeployables());
  Assert.assertEquals("test-bucket", config.getBucket());
  Assert.assertEquals("beta", config.getGcloudMode());
  Assert.assertEquals("test-img-url", config.getImageUrl());
  Assert.assertEquals("processed-project-id", config.getProjectId());
  Assert.assertEquals(Boolean.TRUE, config.getPromote());
  Assert.assertEquals("test-server", config.getServer());
  Assert.assertEquals(Boolean.TRUE, config.getStopPreviousVersion());
  Assert.assertEquals("processed-version", config.getVersion());

  Mockito.verify(deployTargetResolver).getProject("test-project-id");
  Mockito.verify(deployTargetResolver).getVersion("test-version");
  Mockito.verifyNoMoreInteractions(deployTargetResolver);
}
 
Example #28
Source File: DeployAllTaskTest.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void testDeployAllAction_validFileNotInDirStandard()
    throws AppEngineException, IOException {
  deployExtension.setAppEngineDirectory(stageDir);

  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 #29
Source File: DeployTask.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
/** Task Entrypoint : DeployExtension application (via app.yaml). */
@TaskAction
public void deployAction() throws AppEngineException {
  DeployConfiguration deployConfig =
      deployExtension.toDeployConfiguration(ImmutableList.of(appYaml));
  gcloud.newDeployment(CloudSdkOperations.getDefaultHandler(getLogger())).deploy(deployConfig);
}
 
Example #30
Source File: DeployExtension.java    From app-gradle-plugin with Apache License 2.0 5 votes vote down vote up
DeployConfiguration toDeployConfiguration(List<Path> deployables) {
  String processedProjectId = deployTargetResolver.getProject(projectId);
  String processedVersion = deployTargetResolver.getVersion(version);

  return DeployConfiguration.builder(deployables)
      .bucket(bucket)
      .gcloudMode(gcloudMode)
      .imageUrl(imageUrl)
      .projectId(processedProjectId)
      .promote(promote)
      .server(server)
      .stopPreviousVersion(stopPreviousVersion)
      .version(processedVersion)
      .build();
}