use of com.google.monitoring.v3.OrganizationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listStoredInfoTypesTest3.
@Test
public void listStoredInfoTypesTest3() throws Exception {
StoredInfoType responsesElement = StoredInfoType.newBuilder().build();
ListStoredInfoTypesResponse expectedResponse = ListStoredInfoTypesResponse.newBuilder().setNextPageToken("").addAllStoredInfoTypes(Arrays.asList(responsesElement)).build();
mockDlpService.addResponse(expectedResponse);
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListStoredInfoTypesPagedResponse pagedListResponse = client.listStoredInfoTypes(parent);
List<StoredInfoType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getStoredInfoTypesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListStoredInfoTypesRequest actualRequest = ((ListStoredInfoTypesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.OrganizationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listDeidentifyTemplatesExceptionTest3.
@Test
public void listDeidentifyTemplatesExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
client.listDeidentifyTemplates(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.monitoring.v3.OrganizationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listDeidentifyTemplatesTest3.
@Test
public void listDeidentifyTemplatesTest3() throws Exception {
DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build();
ListDeidentifyTemplatesResponse expectedResponse = ListDeidentifyTemplatesResponse.newBuilder().setNextPageToken("").addAllDeidentifyTemplates(Arrays.asList(responsesElement)).build();
mockDlpService.addResponse(expectedResponse);
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
ListDeidentifyTemplatesPagedResponse pagedListResponse = client.listDeidentifyTemplates(parent);
List<DeidentifyTemplate> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getDeidentifyTemplatesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListDeidentifyTemplatesRequest actualRequest = ((ListDeidentifyTemplatesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.OrganizationName in project java-dlp by googleapis.
the class DlpServiceClientTest method listInspectTemplatesExceptionTest3.
@Test
public void listInspectTemplatesExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
client.listInspectTemplates(parent);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.monitoring.v3.OrganizationName in project java-dlp by googleapis.
the class DlpServiceClientTest method createDeidentifyTemplateExceptionTest3.
@Test
public void createDeidentifyTemplateExceptionTest3() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
DeidentifyTemplate deidentifyTemplate = DeidentifyTemplate.newBuilder().build();
client.createDeidentifyTemplate(parent, deidentifyTemplate);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations