use of com.google.cloud.dialogflow.cx.v3beta1.Agent 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.Agent 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()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.Agent in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listAgentsTest.
@Test
public void listAgentsTest() {
ListAgentsRequest request = ListAgentsRequest.newBuilder().setParent(PARENT.toString()).build();
Iterable<Agent> agents = agentsClient.listAgents(request).iterateAll();
boolean isAgentExists = false;
for (Agent agent : agents) {
if (agentName.equals(agent.getName())) {
assertAgentDetails(agent);
isAgentExists = true;
}
}
assertTrue(isAgentExists);
}
use of com.google.cloud.dialogflow.cx.v3beta1.Agent in project java-dialogflow-cx by googleapis.
the class PagesClientTest method listPagesTest.
@Test
public void listPagesTest() throws Exception {
Page responsesElement = Page.newBuilder().build();
ListPagesResponse expectedResponse = ListPagesResponse.newBuilder().setNextPageToken("").addAllPages(Arrays.asList(responsesElement)).build();
mockPages.addResponse(expectedResponse);
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
ListPagesPagedResponse pagedListResponse = client.listPages(parent);
List<Page> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getPagesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPages.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListPagesRequest actualRequest = ((ListPagesRequest) 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.Agent in project java-dialogflow-cx by googleapis.
the class ExperimentsClientTest method listExperimentsTest.
@Test
public void listExperimentsTest() throws Exception {
Experiment responsesElement = Experiment.newBuilder().build();
ListExperimentsResponse expectedResponse = ListExperimentsResponse.newBuilder().setNextPageToken("").addAllExperiments(Arrays.asList(responsesElement)).build();
mockExperiments.addResponse(expectedResponse);
EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
ListExperimentsPagedResponse pagedListResponse = client.listExperiments(parent);
List<Experiment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getExperimentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockExperiments.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListExperimentsRequest actualRequest = ((ListExperimentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations