Search in sources :

Example 1 with ListStoredInfoTypesResponse

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

the class DlpServiceClientTest method listStoredInfoTypesTest4.

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

Example 2 with ListStoredInfoTypesResponse

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

the class DlpServiceClientTest method listStoredInfoTypesTest.

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

Example 3 with ListStoredInfoTypesResponse

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

the class DlpServiceClientTest method listStoredInfoTypesTest2.

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

Example 4 with ListStoredInfoTypesResponse

use of com.google.privacy.dlp.v2.ListStoredInfoTypesResponse 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()));
}
Also used : OrganizationName(com.google.privacy.dlp.v2.OrganizationName) ListStoredInfoTypesPagedResponse(com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) ListStoredInfoTypesRequest(com.google.privacy.dlp.v2.ListStoredInfoTypesRequest) ListStoredInfoTypesResponse(com.google.privacy.dlp.v2.ListStoredInfoTypesResponse) StoredInfoType(com.google.privacy.dlp.v2.StoredInfoType) Test(org.junit.Test)

Example 5 with ListStoredInfoTypesResponse

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

the class DlpServiceClientTest method listStoredInfoTypesTest5.

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

Aggregations

ListStoredInfoTypesPagedResponse (com.google.cloud.dlp.v2.DlpServiceClient.ListStoredInfoTypesPagedResponse)5 ListStoredInfoTypesRequest (com.google.privacy.dlp.v2.ListStoredInfoTypesRequest)5 ListStoredInfoTypesResponse (com.google.privacy.dlp.v2.ListStoredInfoTypesResponse)5 StoredInfoType (com.google.privacy.dlp.v2.StoredInfoType)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