use of com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse in project java-dialogflow by googleapis.
the class AgentsClientTest method searchAgentsTest3.
@Test
public void searchAgentsTest3() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
SearchAgentsResponse expectedResponse = SearchAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
String parent = "parent-995424086";
SearchAgentsPagedResponse pagedListResponse = client.searchAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchAgentsRequest actualRequest = ((SearchAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse in project java-dialogflow by googleapis.
the class AgentsClientTest method searchAgentsTest.
@Test
public void searchAgentsTest() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
SearchAgentsResponse expectedResponse = SearchAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SearchAgentsPagedResponse pagedListResponse = client.searchAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchAgentsRequest actualRequest = ((SearchAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse in project java-dialogflow by googleapis.
the class AgentsClientTest method searchAgentsTest2.
@Test
public void searchAgentsTest2() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
SearchAgentsResponse expectedResponse = SearchAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
SearchAgentsPagedResponse pagedListResponse = client.searchAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchAgentsRequest actualRequest = ((SearchAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse in project java-dialogflow by googleapis.
the class AgentsClientTest method searchAgentsTest.
@Test
public void searchAgentsTest() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
SearchAgentsResponse expectedResponse = SearchAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
SearchAgentsPagedResponse pagedListResponse = client.searchAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchAgentsRequest actualRequest = ((SearchAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse in project java-dialogflow by googleapis.
the class AgentsClientTest method searchAgentsTest2.
@Test
public void searchAgentsTest2() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
SearchAgentsResponse expectedResponse = SearchAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
ProjectName parent = ProjectName.of("[PROJECT]");
SearchAgentsPagedResponse pagedListResponse = client.searchAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
SearchAgentsRequest actualRequest = ((SearchAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations