Search in sources :

Example 1 with SearchAgentsPagedResponse

use of com.google.cloud.dialogflow.v2beta1.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchAgentsPagedResponse(com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse) Test(org.junit.Test)

Example 2 with SearchAgentsPagedResponse

use of com.google.cloud.dialogflow.v2beta1.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchAgentsPagedResponse(com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse) Test(org.junit.Test)

Example 3 with SearchAgentsPagedResponse

use of com.google.cloud.dialogflow.v2beta1.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchAgentsPagedResponse(com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse) Test(org.junit.Test)

Example 4 with SearchAgentsPagedResponse

use of com.google.cloud.dialogflow.v2beta1.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchAgentsPagedResponse(com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse) Test(org.junit.Test)

Example 5 with SearchAgentsPagedResponse

use of com.google.cloud.dialogflow.v2beta1.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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) SearchAgentsPagedResponse(com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)6 Test (org.junit.Test)6 SearchAgentsPagedResponse (com.google.cloud.dialogflow.v2.AgentsClient.SearchAgentsPagedResponse)3 SearchAgentsPagedResponse (com.google.cloud.dialogflow.v2beta1.AgentsClient.SearchAgentsPagedResponse)3