use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDeidentifyTemplateTest.
@Test
public void createDeidentifyTemplateTest() 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);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
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()));
}
use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method createStoredInfoTypeExceptionTest.
@Test
public void createStoredInfoTypeExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
client.createStoredInfoType(parent, config);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listJobTriggersExceptionTest.
@Test
public void listJobTriggersExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
client.listJobTriggers(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listDlpJobsExceptionTest.
@Test
public void listDlpJobsExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
client.listDlpJobs(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDlpJobExceptionTest.
@Test
public void createDlpJobExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
InspectJobConfig inspectJob = InspectJobConfig.newBuilder().build();
client.createDlpJob(parent, inspectJob);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations