Search in sources :

Example 1 with ListChangelogsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.

the class ChangelogsClientTest method listChangelogsTest.

@Test
public void listChangelogsTest() throws Exception {
    Changelog responsesElement = Changelog.newBuilder().build();
    ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
    mockChangelogs.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
    List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListChangelogsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse) Test(org.junit.Test)

Example 2 with ListChangelogsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.

the class ChangelogsClientTest method listChangelogsTest.

@Test
public void listChangelogsTest() throws Exception {
    Changelog responsesElement = Changelog.newBuilder().build();
    ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
    mockChangelogs.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
    List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListChangelogsPagedResponse(com.google.cloud.dialogflow.cx.v3.ChangelogsClient.ListChangelogsPagedResponse) Test(org.junit.Test)

Example 3 with ListChangelogsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.

the class ChangelogsClientTest method listChangelogsTest2.

@Test
public void listChangelogsTest2() throws Exception {
    Changelog responsesElement = Changelog.newBuilder().build();
    ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
    mockChangelogs.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
    List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListChangelogsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse) Test(org.junit.Test)

Example 4 with ListChangelogsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClient.ListChangelogsPagedResponse in project java-dialogflow-cx by googleapis.

the class ChangelogsClientTest method listChangelogsTest2.

@Test
public void listChangelogsTest2() throws Exception {
    Changelog responsesElement = Changelog.newBuilder().build();
    ListChangelogsResponse expectedResponse = ListChangelogsResponse.newBuilder().setNextPageToken("").addAllChangelogs(Arrays.asList(responsesElement)).build();
    mockChangelogs.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListChangelogsPagedResponse pagedListResponse = client.listChangelogs(parent);
    List<Changelog> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getChangelogsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockChangelogs.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListChangelogsRequest actualRequest = ((ListChangelogsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListChangelogsPagedResponse(com.google.cloud.dialogflow.cx.v3.ChangelogsClient.ListChangelogsPagedResponse) Test(org.junit.Test)

Aggregations

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