Search in sources :

Example 1 with ListWorkflowsPagedResponse

use of com.google.cloud.workflows.v1.WorkflowsClient.ListWorkflowsPagedResponse in project java-workflows by googleapis.

the class WorkflowsClientTest method listWorkflowsTest2.

@Test
public void listWorkflowsTest2() throws Exception {
    Workflow responsesElement = Workflow.newBuilder().build();
    ListWorkflowsResponse expectedResponse = ListWorkflowsResponse.newBuilder().setNextPageToken("").addAllWorkflows(Arrays.asList(responsesElement)).build();
    mockWorkflows.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListWorkflowsPagedResponse pagedListResponse = client.listWorkflows(parent);
    List<Workflow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getWorkflowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockWorkflows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListWorkflowsRequest actualRequest = ((ListWorkflowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListWorkflowsPagedResponse(com.google.cloud.workflows.v1.WorkflowsClient.ListWorkflowsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListWorkflowsPagedResponse

use of com.google.cloud.workflows.v1.WorkflowsClient.ListWorkflowsPagedResponse in project java-workflows by googleapis.

the class WorkflowsClientTest method listWorkflowsTest.

@Test
public void listWorkflowsTest() throws Exception {
    Workflow responsesElement = Workflow.newBuilder().build();
    ListWorkflowsResponse expectedResponse = ListWorkflowsResponse.newBuilder().setNextPageToken("").addAllWorkflows(Arrays.asList(responsesElement)).build();
    mockWorkflows.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListWorkflowsPagedResponse pagedListResponse = client.listWorkflows(parent);
    List<Workflow> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getWorkflowsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockWorkflows.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListWorkflowsRequest actualRequest = ((ListWorkflowsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListWorkflowsPagedResponse(com.google.cloud.workflows.v1.WorkflowsClient.ListWorkflowsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

ListWorkflowsPagedResponse (com.google.cloud.workflows.v1.WorkflowsClient.ListWorkflowsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2