Search in sources :

Example 1 with UpdateStoredInfoTypeRequest

use of com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest 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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) UpdateStoredInfoTypeRequest(com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest) ArrayList(java.util.ArrayList) StoredInfoTypeName(com.google.privacy.dlp.v2.StoredInfoTypeName) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) StoredInfoTypeConfig(com.google.privacy.dlp.v2.StoredInfoTypeConfig) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Example 2 with UpdateStoredInfoTypeRequest

use of com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest in project java-dlp by googleapis.

the class DlpServiceClientTest method updateStoredInfoTypeTest2.

@Test
public void updateStoredInfoTypeTest2() 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 name = "name3373707";
    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, actualRequest.getName());
    Assert.assertEquals(config, actualRequest.getConfig());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) UpdateStoredInfoTypeRequest(com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest) ArrayList(java.util.ArrayList) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) ByteString(com.google.protobuf.ByteString) StoredInfoTypeConfig(com.google.privacy.dlp.v2.StoredInfoTypeConfig) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Aggregations

StoredInfoType (com.google.privacy.dlp.v2.StoredInfoType)2 StoredInfoTypeConfig (com.google.privacy.dlp.v2.StoredInfoTypeConfig)2 UpdateStoredInfoTypeRequest (com.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 FieldMask (com.google.protobuf.FieldMask)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 StoredInfoTypeName (com.google.privacy.dlp.v2.StoredInfoTypeName)1 ByteString (com.google.protobuf.ByteString)1