Search in sources :

Example 1 with GetWorkerPoolRequest

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

the class CloudBuildClientTest method getWorkerPoolTest2.

@Test
public void getWorkerPoolTest2() 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();
    mockCloudBuild.addResponse(expectedResponse);
    String name = "name3373707";
    WorkerPool actualResponse = client.getWorkerPool(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockCloudBuild.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetWorkerPoolRequest actualRequest = ((GetWorkerPoolRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : WorkerPool(com.google.cloudbuild.v1.WorkerPool) AbstractMessage(com.google.protobuf.AbstractMessage) HashMap(java.util.HashMap) GetWorkerPoolRequest(com.google.cloudbuild.v1.GetWorkerPoolRequest) Test(org.junit.Test)

Example 2 with GetWorkerPoolRequest

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

the class CloudBuildClientTest method getWorkerPoolTest.

@Test
public void getWorkerPoolTest() 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();
    mockCloudBuild.addResponse(expectedResponse);
    WorkerPoolName name = WorkerPoolName.of("[PROJECT]", "[LOCATION]", "[WORKER_POOL]");
    WorkerPool actualResponse = client.getWorkerPool(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockCloudBuild.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetWorkerPoolRequest actualRequest = ((GetWorkerPoolRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : WorkerPool(com.google.cloudbuild.v1.WorkerPool) WorkerPoolName(com.google.cloudbuild.v1.WorkerPoolName) AbstractMessage(com.google.protobuf.AbstractMessage) HashMap(java.util.HashMap) GetWorkerPoolRequest(com.google.cloudbuild.v1.GetWorkerPoolRequest) Test(org.junit.Test)

Aggregations

GetWorkerPoolRequest (com.google.cloudbuild.v1.GetWorkerPoolRequest)2 WorkerPool (com.google.cloudbuild.v1.WorkerPool)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 WorkerPoolName (com.google.cloudbuild.v1.WorkerPoolName)1