Search in sources :

Example 1 with ListTenantsPagedResponse

use of com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse in project java-talent by googleapis.

the class TenantServiceClientTest method listTenantsTest2.

@Test
public void listTenantsTest2() throws Exception {
    Tenant responsesElement = Tenant.newBuilder().build();
    ListTenantsResponse expectedResponse = ListTenantsResponse.newBuilder().setNextPageToken("").addAllTenants(Arrays.asList(responsesElement)).build();
    mockTenantService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListTenantsPagedResponse pagedListResponse = client.listTenants(parent);
    List<Tenant> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTenantsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTenantService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTenantsRequest actualRequest = ((ListTenantsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTenantsPagedResponse(com.google.cloud.talent.v4.TenantServiceClient.ListTenantsPagedResponse) Test(org.junit.Test)

Example 2 with ListTenantsPagedResponse

use of com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse in project java-talent by googleapis.

the class TenantServiceClientTest method listTenantsTest.

@Test
public void listTenantsTest() throws Exception {
    Tenant responsesElement = Tenant.newBuilder().build();
    ListTenantsResponse expectedResponse = ListTenantsResponse.newBuilder().setNextPageToken("").addAllTenants(Arrays.asList(responsesElement)).build();
    mockTenantService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListTenantsPagedResponse pagedListResponse = client.listTenants(parent);
    List<Tenant> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTenantsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTenantService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTenantsRequest actualRequest = ((ListTenantsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTenantsPagedResponse(com.google.cloud.talent.v4.TenantServiceClient.ListTenantsPagedResponse) Test(org.junit.Test)

Example 3 with ListTenantsPagedResponse

use of com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse in project java-talent by googleapis.

the class TenantServiceClientTest method listTenantsTest.

@Test
public void listTenantsTest() throws Exception {
    Tenant responsesElement = Tenant.newBuilder().build();
    ListTenantsResponse expectedResponse = ListTenantsResponse.newBuilder().setNextPageToken("").addAllTenants(Arrays.asList(responsesElement)).build();
    mockTenantService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListTenantsPagedResponse pagedListResponse = client.listTenants(parent);
    List<Tenant> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTenantsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTenantService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTenantsRequest actualRequest = ((ListTenantsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTenantsPagedResponse(com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse) Test(org.junit.Test)

Example 4 with ListTenantsPagedResponse

use of com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse in project java-talent by googleapis.

the class TenantServiceClientTest method listTenantsTest2.

@Test
public void listTenantsTest2() throws Exception {
    Tenant responsesElement = Tenant.newBuilder().build();
    ListTenantsResponse expectedResponse = ListTenantsResponse.newBuilder().setNextPageToken("").addAllTenants(Arrays.asList(responsesElement)).build();
    mockTenantService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListTenantsPagedResponse pagedListResponse = client.listTenants(parent);
    List<Tenant> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTenantsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTenantService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTenantsRequest actualRequest = ((ListTenantsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTenantsPagedResponse(com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListTenantsPagedResponse (com.google.cloud.talent.v4.TenantServiceClient.ListTenantsPagedResponse)2 ListTenantsPagedResponse (com.google.cloud.talent.v4beta1.TenantServiceClient.ListTenantsPagedResponse)2