Search in sources :

Example 1 with ListWebhooksPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListWebhooksPagedResponse(com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse) Test(org.junit.Test)

Example 2 with ListWebhooksPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListWebhooksPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse) Test(org.junit.Test)

Example 3 with ListWebhooksPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListWebhooksPagedResponse(com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse) Test(org.junit.Test)

Example 4 with ListWebhooksPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListWebhooksPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListWebhooksPagedResponse (com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse)2 ListWebhooksPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.WebhooksClient.ListWebhooksPagedResponse)2