use of com.google.bigtable.repackaged.com.google.monitoring.v3.ProjectName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDlpJobTest3.
@Test
public void createDlpJobTest3() throws Exception {
DlpJob expectedResponse = DlpJob.newBuilder().setName(DlpJobName.ofProjectDlpJobName("[PROJECT]", "[DLP_JOB]").toString()).setType(DlpJobType.forNumber(0)).setCreateTime(Timestamp.newBuilder().build()).setStartTime(Timestamp.newBuilder().build()).setEndTime(Timestamp.newBuilder().build()).setJobTriggerName("jobTriggerName494333030").addAllErrors(new ArrayList<Error>()).build();
mockDlpService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
DlpJob actualResponse = client.createDlpJob(parent, inspectJob);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateDlpJobRequest actualRequest = ((CreateDlpJobRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(inspectJob, actualRequest.getInspectJob());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.bigtable.repackaged.com.google.monitoring.v3.ProjectName 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.bigtable.repackaged.com.google.monitoring.v3.ProjectName in project java-dlp by googleapis.
the class DlpServiceClientTest method listDlpJobsExceptionTest2.
@Test
public void listDlpJobsExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listDlpJobs(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.repackaged.com.google.monitoring.v3.ProjectName in project java-dlp by googleapis.
the class DlpServiceClientTest method listStoredInfoTypesExceptionTest4.
@Test
public void listStoredInfoTypesExceptionTest4() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
client.listStoredInfoTypes(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.repackaged.com.google.monitoring.v3.ProjectName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDeidentifyTemplateTest4.
@Test
public void createDeidentifyTemplateTest4() throws Exception {
DeidentifyTemplate expectedResponse = DeidentifyTemplate.newBuilder().setName(DeidentifyTemplateName.ofOrganizationDeidentifyTemplateName("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]").toString()).setDisplayName("displayName1714148973").setDescription("description-1724546052").setCreateTime(Timestamp.newBuilder().build()).setUpdateTime(Timestamp.newBuilder().build()).setDeidentifyConfig(DeidentifyConfig.newBuilder().build()).build();
mockDlpService.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
DeidentifyTemplate actualResponse = client.createDeidentifyTemplate(parent, deidentifyTemplate);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateDeidentifyTemplateRequest actualRequest = ((CreateDeidentifyTemplateRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(deidentifyTemplate, actualRequest.getDeidentifyTemplate());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations