Search in sources :

Example 1 with ListFlowsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse in project java-dialogflow-cx by googleapis.

the class FlowsClientTest method listFlowsTest.

@Test
public void listFlowsTest() throws Exception {
    Flow responsesElement = Flow.newBuilder().build();
    ListFlowsResponse expectedResponse = ListFlowsResponse.newBuilder().setNextPageToken("").addAllFlows(Arrays.asList(responsesElement)).build();
    mockFlows.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListFlowsPagedResponse pagedListResponse = client.listFlows(parent);
    List<Flow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockFlows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListFlowsPagedResponse(com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse) Test(org.junit.Test)

Example 2 with ListFlowsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse in project java-dialogflow-cx by googleapis.

the class FlowsClientTest method listFlowsTest2.

@Test
public void listFlowsTest2() throws Exception {
    Flow responsesElement = Flow.newBuilder().build();
    ListFlowsResponse expectedResponse = ListFlowsResponse.newBuilder().setNextPageToken("").addAllFlows(Arrays.asList(responsesElement)).build();
    mockFlows.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListFlowsPagedResponse pagedListResponse = client.listFlows(parent);
    List<Flow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockFlows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListFlowsPagedResponse(com.google.cloud.dialogflow.cx.v3.FlowsClient.ListFlowsPagedResponse) Test(org.junit.Test)

Example 3 with ListFlowsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse in project java-dialogflow-cx by googleapis.

the class FlowsClientTest method listFlowsTest.

@Test
public void listFlowsTest() throws Exception {
    Flow responsesElement = Flow.newBuilder().build();
    ListFlowsResponse expectedResponse = ListFlowsResponse.newBuilder().setNextPageToken("").addAllFlows(Arrays.asList(responsesElement)).build();
    mockFlows.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListFlowsPagedResponse pagedListResponse = client.listFlows(parent);
    List<Flow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockFlows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListFlowsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse) Test(org.junit.Test)

Example 4 with ListFlowsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse in project java-dialogflow-cx by googleapis.

the class FlowsClientTest method listFlowsTest2.

@Test
public void listFlowsTest2() throws Exception {
    Flow responsesElement = Flow.newBuilder().build();
    ListFlowsResponse expectedResponse = ListFlowsResponse.newBuilder().setNextPageToken("").addAllFlows(Arrays.asList(responsesElement)).build();
    mockFlows.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListFlowsPagedResponse pagedListResponse = client.listFlows(parent);
    List<Flow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getFlowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockFlows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListFlowsRequest actualRequest = ((ListFlowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListFlowsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse) Test(org.junit.Test)

Aggregations

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