use of com.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listEntityTypesTest.
@Test
public void listEntityTypesTest() {
ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder().setParent(agentName).build();
Iterable<EntityType> entityTypes = entityTypesClient.listEntityTypes(request).iterateAll();
boolean isEntityTypeExists = false;
for (EntityType entityType : entityTypes) {
if (entityTypesName.equals(entityType.getName())) {
assertEntityTypesDetails(entityType);
isEntityTypeExists = true;
}
}
assertTrue(isEntityTypeExists);
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest in project java-dialogflow by googleapis.
the class ITSystemTest method listEntityTypesTest.
@Test
public void listEntityTypesTest() {
ListEntityTypesRequest request = ListEntityTypesRequest.newBuilder().setParent(PROJECT_AGENT_NAME.toString()).build();
for (EntityType actualEntity : entityTypesClient.listEntityTypes(request).iterateAll()) {
if (entityType.getName().equals(actualEntity.getName())) {
assertEquals(entityType.getName(), actualEntity.getName());
assertEquals(ENTITY_NAME, actualEntity.getDisplayName());
assertEquals(entityType.getEntities(0), actualEntity.getEntities(0));
assertEquals(1, actualEntity.getEntitiesCount());
}
}
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest 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()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListEntityTypesRequest in project java-dialogflow-cx 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()));
}
Aggregations