use of com.google.cloud.dialogflow.cx.v3beta1.FlowName in project java-dialogflow-cx by googleapis.
the class TransitionRouteGroupsClientTest method listTransitionRouteGroupsTest.
@Test
public void listTransitionRouteGroupsTest() throws Exception {
TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build();
ListTransitionRouteGroupsResponse expectedResponse = ListTransitionRouteGroupsResponse.newBuilder().setNextPageToken("").addAllTransitionRouteGroups(Arrays.asList(responsesElement)).build();
mockTransitionRouteGroups.addResponse(expectedResponse);
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
ListTransitionRouteGroupsPagedResponse pagedListResponse = client.listTransitionRouteGroups(parent);
List<TransitionRouteGroup> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockTransitionRouteGroups.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTransitionRouteGroupsRequest actualRequest = ((ListTransitionRouteGroupsRequest) 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.FlowName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method tearDown.
@AfterClass
public static void tearDown() {
/* delete version */
DeleteVersionRequest deleteVersionRequest = DeleteVersionRequest.newBuilder().setName(versionName).build();
versionsClient.deleteVersion(deleteVersionRequest);
versionsClient.close();
/* delete transition route groups */
DeleteTransitionRouteGroupRequest deleteTransitionRouteGroupRequest = DeleteTransitionRouteGroupRequest.newBuilder().setName(transitionRouteGroupName).build();
transitionRouteGroupsClient.deleteTransitionRouteGroup(deleteTransitionRouteGroupRequest);
transitionRouteGroupsClient.close();
/* delete session */
sessionsClient.close();
/* delete pages */
DeletePageRequest deletePageRequest = DeletePageRequest.newBuilder().setName(pageName).build();
pagesClient.deletePage(deletePageRequest);
pagesClient.close();
/* delete intents */
DeleteIntentRequest deleteIntentRequest = DeleteIntentRequest.newBuilder().setName(intentsName).build();
intentsClient.deleteIntent(deleteIntentRequest);
intentsClient.close();
/* delete flows */
DeleteFlowRequest deleteFlowRequest = DeleteFlowRequest.newBuilder().setName(flowName).build();
flowsClient.deleteFlow(deleteFlowRequest);
DeleteFlowRequest deleteTrainFlowRequest = DeleteFlowRequest.newBuilder().setName(trainFlowName).build();
flowsClient.deleteFlow(deleteTrainFlowRequest);
flowsClient.close();
/* delete entity types */
DeleteEntityTypeRequest deleteEntityTypeRequest = DeleteEntityTypeRequest.newBuilder().setName(entityTypesName).build();
entityTypesClient.deleteEntityType(deleteEntityTypeRequest);
entityTypesClient.close();
/* delete agents */
DeleteAgentRequest deleteAgentRequest = DeleteAgentRequest.newBuilder().setName(agentName).build();
agentsClient.deleteAgent(deleteAgentRequest);
agentsClient.close();
}
use of com.google.cloud.dialogflow.cx.v3beta1.FlowName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listTransitionRouteGroupsTest.
@Test
public void listTransitionRouteGroupsTest() {
ListTransitionRouteGroupsRequest routeGroupsRequest = ListTransitionRouteGroupsRequest.newBuilder().setParent(flowName).build();
TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse pagedListResponse = transitionRouteGroupsClient.listTransitionRouteGroups(routeGroupsRequest);
List<TransitionRouteGroup> routeGroups = Lists.newArrayList(pagedListResponse.iterateAll());
boolean isTransitionRouteGroupNameExists = false;
for (TransitionRouteGroup routeGroup : routeGroups) {
if (routeGroup.getName().equals(transitionRouteGroupName)) {
assertTransitionRouteGroupsDetails(routeGroup);
isTransitionRouteGroupNameExists = true;
}
}
assertTrue(isTransitionRouteGroupNameExists);
}
use of com.google.cloud.dialogflow.cx.v3beta1.FlowName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method getFlowTest.
@Test
public void getFlowTest() {
GetFlowRequest request = GetFlowRequest.newBuilder().setName(flowName).build();
Flow flow = flowsClient.getFlow(request);
assertFlowDetails(flow);
}
use of com.google.cloud.dialogflow.cx.v3beta1.FlowName 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);
}
Aggregations