|
27 | 27 | import com.google.api.gax.rpc.InvalidArgumentException;
|
28 | 28 | import com.google.api.gax.rpc.StatusCode;
|
29 | 29 | import com.google.cloudbuild.v1.Build;
|
| 30 | +import com.google.cloudbuild.v1.BuildName; |
30 | 31 | import com.google.cloudbuild.v1.BuildTrigger;
|
| 32 | +import com.google.cloudbuild.v1.BuildTriggerName; |
31 | 33 | import com.google.cloudbuild.v1.CancelBuildRequest;
|
32 | 34 | import com.google.cloudbuild.v1.CreateBuildRequest;
|
33 | 35 | import com.google.cloudbuild.v1.CreateBuildTriggerRequest;
|
|
46 | 48 | import com.google.cloudbuild.v1.RepoSource;
|
47 | 49 | import com.google.cloudbuild.v1.RetryBuildRequest;
|
48 | 50 | import com.google.cloudbuild.v1.RunBuildTriggerRequest;
|
| 51 | +import com.google.cloudbuild.v1.ServiceAccountName; |
49 | 52 | import com.google.cloudbuild.v1.UpdateBuildTriggerRequest;
|
50 | 53 | import com.google.cloudbuild.v1.UpdateWorkerPoolRequest;
|
51 | 54 | import com.google.cloudbuild.v1.WorkerPool;
|
@@ -200,20 +203,24 @@ public void deleteBuildTriggerExceptionTest() throws Exception {
|
200 | 203 | @Test
|
201 | 204 | @SuppressWarnings("all")
|
202 | 205 | public void createBuildTest() throws Exception {
|
| 206 | + BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]"); |
203 | 207 | String id = "id3355";
|
204 | 208 | String projectId2 = "projectId2939242356";
|
205 | 209 | String statusDetail = "statusDetail2089931070";
|
206 | 210 | String logsBucket = "logsBucket1565363834";
|
207 | 211 | String buildTriggerId = "buildTriggerId1105559411";
|
208 | 212 | String logUrl = "logUrl342054388";
|
| 213 | + ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]"); |
209 | 214 | Build expectedResponse =
|
210 | 215 | Build.newBuilder()
|
| 216 | + .setName(name.toString()) |
211 | 217 | .setId(id)
|
212 | 218 | .setProjectId(projectId2)
|
213 | 219 | .setStatusDetail(statusDetail)
|
214 | 220 | .setLogsBucket(logsBucket)
|
215 | 221 | .setBuildTriggerId(buildTriggerId)
|
216 | 222 | .setLogUrl(logUrl)
|
| 223 | + .setServiceAccount(serviceAccount.toString()) |
217 | 224 | .build();
|
218 | 225 | Operation resultOperation =
|
219 | 226 | Operation.newBuilder()
|
@@ -263,20 +270,24 @@ public void createBuildExceptionTest() throws Exception {
|
263 | 270 | @Test
|
264 | 271 | @SuppressWarnings("all")
|
265 | 272 | public void getBuildTest() {
|
| 273 | + BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]"); |
266 | 274 | String id2 = "id23227150";
|
267 | 275 | String projectId2 = "projectId2939242356";
|
268 | 276 | String statusDetail = "statusDetail2089931070";
|
269 | 277 | String logsBucket = "logsBucket1565363834";
|
270 | 278 | String buildTriggerId = "buildTriggerId1105559411";
|
271 | 279 | String logUrl = "logUrl342054388";
|
| 280 | + ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]"); |
272 | 281 | Build expectedResponse =
|
273 | 282 | Build.newBuilder()
|
| 283 | + .setName(name.toString()) |
274 | 284 | .setId(id2)
|
275 | 285 | .setProjectId(projectId2)
|
276 | 286 | .setStatusDetail(statusDetail)
|
277 | 287 | .setLogsBucket(logsBucket)
|
278 | 288 | .setBuildTriggerId(buildTriggerId)
|
279 | 289 | .setLogUrl(logUrl)
|
| 290 | + .setServiceAccount(serviceAccount.toString()) |
280 | 291 | .build();
|
281 | 292 | mockCloudBuild.addResponse(expectedResponse);
|
282 | 293 |
|
@@ -318,20 +329,24 @@ public void getBuildExceptionTest() throws Exception {
|
318 | 329 | @Test
|
319 | 330 | @SuppressWarnings("all")
|
320 | 331 | public void cancelBuildTest() {
|
| 332 | + BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]"); |
321 | 333 | String id2 = "id23227150";
|
322 | 334 | String projectId2 = "projectId2939242356";
|
323 | 335 | String statusDetail = "statusDetail2089931070";
|
324 | 336 | String logsBucket = "logsBucket1565363834";
|
325 | 337 | String buildTriggerId = "buildTriggerId1105559411";
|
326 | 338 | String logUrl = "logUrl342054388";
|
| 339 | + ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]"); |
327 | 340 | Build expectedResponse =
|
328 | 341 | Build.newBuilder()
|
| 342 | + .setName(name.toString()) |
329 | 343 | .setId(id2)
|
330 | 344 | .setProjectId(projectId2)
|
331 | 345 | .setStatusDetail(statusDetail)
|
332 | 346 | .setLogsBucket(logsBucket)
|
333 | 347 | .setBuildTriggerId(buildTriggerId)
|
334 | 348 | .setLogUrl(logUrl)
|
| 349 | + .setServiceAccount(serviceAccount.toString()) |
335 | 350 | .build();
|
336 | 351 | mockCloudBuild.addResponse(expectedResponse);
|
337 | 352 |
|
@@ -373,20 +388,24 @@ public void cancelBuildExceptionTest() throws Exception {
|
373 | 388 | @Test
|
374 | 389 | @SuppressWarnings("all")
|
375 | 390 | public void retryBuildTest() throws Exception {
|
| 391 | + BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]"); |
376 | 392 | String id2 = "id23227150";
|
377 | 393 | String projectId2 = "projectId2939242356";
|
378 | 394 | String statusDetail = "statusDetail2089931070";
|
379 | 395 | String logsBucket = "logsBucket1565363834";
|
380 | 396 | String buildTriggerId = "buildTriggerId1105559411";
|
381 | 397 | String logUrl = "logUrl342054388";
|
| 398 | + ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]"); |
382 | 399 | Build expectedResponse =
|
383 | 400 | Build.newBuilder()
|
| 401 | + .setName(name.toString()) |
384 | 402 | .setId(id2)
|
385 | 403 | .setProjectId(projectId2)
|
386 | 404 | .setStatusDetail(statusDetail)
|
387 | 405 | .setLogsBucket(logsBucket)
|
388 | 406 | .setBuildTriggerId(buildTriggerId)
|
389 | 407 | .setLogUrl(logUrl)
|
| 408 | + .setServiceAccount(serviceAccount.toString()) |
390 | 409 | .build();
|
391 | 410 | Operation resultOperation =
|
392 | 411 | Operation.newBuilder()
|
@@ -438,14 +457,14 @@ public void retryBuildExceptionTest() throws Exception {
|
438 | 457 | public void createBuildTriggerTest() {
|
439 | 458 | String id = "id3355";
|
440 | 459 | String description = "description-1724546052";
|
441 |
| - String name = "name3373707"; |
| 460 | + BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]"); |
442 | 461 | String filename = "filename-734768633";
|
443 | 462 | boolean disabled = true;
|
444 | 463 | BuildTrigger expectedResponse =
|
445 | 464 | BuildTrigger.newBuilder()
|
446 | 465 | .setId(id)
|
447 | 466 | .setDescription(description)
|
448 |
| - .setName(name) |
| 467 | + .setName(name.toString()) |
449 | 468 | .setFilename(filename)
|
450 | 469 | .setDisabled(disabled)
|
451 | 470 | .build();
|
@@ -491,14 +510,14 @@ public void createBuildTriggerExceptionTest() throws Exception {
|
491 | 510 | public void getBuildTriggerTest() {
|
492 | 511 | String id = "id3355";
|
493 | 512 | String description = "description-1724546052";
|
494 |
| - String name = "name3373707"; |
| 513 | + BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]"); |
495 | 514 | String filename = "filename-734768633";
|
496 | 515 | boolean disabled = true;
|
497 | 516 | BuildTrigger expectedResponse =
|
498 | 517 | BuildTrigger.newBuilder()
|
499 | 518 | .setId(id)
|
500 | 519 | .setDescription(description)
|
501 |
| - .setName(name) |
| 520 | + .setName(name.toString()) |
502 | 521 | .setFilename(filename)
|
503 | 522 | .setDisabled(disabled)
|
504 | 523 | .build();
|
@@ -592,14 +611,14 @@ public void listBuildTriggersExceptionTest() throws Exception {
|
592 | 611 | public void updateBuildTriggerTest() {
|
593 | 612 | String id = "id3355";
|
594 | 613 | String description = "description-1724546052";
|
595 |
| - String name = "name3373707"; |
| 614 | + BuildTriggerName name = BuildTriggerName.of("[PROJECT]", "[TRIGGER]"); |
596 | 615 | String filename = "filename-734768633";
|
597 | 616 | boolean disabled = true;
|
598 | 617 | BuildTrigger expectedResponse =
|
599 | 618 | BuildTrigger.newBuilder()
|
600 | 619 | .setId(id)
|
601 | 620 | .setDescription(description)
|
602 |
| - .setName(name) |
| 621 | + .setName(name.toString()) |
603 | 622 | .setFilename(filename)
|
604 | 623 | .setDisabled(disabled)
|
605 | 624 | .build();
|
@@ -646,20 +665,24 @@ public void updateBuildTriggerExceptionTest() throws Exception {
|
646 | 665 | @Test
|
647 | 666 | @SuppressWarnings("all")
|
648 | 667 | public void runBuildTriggerTest() throws Exception {
|
| 668 | + BuildName name = BuildName.ofProjectBuildName("[PROJECT]", "[BUILD]"); |
649 | 669 | String id = "id3355";
|
650 | 670 | String projectId2 = "projectId2939242356";
|
651 | 671 | String statusDetail = "statusDetail2089931070";
|
652 | 672 | String logsBucket = "logsBucket1565363834";
|
653 | 673 | String buildTriggerId = "buildTriggerId1105559411";
|
654 | 674 | String logUrl = "logUrl342054388";
|
| 675 | + ServiceAccountName serviceAccount = ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]"); |
655 | 676 | Build expectedResponse =
|
656 | 677 | Build.newBuilder()
|
| 678 | + .setName(name.toString()) |
657 | 679 | .setId(id)
|
658 | 680 | .setProjectId(projectId2)
|
659 | 681 | .setStatusDetail(statusDetail)
|
660 | 682 | .setLogsBucket(logsBucket)
|
661 | 683 | .setBuildTriggerId(buildTriggerId)
|
662 | 684 | .setLogUrl(logUrl)
|
| 685 | + .setServiceAccount(serviceAccount.toString()) |
663 | 686 | .build();
|
664 | 687 | Operation resultOperation =
|
665 | 688 | Operation.newBuilder()
|
|
0 commit comments