use of com.google.cloudbuild.v1.UpdateWorkerPoolRequest in project java-cloudbuild by googleapis.
the class CloudBuildClientTest method updateWorkerPoolTest.
@Test
public void updateWorkerPoolTest() throws Exception {
WorkerPool expectedResponse = WorkerPool.newBuilder().setName(WorkerPoolName.of("[PROJECT]", "[LOCATION]", "[WORKER_POOL]").toString()).setDisplayName("displayName1714148973").setUid("uid115792").putAllAnnotations(new HashMap<String, String>()).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).setDeleteTime(Timestamp.newBuilder().build()).setEtag("etag3123477").build();
Operation resultOperation = Operation.newBuilder().setName("updateWorkerPoolTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
mockCloudBuild.addResponse(resultOperation);
WorkerPool workerPool = WorkerPool.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
WorkerPool actualResponse = client.updateWorkerPoolAsync(workerPool, updateMask).get();
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockCloudBuild.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateWorkerPoolRequest actualRequest = ((UpdateWorkerPoolRequest) actualRequests.get(0));
Assert.assertEquals(workerPool, actualRequest.getWorkerPool());
Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations