Search in sources :

Example 1 with DeleteWorkerPoolRequest

use of com.google.cloudbuild.v1.DeleteWorkerPoolRequest in project java-cloudbuild by googleapis.

the class CloudBuildClientTest method deleteWorkerPoolTest2.

@Test
public void deleteWorkerPoolTest2() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    Operation resultOperation = Operation.newBuilder().setName("deleteWorkerPoolTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockCloudBuild.addResponse(resultOperation);
    String name = "name3373707";
    client.deleteWorkerPoolAsync(name).get();
    List<AbstractMessage> actualRequests = mockCloudBuild.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteWorkerPoolRequest actualRequest = ((DeleteWorkerPoolRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) AbstractMessage(com.google.protobuf.AbstractMessage) Operation(com.google.longrunning.Operation) DeleteWorkerPoolRequest(com.google.cloudbuild.v1.DeleteWorkerPoolRequest) Test(org.junit.Test)

Example 2 with DeleteWorkerPoolRequest

use of com.google.cloudbuild.v1.DeleteWorkerPoolRequest in project java-cloudbuild by googleapis.

the class CloudBuildClientTest method deleteWorkerPoolTest.

@Test
public void deleteWorkerPoolTest() throws Exception {
    Empty expectedResponse = Empty.newBuilder().build();
    Operation resultOperation = Operation.newBuilder().setName("deleteWorkerPoolTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockCloudBuild.addResponse(resultOperation);
    WorkerPoolName name = WorkerPoolName.of("[PROJECT]", "[LOCATION]", "[WORKER_POOL]");
    client.deleteWorkerPoolAsync(name).get();
    List<AbstractMessage> actualRequests = mockCloudBuild.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteWorkerPoolRequest actualRequest = ((DeleteWorkerPoolRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) WorkerPoolName(com.google.cloudbuild.v1.WorkerPoolName) AbstractMessage(com.google.protobuf.AbstractMessage) Operation(com.google.longrunning.Operation) DeleteWorkerPoolRequest(com.google.cloudbuild.v1.DeleteWorkerPoolRequest) Test(org.junit.Test)

Aggregations

DeleteWorkerPoolRequest (com.google.cloudbuild.v1.DeleteWorkerPoolRequest)2 Operation (com.google.longrunning.Operation)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Empty (com.google.protobuf.Empty)2 Test (org.junit.Test)2 WorkerPoolName (com.google.cloudbuild.v1.WorkerPoolName)1