Search in sources :

Example 1 with ListTransferConfigsPagedResponse

use of com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse in project java-bigquerydatatransfer by googleapis.

the class DataTransferServiceClientTest method listTransferConfigsTest3.

@Test
public void listTransferConfigsTest3() throws Exception {
    TransferConfig responsesElement = TransferConfig.newBuilder().build();
    ListTransferConfigsResponse expectedResponse = ListTransferConfigsResponse.newBuilder().setNextPageToken("").addAllTransferConfigs(Arrays.asList(responsesElement)).build();
    mockDataTransferService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListTransferConfigsPagedResponse pagedListResponse = client.listTransferConfigs(parent);
    List<TransferConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTransferConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataTransferService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTransferConfigsRequest actualRequest = ((ListTransferConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTransferConfigsPagedResponse(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse) Test(org.junit.Test)

Example 2 with ListTransferConfigsPagedResponse

use of com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse in project java-bigquerydatatransfer by googleapis.

the class DataTransferServiceClientTest method listTransferConfigsTest2.

@Test
public void listTransferConfigsTest2() throws Exception {
    TransferConfig responsesElement = TransferConfig.newBuilder().build();
    ListTransferConfigsResponse expectedResponse = ListTransferConfigsResponse.newBuilder().setNextPageToken("").addAllTransferConfigs(Arrays.asList(responsesElement)).build();
    mockDataTransferService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListTransferConfigsPagedResponse pagedListResponse = client.listTransferConfigs(parent);
    List<TransferConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTransferConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataTransferService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTransferConfigsRequest actualRequest = ((ListTransferConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTransferConfigsPagedResponse(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse) Test(org.junit.Test)

Example 3 with ListTransferConfigsPagedResponse

use of com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse in project java-bigquerydatatransfer by googleapis.

the class DataTransferServiceClientTest method listTransferConfigsTest.

@Test
public void listTransferConfigsTest() throws Exception {
    TransferConfig responsesElement = TransferConfig.newBuilder().build();
    ListTransferConfigsResponse expectedResponse = ListTransferConfigsResponse.newBuilder().setNextPageToken("").addAllTransferConfigs(Arrays.asList(responsesElement)).build();
    mockDataTransferService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListTransferConfigsPagedResponse pagedListResponse = client.listTransferConfigs(parent);
    List<TransferConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTransferConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDataTransferService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTransferConfigsRequest actualRequest = ((ListTransferConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTransferConfigsPagedResponse(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse) Test(org.junit.Test)

Aggregations

ListTransferConfigsPagedResponse (com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient.ListTransferConfigsPagedResponse)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 Test (org.junit.Test)3