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()));
}
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()));
}
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()));
}
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()));
}
Aggregations