Search in sources :

Example 1 with ListSessionEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow-cx by googleapis.

the class SessionEntityTypesClientTest method listSessionEntityTypesTest2.

@Test
public void listSessionEntityTypesTest2() throws Exception {
    SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
    ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
    mockSessionEntityTypes.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
    List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListSessionEntityTypesPagedResponse(com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListSessionEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow-cx by googleapis.

the class SessionEntityTypesClientTest method listSessionEntityTypesTest.

@Test
public void listSessionEntityTypesTest() throws Exception {
    SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
    ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
    mockSessionEntityTypes.addResponse(expectedResponse);
    SessionName parent = SessionName.ofProjectLocationAgentSessionName("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]");
    ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
    List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListSessionEntityTypesPagedResponse(com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 3 with ListSessionEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class SessionEntityTypesClientTest method listSessionEntityTypesTest2.

@Test
public void listSessionEntityTypesTest2() throws Exception {
    SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
    ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
    mockSessionEntityTypes.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
    List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListSessionEntityTypesPagedResponse(com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 4 with ListSessionEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class SessionEntityTypesClientTest method listSessionEntityTypesTest.

@Test
public void listSessionEntityTypesTest() throws Exception {
    SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
    ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
    mockSessionEntityTypes.addResponse(expectedResponse);
    SessionName parent = SessionName.ofProjectSessionName("[PROJECT]", "[SESSION]");
    ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
    List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListSessionEntityTypesPagedResponse(com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 5 with ListSessionEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class SessionEntityTypesClientTest method listSessionEntityTypesTest2.

@Test
public void listSessionEntityTypesTest2() throws Exception {
    SessionEntityType responsesElement = SessionEntityType.newBuilder().build();
    ListSessionEntityTypesResponse expectedResponse = ListSessionEntityTypesResponse.newBuilder().setNextPageToken("").addAllSessionEntityTypes(Arrays.asList(responsesElement)).build();
    mockSessionEntityTypes.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListSessionEntityTypesPagedResponse pagedListResponse = client.listSessionEntityTypes(parent);
    List<SessionEntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getSessionEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockSessionEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListSessionEntityTypesRequest actualRequest = ((ListSessionEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListSessionEntityTypesPagedResponse(com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)8 Test (org.junit.Test)8 ListSessionEntityTypesPagedResponse (com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse)2 ListSessionEntityTypesPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse)2 ListSessionEntityTypesPagedResponse (com.google.cloud.dialogflow.v2.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse)2 ListSessionEntityTypesPagedResponse (com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClient.ListSessionEntityTypesPagedResponse)2