Search in sources :

Example 1 with ListPagesPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.

the class PagesClientTest method listPagesTest2.

@Test
public void listPagesTest2() throws Exception {
    Page responsesElement = Page.newBuilder().build();
    ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
    mockPages.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListPagesPagedResponse pagedListResponse = client.listPages(parent);
    List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockPages.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListPagesPagedResponse(com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse) Test(org.junit.Test)

Example 2 with ListPagesPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.

the class PagesClientTest method listPagesTest.

@Test
public void listPagesTest() throws Exception {
    Page responsesElement = Page.newBuilder().build();
    ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
    mockPages.addResponse(expectedResponse);
    FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
    ListPagesPagedResponse pagedListResponse = client.listPages(parent);
    List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockPages.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListPagesPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse) Test(org.junit.Test)

Example 3 with ListPagesPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.

the class PagesClientTest method listPagesTest2.

@Test
public void listPagesTest2() throws Exception {
    Page responsesElement = Page.newBuilder().build();
    ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
    mockPages.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListPagesPagedResponse pagedListResponse = client.listPages(parent);
    List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockPages.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListPagesPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse) Test(org.junit.Test)

Example 4 with ListPagesPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse in project java-dialogflow-cx by googleapis.

the class PagesClientTest method listPagesTest.

@Test
public void listPagesTest() throws Exception {
    Page responsesElement = Page.newBuilder().build();
    ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
    mockPages.addResponse(expectedResponse);
    FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
    ListPagesPagedResponse pagedListResponse = client.listPages(parent);
    List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockPages.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListPagesRequest actualRequest = ((ListPagesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListPagesPagedResponse(com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListPagesPagedResponse (com.google.cloud.dialogflow.cx.v3.PagesClient.ListPagesPagedResponse)2 ListPagesPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.PagesClient.ListPagesPagedResponse)2