use of com.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listFlowsTest.
@Test
public void listFlowsTest() {
ListFlowsRequest request = ListFlowsRequest.newBuilder().setParent(agentName).build();
FlowsClient.ListFlowsPagedResponse pagedListResponse = flowsClient.listFlows(request);
List<Flow> flows = Lists.newArrayList(pagedListResponse.iterateAll());
boolean isFlowExists = false;
for (Flow flow : flows) {
if (flow.getName().equals(flowName)) {
assertFlowDetails(flow);
isFlowExists = true;
}
}
assertTrue(isFlowExists);
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest 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()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest 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()));
}
Aggregations