Search in sources :

Example 1 with CreateStoredInfoTypeRequest

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

the class DlpServiceClientTest method createStoredInfoTypeTest.

@Test
public void createStoredInfoTypeTest() 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);
    LocationName parent = LocationName.of("[PROJECT]", "[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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) CreateStoredInfoTypeRequest(com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest) ArrayList(java.util.ArrayList) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) StoredInfoTypeConfig(com.google.privacy.dlp.v2.StoredInfoTypeConfig) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Example 2 with CreateStoredInfoTypeRequest

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

the class DlpServiceClientTest method createStoredInfoTypeTest3.

@Test
public void createStoredInfoTypeTest3() 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);
    OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    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()));
}
Also used : OrganizationName(com.google.privacy.dlp.v2.OrganizationName) AbstractMessage(com.google.protobuf.AbstractMessage) CreateStoredInfoTypeRequest(com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest) ArrayList(java.util.ArrayList) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) StoredInfoTypeConfig(com.google.privacy.dlp.v2.StoredInfoTypeConfig) Test(org.junit.Test)

Example 3 with CreateStoredInfoTypeRequest

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

Example 4 with CreateStoredInfoTypeRequest

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

Example 5 with CreateStoredInfoTypeRequest

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

the class DlpServiceClientTest method createStoredInfoTypeTest4.

@Test
public void createStoredInfoTypeTest4() 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);
    ProjectName parent = ProjectName.of("[PROJECT]");
    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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) CreateStoredInfoTypeRequest(com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest) ProjectName(com.google.privacy.dlp.v2.ProjectName) ArrayList(java.util.ArrayList) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) StoredInfoTypeConfig(com.google.privacy.dlp.v2.StoredInfoTypeConfig) Test(org.junit.Test)

Aggregations

CreateStoredInfoTypeRequest (com.google.privacy.dlp.v2.CreateStoredInfoTypeRequest)5 StoredInfoType (com.google.privacy.dlp.v2.StoredInfoType)5 StoredInfoTypeConfig (com.google.privacy.dlp.v2.StoredInfoTypeConfig)5 AbstractMessage (com.google.protobuf.AbstractMessage)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 OrganizationLocationName (com.google.privacy.dlp.v2.OrganizationLocationName)2 LocationName (com.google.privacy.dlp.v2.LocationName)1 OrganizationName (com.google.privacy.dlp.v2.OrganizationName)1 ProjectName (com.google.privacy.dlp.v2.ProjectName)1 ByteString (com.google.protobuf.ByteString)1