Search in sources :

Example 1 with UpdateJobTriggerRequest

use of com.google.privacy.dlp.v2.UpdateJobTriggerRequest in project java-dlp by googleapis.

the class DlpServiceClientTest method updateJobTriggerTest.

@Test
public void updateJobTriggerTest() throws Exception {
    JobTrigger expectedResponse = JobTrigger.newBuilder().setName(JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()).setDisplayName("displayName1714148973").setDescription("description-1724546052").addAllTriggers(new ArrayList<JobTrigger.Trigger>()).addAllErrors(new ArrayList<Error>()).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).setLastRunTime(Timestamp.newBuilder().build()).build();
    mockDlpService.addResponse(expectedResponse);
    JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
    JobTrigger jobTrigger = JobTrigger.newBuilder().build();
    FieldMask updateMask = FieldMask.newBuilder().build();
    JobTrigger actualResponse = client.updateJobTrigger(name, jobTrigger, updateMask);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockDlpService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateJobTriggerRequest actualRequest = ((UpdateJobTriggerRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) UpdateJobTriggerRequest(com.google.privacy.dlp.v2.UpdateJobTriggerRequest) ArrayList(java.util.ArrayList) Error(com.google.privacy.dlp.v2.Error) JobTriggerName(com.google.privacy.dlp.v2.JobTriggerName) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Example 2 with UpdateJobTriggerRequest

use of com.google.privacy.dlp.v2.UpdateJobTriggerRequest in project java-dlp by googleapis.

the class DlpServiceClientTest method updateJobTriggerTest2.

@Test
public void updateJobTriggerTest2() throws Exception {
    JobTrigger expectedResponse = JobTrigger.newBuilder().setName(JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]").toString()).setDisplayName("displayName1714148973").setDescription("description-1724546052").addAllTriggers(new ArrayList<JobTrigger.Trigger>()).addAllErrors(new ArrayList<Error>()).setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).setLastRunTime(Timestamp.newBuilder().build()).build();
    mockDlpService.addResponse(expectedResponse);
    String name = "name3373707";
    JobTrigger jobTrigger = JobTrigger.newBuilder().build();
    FieldMask updateMask = FieldMask.newBuilder().build();
    JobTrigger actualResponse = client.updateJobTrigger(name, jobTrigger, updateMask);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockDlpService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateJobTriggerRequest actualRequest = ((UpdateJobTriggerRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertEquals(jobTrigger, actualRequest.getJobTrigger());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) UpdateJobTriggerRequest(com.google.privacy.dlp.v2.UpdateJobTriggerRequest) ArrayList(java.util.ArrayList) Error(com.google.privacy.dlp.v2.Error) ByteString(com.google.protobuf.ByteString) JobTrigger(com.google.privacy.dlp.v2.JobTrigger) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Aggregations

Error (com.google.privacy.dlp.v2.Error)2 JobTrigger (com.google.privacy.dlp.v2.JobTrigger)2 UpdateJobTriggerRequest (com.google.privacy.dlp.v2.UpdateJobTriggerRequest)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 FieldMask (com.google.protobuf.FieldMask)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 JobTriggerName (com.google.privacy.dlp.v2.JobTriggerName)1 ByteString (com.google.protobuf.ByteString)1