use of com.google.cloud.dialogflow.v2.SearchAgentsRequest 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.SearchAgentsRequest in project java-dialogflow by googleapis.
the class ITSystemTest method searchAgentsTest.
@Test
public void searchAgentsTest() {
SearchAgentsRequest request = SearchAgentsRequest.newBuilder().setParent(PROJECT_NAME.toString()).build();
for (Agent actualAgent : agentsClient.searchAgents(request).iterateAll()) {
assertEquals(PROJECT_NAME.toString(), actualAgent.getParent());
assertEquals(DISPLAY_NAME, actualAgent.getDisplayName());
assertEquals(DEFAULT_LANGUAGE_CODE, actualAgent.getDefaultLanguageCode());
assertEquals(TIME_ZONE, actualAgent.getTimeZone());
assertEquals(Agent.MatchMode.MATCH_MODE_HYBRID, actualAgent.getMatchMode());
assertEquals(Agent.ApiVersion.API_VERSION_V2, actualAgent.getApiVersion());
assertEquals(Agent.Tier.TIER_STANDARD, actualAgent.getTier());
}
}
use of com.google.cloud.dialogflow.v2.SearchAgentsRequest 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.SearchAgentsRequest 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()));
}
Aggregations