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()));
}
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()));
}
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()));
}
Aggregations