Search in sources :

Example 1 with ListDeploymentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse in project java-dialogflow-cx by googleapis.

the class DeploymentsClientTest method listDeploymentsTest.

@Test
public void listDeploymentsTest() throws Exception {
    Deployment responsesElement = Deployment.newBuilder().build();
    ListDeploymentsResponse expectedResponse = ListDeploymentsResponse.newBuilder().setNextPageToken("").addAllDeployments(Arrays.asList(responsesElement)).build();
    mockDeployments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListDeploymentsPagedResponse pagedListResponse = client.listDeployments(parent);
    List<Deployment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getDeploymentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDeployments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListDeploymentsRequest actualRequest = ((ListDeploymentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListDeploymentsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse) Test(org.junit.Test)

Example 2 with ListDeploymentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse in project java-dialogflow-cx by googleapis.

the class DeploymentsClientTest method listDeploymentsTest.

@Test
public void listDeploymentsTest() throws Exception {
    Deployment responsesElement = Deployment.newBuilder().build();
    ListDeploymentsResponse expectedResponse = ListDeploymentsResponse.newBuilder().setNextPageToken("").addAllDeployments(Arrays.asList(responsesElement)).build();
    mockDeployments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListDeploymentsPagedResponse pagedListResponse = client.listDeployments(parent);
    List<Deployment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getDeploymentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDeployments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListDeploymentsRequest actualRequest = ((ListDeploymentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListDeploymentsPagedResponse(com.google.cloud.dialogflow.cx.v3.DeploymentsClient.ListDeploymentsPagedResponse) Test(org.junit.Test)

Example 3 with ListDeploymentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse in project java-dialogflow-cx by googleapis.

the class DeploymentsClientTest method listDeploymentsTest2.

@Test
public void listDeploymentsTest2() throws Exception {
    Deployment responsesElement = Deployment.newBuilder().build();
    ListDeploymentsResponse expectedResponse = ListDeploymentsResponse.newBuilder().setNextPageToken("").addAllDeployments(Arrays.asList(responsesElement)).build();
    mockDeployments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListDeploymentsPagedResponse pagedListResponse = client.listDeployments(parent);
    List<Deployment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getDeploymentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDeployments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListDeploymentsRequest actualRequest = ((ListDeploymentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListDeploymentsPagedResponse(com.google.cloud.dialogflow.cx.v3.DeploymentsClient.ListDeploymentsPagedResponse) Test(org.junit.Test)

Example 4 with ListDeploymentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse in project java-dialogflow-cx by googleapis.

the class DeploymentsClientTest method listDeploymentsTest2.

@Test
public void listDeploymentsTest2() throws Exception {
    Deployment responsesElement = Deployment.newBuilder().build();
    ListDeploymentsResponse expectedResponse = ListDeploymentsResponse.newBuilder().setNextPageToken("").addAllDeployments(Arrays.asList(responsesElement)).build();
    mockDeployments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListDeploymentsPagedResponse pagedListResponse = client.listDeployments(parent);
    List<Deployment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getDeploymentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDeployments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListDeploymentsRequest actualRequest = ((ListDeploymentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListDeploymentsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClient.ListDeploymentsPagedResponse) Test(org.junit.Test)

Aggregations

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