Search in sources :

Example 1 with ListDeidentifyTemplatesResponse

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

the class DlpServiceClientTest method listDeidentifyTemplatesTest2.

@Test
public void listDeidentifyTemplatesTest2() throws Exception {
    DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build();
    ListDeidentifyTemplatesResponse expectedResponse = ListDeidentifyTemplatesResponse.newBuilder().setNextPageToken("").addAllDeidentifyTemplates(Arrays.asList(responsesElement)).build();
    mockDlpService.addResponse(expectedResponse);
    OrganizationLocationName parent = OrganizationLocationName.of("[ORGANIZATION]", "[LOCATION]");
    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()));
}
Also used : ListDeidentifyTemplatesRequest(com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) AbstractMessage(com.google.protobuf.AbstractMessage) ListDeidentifyTemplatesResponse(com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse) ListDeidentifyTemplatesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) Test(org.junit.Test)

Example 2 with ListDeidentifyTemplatesResponse

use of com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse 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()));
}
Also used : OrganizationName(com.google.privacy.dlp.v2.OrganizationName) ListDeidentifyTemplatesRequest(com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListDeidentifyTemplatesResponse(com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse) ListDeidentifyTemplatesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) Test(org.junit.Test)

Example 3 with ListDeidentifyTemplatesResponse

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

the class DlpServiceClientTest method listDeidentifyTemplatesTest4.

@Test
public void listDeidentifyTemplatesTest4() throws Exception {
    DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build();
    ListDeidentifyTemplatesResponse expectedResponse = ListDeidentifyTemplatesResponse.newBuilder().setNextPageToken("").addAllDeidentifyTemplates(Arrays.asList(responsesElement)).build();
    mockDlpService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    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()));
}
Also used : ListDeidentifyTemplatesRequest(com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.privacy.dlp.v2.ProjectName) ListDeidentifyTemplatesResponse(com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse) ListDeidentifyTemplatesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) Test(org.junit.Test)

Example 4 with ListDeidentifyTemplatesResponse

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

the class DlpServiceClientTest method listDeidentifyTemplatesTest.

@Test
public void listDeidentifyTemplatesTest() throws Exception {
    DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build();
    ListDeidentifyTemplatesResponse expectedResponse = ListDeidentifyTemplatesResponse.newBuilder().setNextPageToken("").addAllDeidentifyTemplates(Arrays.asList(responsesElement)).build();
    mockDlpService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    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()));
}
Also used : ListDeidentifyTemplatesRequest(com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListDeidentifyTemplatesResponse(com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse) ListDeidentifyTemplatesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) OrganizationLocationName(com.google.privacy.dlp.v2.OrganizationLocationName) LocationName(com.google.privacy.dlp.v2.LocationName) Test(org.junit.Test)

Example 5 with ListDeidentifyTemplatesResponse

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

the class DlpServiceClientTest method listDeidentifyTemplatesTest5.

@Test
public void listDeidentifyTemplatesTest5() throws Exception {
    DeidentifyTemplate responsesElement = DeidentifyTemplate.newBuilder().build();
    ListDeidentifyTemplatesResponse expectedResponse = ListDeidentifyTemplatesResponse.newBuilder().setNextPageToken("").addAllDeidentifyTemplates(Arrays.asList(responsesElement)).build();
    mockDlpService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    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, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListDeidentifyTemplatesRequest(com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListDeidentifyTemplatesResponse(com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse) ByteString(com.google.protobuf.ByteString) ListDeidentifyTemplatesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse) DeidentifyTemplate(com.google.privacy.dlp.v2.DeidentifyTemplate) Test(org.junit.Test)

Aggregations

ListDeidentifyTemplatesPagedResponse (com.google.cloud.dlp.v2.DlpServiceClient.ListDeidentifyTemplatesPagedResponse)5 DeidentifyTemplate (com.google.privacy.dlp.v2.DeidentifyTemplate)5 ListDeidentifyTemplatesRequest (com.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest)5 ListDeidentifyTemplatesResponse (com.google.privacy.dlp.v2.ListDeidentifyTemplatesResponse)5 AbstractMessage (com.google.protobuf.AbstractMessage)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