use of com.google.privacy.dlp.v2.StoredInfoTypeConfig in project java-dlp by googleapis.
the class DlpServiceClientTest method updateStoredInfoTypeExceptionTest.
@Test
public void updateStoredInfoTypeExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
StoredInfoTypeName name = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
client.updateStoredInfoType(name, config, updateMask);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.privacy.dlp.v2.StoredInfoTypeConfig in project java-dlp by googleapis.
the class DlpServiceClientTest method updateStoredInfoTypeExceptionTest2.
@Test
public void updateStoredInfoTypeExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
String name = "name3373707";
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
client.updateStoredInfoType(name, config, updateMask);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.privacy.dlp.v2.StoredInfoTypeConfig in project java-dlp by googleapis.
the class DlpServiceClientTest method updateStoredInfoTypeTest.
@Test
public void updateStoredInfoTypeTest() throws Exception {
StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]").toString()).setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()).addAllPendingVersions(new ArrayList<StoredInfoTypeVersion>()).build();
mockDlpService.addResponse(expectedResponse);
StoredInfoTypeName name = StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]");
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
StoredInfoType actualResponse = client.updateStoredInfoType(name, config, updateMask);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateStoredInfoTypeRequest actualRequest = ((UpdateStoredInfoTypeRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertEquals(config, actualRequest.getConfig());
Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.privacy.dlp.v2.StoredInfoTypeConfig in project java-dlp by googleapis.
the class DlpServiceClientTest method createStoredInfoTypeTest2.
@Test
public void createStoredInfoTypeTest2() throws Exception {
StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]").toString()).setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()).addAllPendingVersions(new ArrayList<StoredInfoTypeVersion>()).build();
mockDlpService.addResponse(expectedResponse);
OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
StoredInfoType actualResponse = client.createStoredInfoType(parent, config);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateStoredInfoTypeRequest actualRequest = ((CreateStoredInfoTypeRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertEquals(config, actualRequest.getConfig());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.privacy.dlp.v2.StoredInfoTypeConfig in project java-dlp by googleapis.
the class DlpServiceClientTest method createStoredInfoTypeTest5.
@Test
public void createStoredInfoTypeTest5() throws Exception {
StoredInfoType expectedResponse = StoredInfoType.newBuilder().setName(StoredInfoTypeName.ofOrganizationStoredInfoTypeName("[ORGANIZATION]", "[STORED_INFO_TYPE]").toString()).setCurrentVersion(StoredInfoTypeVersion.newBuilder().build()).addAllPendingVersions(new ArrayList<StoredInfoTypeVersion>()).build();
mockDlpService.addResponse(expectedResponse);
String parent = "parent-995424086";
StoredInfoTypeConfig config = StoredInfoTypeConfig.newBuilder().build();
StoredInfoType actualResponse = client.createStoredInfoType(parent, config);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
CreateStoredInfoTypeRequest actualRequest = ((CreateStoredInfoTypeRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertEquals(config, actualRequest.getConfig());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations