Search in sources :

Example 11 with FlowName

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

the class VersionsClientTest method listVersionsTest.

@Test
public void listVersionsTest() throws Exception {
    Version responsesElement = Version.newBuilder().build();
    ListVersionsResponse expectedResponse = ListVersionsResponse.newBuilder().setNextPageToken("").addAllVersions(Arrays.asList(responsesElement)).build();
    mockVersions.addResponse(expectedResponse);
    FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
    ListVersionsPagedResponse pagedListResponse = client.listVersions(parent);
    List<Version> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockVersions.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListVersionsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) 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