use of com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse in project java-dlp by googleapis.
the class DlpServiceClientTest method listJobTriggersTest2.
@Test
public void listJobTriggersTest2() throws Exception {
JobTrigger responsesElement = JobTrigger.newBuilder().build();
ListJobTriggersResponse expectedResponse = ListJobTriggersResponse.newBuilder().setNextPageToken("").addAllJobTriggers(Arrays.asList(responsesElement)).build();
mockDlpService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent);
List<JobTrigger> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse in project java-dlp by googleapis.
the class DlpServiceClientTest method listJobTriggersTest3.
@Test
public void listJobTriggersTest3() throws Exception {
JobTrigger responsesElement = JobTrigger.newBuilder().build();
ListJobTriggersResponse expectedResponse = ListJobTriggersResponse.newBuilder().setNextPageToken("").addAllJobTriggers(Arrays.asList(responsesElement)).build();
mockDlpService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent);
List<JobTrigger> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse in project java-dlp by googleapis.
the class DlpServiceClientTest method listJobTriggersTest.
@Test
public void listJobTriggersTest() throws Exception {
JobTrigger responsesElement = JobTrigger.newBuilder().build();
ListJobTriggersResponse expectedResponse = ListJobTriggersResponse.newBuilder().setNextPageToken("").addAllJobTriggers(Arrays.asList(responsesElement)).build();
mockDlpService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListJobTriggersPagedResponse pagedListResponse = client.listJobTriggers(parent);
List<JobTrigger> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getJobTriggersList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListJobTriggersRequest actualRequest = ((ListJobTriggersRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations