use of com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse in project java-dialogflow-cx by googleapis.
the class WebhooksClientTest method listWebhooksTest2.
@Test
public void listWebhooksTest2() throws Exception {
Webhook responsesElement = Webhook.newBuilder().build();
ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder().setNextPageToken("").addAllWebhooks(Arrays.asList(responsesElement)).build();
mockWebhooks.addResponse(expectedResponse);
String parent = "parent-995424086";
ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent);
List<Webhook> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockWebhooks.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse in project java-dialogflow-cx by googleapis.
the class WebhooksClientTest method listWebhooksTest.
@Test
public void listWebhooksTest() throws Exception {
Webhook responsesElement = Webhook.newBuilder().build();
ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder().setNextPageToken("").addAllWebhooks(Arrays.asList(responsesElement)).build();
mockWebhooks.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent);
List<Webhook> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockWebhooks.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse in project java-dialogflow-cx by googleapis.
the class WebhooksClientTest method listWebhooksTest.
@Test
public void listWebhooksTest() throws Exception {
Webhook responsesElement = Webhook.newBuilder().build();
ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder().setNextPageToken("").addAllWebhooks(Arrays.asList(responsesElement)).build();
mockWebhooks.addResponse(expectedResponse);
AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent);
List<Webhook> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockWebhooks.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse in project java-dialogflow-cx by googleapis.
the class WebhooksClientTest method listWebhooksTest2.
@Test
public void listWebhooksTest2() throws Exception {
Webhook responsesElement = Webhook.newBuilder().build();
ListWebhooksResponse expectedResponse = ListWebhooksResponse.newBuilder().setNextPageToken("").addAllWebhooks(Arrays.asList(responsesElement)).build();
mockWebhooks.addResponse(expectedResponse);
String parent = "parent-995424086";
ListWebhooksPagedResponse pagedListResponse = client.listWebhooks(parent);
List<Webhook> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getWebhooksList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockWebhooks.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListWebhooksRequest actualRequest = ((ListWebhooksRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations