use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listStoredInfoTypesExceptionTest.
@Test
public void listStoredInfoTypesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
client.listStoredInfoTypes(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 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()));
}
use of com.google.cloud.redis.v1beta1.LocationName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDeidentifyTemplateExceptionTest.
@Test
public void createDeidentifyTemplateExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
client.createDeidentifyTemplate(parent, deidentifyTemplate);
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 listInspectTemplatesExceptionTest.
@Test
public void listInspectTemplatesExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
client.listInspectTemplates(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 createDlpJobExceptionTest2.
@Test
public void createDlpJobExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
RiskAnalysisJobConfig riskJob = RiskAnalysisJobConfig.newBuilder().build();
client.createDlpJob(parent, riskJob);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations