Search in sources :

Example 1 with ListEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse in project java-dialogflow-cx by googleapis.

the class EntityTypesClientTest method listEntityTypesTest.

@Test
public void listEntityTypesTest() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Example 2 with ListEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class EntityTypesClientTest method listEntityTypesTest3.

@Test
public void listEntityTypesTest3() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    AgentName parent = AgentName.ofProjectName("[PROJECT]");
    String languageCode = "languageCode-2092349083";
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent, languageCode);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Example 3 with ListEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class EntityTypesClientTest method listEntityTypesTest.

@Test
public void listEntityTypesTest() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    AgentName parent = AgentName.ofProjectName("[PROJECT]");
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Example 4 with ListEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class EntityTypesClientTest method listEntityTypesTest4.

@Test
public void listEntityTypesTest4() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    String parent = "parent-995424086";
    String languageCode = "languageCode-2092349083";
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent, languageCode);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(languageCode, actualRequest.getLanguageCode());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Example 5 with ListEntityTypesPagedResponse

use of com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse in project java-dialogflow by googleapis.

the class EntityTypesClientTest method listEntityTypesTest2.

@Test
public void listEntityTypesTest2() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)12 Test (org.junit.Test)12 ListEntityTypesPagedResponse (com.google.cloud.dialogflow.v2.EntityTypesClient.ListEntityTypesPagedResponse)4 ListEntityTypesPagedResponse (com.google.cloud.dialogflow.v2beta1.EntityTypesClient.ListEntityTypesPagedResponse)4 ListEntityTypesPagedResponse (com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse)2 ListEntityTypesPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClient.ListEntityTypesPagedResponse)2