Search in sources :

Example 1 with ListJobTriggersPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListJobTriggersResponse(com.google.privacy.dlp.v2.ListJobTriggersResponse) ProjectName(com.google.privacy.dlp.v2.ProjectName) ListJobTriggersRequest(com.google.privacy.dlp.v2.ListJobTriggersRequest) ListJobTriggersPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) Test(org.junit.Test)

Example 2 with ListJobTriggersPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListJobTriggersResponse(com.google.privacy.dlp.v2.ListJobTriggersResponse) ListJobTriggersRequest(com.google.privacy.dlp.v2.ListJobTriggersRequest) ListJobTriggersPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse) ByteString(com.google.protobuf.ByteString) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) Test(org.junit.Test)

Example 3 with ListJobTriggersPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListJobTriggersResponse(com.google.privacy.dlp.v2.ListJobTriggersResponse) ListJobTriggersRequest(com.google.privacy.dlp.v2.ListJobTriggersRequest) ListJobTriggersPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Aggregations

ListJobTriggersPagedResponse (com.google.cloud.dlp.v2.DlpServiceClient.ListJobTriggersPagedResponse)3 JobTrigger (com.google.privacy.dlp.v2.JobTrigger)3 ListJobTriggersRequest (com.google.privacy.dlp.v2.ListJobTriggersRequest)3 ListJobTriggersResponse (com.google.privacy.dlp.v2.ListJobTriggersResponse)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 Test (org.junit.Test)3 LocationName (com.google.privacy.dlp.v2.LocationName)1 OrganizationLocationName (com.google.privacy.dlp.v2.OrganizationLocationName)1 ProjectName (com.google.privacy.dlp.v2.ProjectName)1 ByteString (com.google.protobuf.ByteString)1