Search in sources :

Example 1 with ListTransitionRouteGroupsRequest

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

the class TransitionRouteGroupsClientTest method listTransitionRouteGroupsTest2.

@Test
public void listTransitionRouteGroupsTest2() throws Exception {
    TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build();
    ListTransitionRouteGroupsResponse expectedResponse = ListTransitionRouteGroupsResponse.newBuilder().setNextPageToken("").addAllTransitionRouteGroups(Arrays.asList(responsesElement)).build();
    mockTransitionRouteGroups.addResponse(expectedResponse);
    String parent = "parent-995424086";
    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, 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 ListTransitionRouteGroupsRequest

use of com.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest 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 3 with ListTransitionRouteGroupsRequest

use of com.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest 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)

Aggregations

Test (org.junit.Test)3 ListTransitionRouteGroupsPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 ListTransitionRouteGroupsRequest (com.google.cloud.dialogflow.cx.v3beta1.ListTransitionRouteGroupsRequest)1 TransitionRouteGroup (com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroup)1 TransitionRouteGroupsClient (com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClient)1