Search in sources :

Example 1 with ListConversationProfilesPagedResponse

use of com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse in project java-dialogflow by googleapis.

the class ConversationProfilesClientTest method listConversationProfilesTest3.

@Test
public void listConversationProfilesTest3() throws Exception {
    ConversationProfile responsesElement = ConversationProfile.newBuilder().build();
    ListConversationProfilesResponse expectedResponse = ListConversationProfilesResponse.newBuilder().setNextPageToken("").addAllConversationProfiles(Arrays.asList(responsesElement)).build();
    mockConversationProfiles.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListConversationProfilesPagedResponse pagedListResponse = client.listConversationProfiles(parent);
    List<ConversationProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConversationProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConversationProfiles.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConversationProfilesRequest actualRequest = ((ListConversationProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationProfilesPagedResponse(com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse) Test(org.junit.Test)

Example 2 with ListConversationProfilesPagedResponse

use of com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse in project java-dialogflow by googleapis.

the class ConversationProfilesClientTest method listConversationProfilesTest.

@Test
public void listConversationProfilesTest() throws Exception {
    ConversationProfile responsesElement = ConversationProfile.newBuilder().build();
    ListConversationProfilesResponse expectedResponse = ListConversationProfilesResponse.newBuilder().setNextPageToken("").addAllConversationProfiles(Arrays.asList(responsesElement)).build();
    mockConversationProfiles.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListConversationProfilesPagedResponse pagedListResponse = client.listConversationProfiles(parent);
    List<ConversationProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConversationProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConversationProfiles.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConversationProfilesRequest actualRequest = ((ListConversationProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationProfilesPagedResponse(com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse) Test(org.junit.Test)

Example 3 with ListConversationProfilesPagedResponse

use of com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse in project java-dialogflow by googleapis.

the class ConversationProfilesClientTest method listConversationProfilesTest3.

@Test
public void listConversationProfilesTest3() throws Exception {
    ConversationProfile responsesElement = ConversationProfile.newBuilder().build();
    ListConversationProfilesResponse expectedResponse = ListConversationProfilesResponse.newBuilder().setNextPageToken("").addAllConversationProfiles(Arrays.asList(responsesElement)).build();
    mockConversationProfiles.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListConversationProfilesPagedResponse pagedListResponse = client.listConversationProfiles(parent);
    List<ConversationProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConversationProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConversationProfiles.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConversationProfilesRequest actualRequest = ((ListConversationProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationProfilesPagedResponse(com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse) Test(org.junit.Test)

Example 4 with ListConversationProfilesPagedResponse

use of com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse in project java-dialogflow by googleapis.

the class ConversationProfilesClientTest method listConversationProfilesTest2.

@Test
public void listConversationProfilesTest2() throws Exception {
    ConversationProfile responsesElement = ConversationProfile.newBuilder().build();
    ListConversationProfilesResponse expectedResponse = ListConversationProfilesResponse.newBuilder().setNextPageToken("").addAllConversationProfiles(Arrays.asList(responsesElement)).build();
    mockConversationProfiles.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListConversationProfilesPagedResponse pagedListResponse = client.listConversationProfiles(parent);
    List<ConversationProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConversationProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConversationProfiles.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConversationProfilesRequest actualRequest = ((ListConversationProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationProfilesPagedResponse(com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse) Test(org.junit.Test)

Example 5 with ListConversationProfilesPagedResponse

use of com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse in project java-dialogflow by googleapis.

the class ConversationProfilesClientTest method listConversationProfilesTest.

@Test
public void listConversationProfilesTest() throws Exception {
    ConversationProfile responsesElement = ConversationProfile.newBuilder().build();
    ListConversationProfilesResponse expectedResponse = ListConversationProfilesResponse.newBuilder().setNextPageToken("").addAllConversationProfiles(Arrays.asList(responsesElement)).build();
    mockConversationProfiles.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListConversationProfilesPagedResponse pagedListResponse = client.listConversationProfiles(parent);
    List<ConversationProfile> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConversationProfilesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConversationProfiles.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConversationProfilesRequest actualRequest = ((ListConversationProfilesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListConversationProfilesPagedResponse(com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)6 Test (org.junit.Test)6 ListConversationProfilesPagedResponse (com.google.cloud.dialogflow.v2.ConversationProfilesClient.ListConversationProfilesPagedResponse)3 ListConversationProfilesPagedResponse (com.google.cloud.dialogflow.v2beta1.ConversationProfilesClient.ListConversationProfilesPagedResponse)3