@Test public void testDeployFunctionCommandLine() { DeployFunction mojo = new DeployFunction(); mojo.envVarsFile = "myfile"; mojo.functionTarget = "function"; mojo.ignoreFile = "ff"; mojo.maxInstances = new Integer(3); mojo.memory = "234"; mojo.name = "a name"; mojo.region = "a region"; mojo.retry = "44"; mojo.source = "a source"; mojo.stageBucket = "a bucket"; mojo.timeout = "timeout"; mojo.vpcConnector = "a connector"; mojo.triggerHttp = true; mojo.allowUnauthenticated = true; mojo.environmentVariables = ImmutableMap.of("env1", "a", "env2", "b"); List<String> expected = ImmutableList.of( "functions", "deploy", "a name", "--region=a region", "--trigger-http", "--allow-unauthenticated", "--entry-point=function", "--ignore-file=ff", "--memory=234", "--retry=44", "--source=a source", "--stage-bucket=a bucket", "--timeout=timeout", "--vpc-connector=a connector", "--max-instances=3", "--set-env-vars=env1=a,env2=b", "--env-vars-file=myfile", "--runtime=java11"); assertThat(mojo.getCommands()).isEqualTo(expected); }
public List<String> getCommands() { List<String> commands = new ArrayList<>(); commands.add("functions"); commands.add("deploy"); commands.add(name); if (region != null) { commands.add("--region=" + region); } if (triggerResource == null && triggerTopic == null && triggerEvent == null) { commands.add("--trigger-http"); } if (triggerResource != null) { commands.add("--trigger-resource=" + triggerResource); } if (triggerTopic != null) { commands.add("--trigger-topic=" + triggerTopic); } if (triggerEvent != null) { commands.add("--trigger-event=" + triggerEvent); } if (allowUnauthenticated) { commands.add("--allow-unauthenticated"); } if (functionTarget != null) { commands.add("--entry-point=" + functionTarget); } if (ignoreFile != null) { commands.add("--ignore-file=" + ignoreFile); } if (memory != null) { commands.add("--memory=" + memory); } if (retry != null) { commands.add("--retry=" + retry); } if (serviceAccount != null) { commands.add("--service-account=" + serviceAccount); } if (source != null) { commands.add("--source=" + source); } if (stageBucket != null) { commands.add("--stage-bucket=" + stageBucket); } if (timeout != null) { commands.add("--timeout=" + timeout); } if (updateLabels != null && !updateLabels.isEmpty()) { commands.add("--update-labels=" + String.join(",", updateLabels)); } if (vpcConnector != null) { commands.add("--vpc-connector=" + vpcConnector); } if (maxInstances != null) { commands.add("--max-instances=" + maxInstances); } if (hasEnvVariables()) { Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); commands.add("--set-env-vars=" + mapJoiner.join(environmentVariables)); } if (envVarsFile != null) { commands.add("--env-vars-file=" + envVarsFile); } commands.add("--runtime=" + runtime); if (projectId != null) { commands.add("--project=" + projectId); } return Collections.unmodifiableList(commands); }
DeployFunction extends CloudSdkMojo { public List<String> getCommands() { List<String> commands = new ArrayList<>(); commands.add("functions"); commands.add("deploy"); commands.add(name); if (region != null) { commands.add("--region=" + region); } if (triggerResource == null && triggerTopic == null && triggerEvent == null) { commands.add("--trigger-http"); } if (triggerResource != null) { commands.add("--trigger-resource=" + triggerResource); } if (triggerTopic != null) { commands.add("--trigger-topic=" + triggerTopic); } if (triggerEvent != null) { commands.add("--trigger-event=" + triggerEvent); } if (allowUnauthenticated) { commands.add("--allow-unauthenticated"); } if (functionTarget != null) { commands.add("--entry-point=" + functionTarget); } if (ignoreFile != null) { commands.add("--ignore-file=" + ignoreFile); } if (memory != null) { commands.add("--memory=" + memory); } if (retry != null) { commands.add("--retry=" + retry); } if (serviceAccount != null) { commands.add("--service-account=" + serviceAccount); } if (source != null) { commands.add("--source=" + source); } if (stageBucket != null) { commands.add("--stage-bucket=" + stageBucket); } if (timeout != null) { commands.add("--timeout=" + timeout); } if (updateLabels != null && !updateLabels.isEmpty()) { commands.add("--update-labels=" + String.join(",", updateLabels)); } if (vpcConnector != null) { commands.add("--vpc-connector=" + vpcConnector); } if (maxInstances != null) { commands.add("--max-instances=" + maxInstances); } if (hasEnvVariables()) { Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); commands.add("--set-env-vars=" + mapJoiner.join(environmentVariables)); } if (envVarsFile != null) { commands.add("--env-vars-file=" + envVarsFile); } commands.add("--runtime=" + runtime); if (projectId != null) { commands.add("--project=" + projectId); } return Collections.unmodifiableList(commands); } }
DeployFunction extends CloudSdkMojo { public List<String> getCommands() { List<String> commands = new ArrayList<>(); commands.add("functions"); commands.add("deploy"); commands.add(name); if (region != null) { commands.add("--region=" + region); } if (triggerResource == null && triggerTopic == null && triggerEvent == null) { commands.add("--trigger-http"); } if (triggerResource != null) { commands.add("--trigger-resource=" + triggerResource); } if (triggerTopic != null) { commands.add("--trigger-topic=" + triggerTopic); } if (triggerEvent != null) { commands.add("--trigger-event=" + triggerEvent); } if (allowUnauthenticated) { commands.add("--allow-unauthenticated"); } if (functionTarget != null) { commands.add("--entry-point=" + functionTarget); } if (ignoreFile != null) { commands.add("--ignore-file=" + ignoreFile); } if (memory != null) { commands.add("--memory=" + memory); } if (retry != null) { commands.add("--retry=" + retry); } if (serviceAccount != null) { commands.add("--service-account=" + serviceAccount); } if (source != null) { commands.add("--source=" + source); } if (stageBucket != null) { commands.add("--stage-bucket=" + stageBucket); } if (timeout != null) { commands.add("--timeout=" + timeout); } if (updateLabels != null && !updateLabels.isEmpty()) { commands.add("--update-labels=" + String.join(",", updateLabels)); } if (vpcConnector != null) { commands.add("--vpc-connector=" + vpcConnector); } if (maxInstances != null) { commands.add("--max-instances=" + maxInstances); } if (hasEnvVariables()) { Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); commands.add("--set-env-vars=" + mapJoiner.join(environmentVariables)); } if (envVarsFile != null) { commands.add("--env-vars-file=" + envVarsFile); } commands.add("--runtime=" + runtime); if (projectId != null) { commands.add("--project=" + projectId); } return Collections.unmodifiableList(commands); }  }
DeployFunction extends CloudSdkMojo { public List<String> getCommands() { List<String> commands = new ArrayList<>(); commands.add("functions"); commands.add("deploy"); commands.add(name); if (region != null) { commands.add("--region=" + region); } if (triggerResource == null && triggerTopic == null && triggerEvent == null) { commands.add("--trigger-http"); } if (triggerResource != null) { commands.add("--trigger-resource=" + triggerResource); } if (triggerTopic != null) { commands.add("--trigger-topic=" + triggerTopic); } if (triggerEvent != null) { commands.add("--trigger-event=" + triggerEvent); } if (allowUnauthenticated) { commands.add("--allow-unauthenticated"); } if (functionTarget != null) { commands.add("--entry-point=" + functionTarget); } if (ignoreFile != null) { commands.add("--ignore-file=" + ignoreFile); } if (memory != null) { commands.add("--memory=" + memory); } if (retry != null) { commands.add("--retry=" + retry); } if (serviceAccount != null) { commands.add("--service-account=" + serviceAccount); } if (source != null) { commands.add("--source=" + source); } if (stageBucket != null) { commands.add("--stage-bucket=" + stageBucket); } if (timeout != null) { commands.add("--timeout=" + timeout); } if (updateLabels != null && !updateLabels.isEmpty()) { commands.add("--update-labels=" + String.join(",", updateLabels)); } if (vpcConnector != null) { commands.add("--vpc-connector=" + vpcConnector); } if (maxInstances != null) { commands.add("--max-instances=" + maxInstances); } if (hasEnvVariables()) { Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); commands.add("--set-env-vars=" + mapJoiner.join(environmentVariables)); } if (envVarsFile != null) { commands.add("--env-vars-file=" + envVarsFile); } commands.add("--runtime=" + runtime); if (projectId != null) { commands.add("--project=" + projectId); } return Collections.unmodifiableList(commands); }  Gcloud getGcloud(); List<String> getCommands(); @Override void execute(); }
DeployFunction extends CloudSdkMojo { public List<String> getCommands() { List<String> commands = new ArrayList<>(); commands.add("functions"); commands.add("deploy"); commands.add(name); if (region != null) { commands.add("--region=" + region); } if (triggerResource == null && triggerTopic == null && triggerEvent == null) { commands.add("--trigger-http"); } if (triggerResource != null) { commands.add("--trigger-resource=" + triggerResource); } if (triggerTopic != null) { commands.add("--trigger-topic=" + triggerTopic); } if (triggerEvent != null) { commands.add("--trigger-event=" + triggerEvent); } if (allowUnauthenticated) { commands.add("--allow-unauthenticated"); } if (functionTarget != null) { commands.add("--entry-point=" + functionTarget); } if (ignoreFile != null) { commands.add("--ignore-file=" + ignoreFile); } if (memory != null) { commands.add("--memory=" + memory); } if (retry != null) { commands.add("--retry=" + retry); } if (serviceAccount != null) { commands.add("--service-account=" + serviceAccount); } if (source != null) { commands.add("--source=" + source); } if (stageBucket != null) { commands.add("--stage-bucket=" + stageBucket); } if (timeout != null) { commands.add("--timeout=" + timeout); } if (updateLabels != null && !updateLabels.isEmpty()) { commands.add("--update-labels=" + String.join(",", updateLabels)); } if (vpcConnector != null) { commands.add("--vpc-connector=" + vpcConnector); } if (maxInstances != null) { commands.add("--max-instances=" + maxInstances); } if (hasEnvVariables()) { Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); commands.add("--set-env-vars=" + mapJoiner.join(environmentVariables)); } if (envVarsFile != null) { commands.add("--env-vars-file=" + envVarsFile); } commands.add("--runtime=" + runtime); if (projectId != null) { commands.add("--project=" + projectId); } return Collections.unmodifiableList(commands); }  Gcloud getGcloud(); List<String> getCommands(); @Override void execute();  }