Search in sources :

Example 1 with ListEnvironmentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listEnvironmentsTest2.

@Test
public void listEnvironmentsTest2() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEnvironmentsPagedResponse(com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse) Test(org.junit.Test)

Example 2 with ListEnvironmentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listEnvironmentsTest.

@Test
public void listEnvironmentsTest() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEnvironmentsPagedResponse(com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse) Test(org.junit.Test)

Example 3 with ListEnvironmentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse in project java-orchestration-airflow by googleapis.

the class EnvironmentsClientTest method listEnvironmentsTest.

@Test
public void listEnvironmentsTest() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEnvironmentsPagedResponse(com.google.cloud.orchestration.airflow.service.v1.EnvironmentsClient.ListEnvironmentsPagedResponse) Test(org.junit.Test)

Example 4 with ListEnvironmentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse in project java-dialogflow by googleapis.

the class EnvironmentsClientTest method listEnvironmentsTest.

@Test
public void listEnvironmentsTest() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    AgentName parent = AgentName.ofProjectAgentName("[PROJECT]");
    ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEnvironmentsPagedResponse(com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse) Test(org.junit.Test)

Example 5 with ListEnvironmentsPagedResponse

use of com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse in project java-dialogflow by googleapis.

the class EnvironmentsClientTest method listEnvironmentsTest2.

@Test
public void listEnvironmentsTest2() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    ListEnvironmentsResponse expectedResponse = ListEnvironmentsResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListEnvironmentsPagedResponse pagedListResponse = client.listEnvironments(parent);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEnvironmentsRequest actualRequest = ((ListEnvironmentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEnvironmentsPagedResponse(com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)10 Test (org.junit.Test)10 ListEnvironmentsPagedResponse (com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListEnvironmentsPagedResponse)2 ListEnvironmentsPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClient.ListEnvironmentsPagedResponse)2 ListEnvironmentsPagedResponse (com.google.cloud.dialogflow.v2.EnvironmentsClient.ListEnvironmentsPagedResponse)2 ListEnvironmentsPagedResponse (com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse)2 ListEnvironmentsPagedResponse (com.google.cloud.orchestration.airflow.service.v1.EnvironmentsClient.ListEnvironmentsPagedResponse)1 ListEnvironmentsPagedResponse (com.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentsClient.ListEnvironmentsPagedResponse)1