Search in sources :

Example 1 with FlowName

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()));
}
Also used : ListTransitionRouteGroupsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with FlowName

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();
}
Also used : DeleteFlowRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest) DeleteTransitionRouteGroupRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest) DeletePageRequest(com.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest) DeleteEntityTypeRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest) DeleteAgentRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest) DeleteVersionRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest) DeleteIntentRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest) AfterClass(org.junit.AfterClass)

Example 3 with FlowName

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);
}
Also used : ListTransitionRouteGroupsRequest(com.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest) TransitionRouteGroup(com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup) TransitionRouteGroupsClient(com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient) Test(org.junit.Test)

Example 4 with FlowName

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);
}
Also used : GetFlowRequest(com.google.cloud.dialogflow.cx.v3beta1.GetFlowRequest) Flow(com.google.cloud.dialogflow.cx.v3beta1.Flow) Test(org.junit.Test)

Example 5 with FlowName

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);
}
Also used : FlowsClient(com.google.cloud.dialogflow.cx.v3beta1.FlowsClient) ListFlowsRequest(com.google.cloud.dialogflow.cx.v3beta1.ListFlowsRequest) Flow(com.google.cloud.dialogflow.cx.v3beta1.Flow) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 Flow (com.google.cloud.dialogflow.cx.v3beta1.Flow)3 Page (com.google.cloud.dialogflow.cx.v3beta1.Page)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 PagesClient (com.google.cloud.dialogflow.cx.v3beta1.PagesClient)2 TransitionRouteGroup (com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup)2 Version (com.google.cloud.dialogflow.cx.v3beta1.Version)2 Agent (com.google.cloud.dialogflow.cx.v3beta1.Agent)1 CreateEntityTypeRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest)1 CreateFlowRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest)1 CreateIntentRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest)1 CreatePageRequest (com.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest)1 CreateTransitionRouteGroupRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest)1 CreateVersionRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest)1 DeleteAgentRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest)1 DeleteEntityTypeRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest)1 DeleteFlowRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest)1 DeleteIntentRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest)1 DeletePageRequest (com.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest)1 DeleteTransitionRouteGroupRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest)1