use of com.google.cloud.dialogflow.cx.v3beta1.AgentName in project java-dialogflow-cx by googleapis.
the class ChangelogsClientTest method listChangelogsTest.
@Test
public void listChangelogsTest() throws Exception {
Changelog responsesElement = Changelog.newBuilder().build();
ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
mockChangelogs.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListChangelogsRequest actualRequest = ((ListChangelogsRequest) 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.AgentName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method tearDown.
@AfterClass
public static void tearDown() {
/* delete version */
DeleteVersionRequest deleteVersionRequest = DeleteVersionRequest.newBuilder().setName(versionName).build();
versionsClient.deleteVersion(deleteVersionRequest);
versionsClient.close();
/* delete transition route groups */
DeleteTransitionRouteGroupRequest deleteTransitionRouteGroupRequest = DeleteTransitionRouteGroupRequest.newBuilder().setName(transitionRouteGroupName).build();
transitionRouteGroupsClient.deleteTransitionRouteGroup(deleteTransitionRouteGroupRequest);
transitionRouteGroupsClient.close();
/* delete session */
sessionsClient.close();
/* delete pages */
DeletePageRequest deletePageRequest = DeletePageRequest.newBuilder().setName(pageName).build();
pagesClient.deletePage(deletePageRequest);
pagesClient.close();
/* delete intents */
DeleteIntentRequest deleteIntentRequest = DeleteIntentRequest.newBuilder().setName(intentsName).build();
intentsClient.deleteIntent(deleteIntentRequest);
intentsClient.close();
/* delete flows */
DeleteFlowRequest deleteFlowRequest = DeleteFlowRequest.newBuilder().setName(flowName).build();
flowsClient.deleteFlow(deleteFlowRequest);
DeleteFlowRequest deleteTrainFlowRequest = DeleteFlowRequest.newBuilder().setName(trainFlowName).build();
flowsClient.deleteFlow(deleteTrainFlowRequest);
flowsClient.close();
/* delete entity types */
DeleteEntityTypeRequest deleteEntityTypeRequest = DeleteEntityTypeRequest.newBuilder().setName(entityTypesName).build();
entityTypesClient.deleteEntityType(deleteEntityTypeRequest);
entityTypesClient.close();
/* delete agents */
DeleteAgentRequest deleteAgentRequest = DeleteAgentRequest.newBuilder().setName(agentName).build();
agentsClient.deleteAgent(deleteAgentRequest);
agentsClient.close();
}
use of com.google.cloud.dialogflow.cx.v3beta1.AgentName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method matchIntentTest.
@Test
public void matchIntentTest() {
String session = String.format("%s/sessions/%s", agentName, ID);
MatchIntentRequest request = MatchIntentRequest.newBuilder().setSession(session).setQueryInput(QUERY_INPUT).build();
MatchIntentResponse matchIntentResponse = sessionsClient.matchIntent(request);
assertTrue(matchIntentResponse.getMatchesList().size() > 0);
assertEquals(TEXT, matchIntentResponse.getText());
}
use of com.google.cloud.dialogflow.cx.v3beta1.AgentName 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.AgentName in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listFlowsTest.
@Test
public void listFlowsTest() {
ListFlowsRequest request = ListFlowsRequest.newBuilder().setParent(agentName).build();
FlowsClient.ListFlowsPagedResponse pagedListResponse = flowsClient.listFlows(request);
List<Flow> flows = Lists.newArrayList(pagedListResponse.iterateAll());
boolean isFlowExists = false;
for (Flow flow : flows) {
if (flow.getName().equals(flowName)) {
assertFlowDetails(flow);
isFlowExists = true;
}
}
assertTrue(isFlowExists);
}
Aggregations