Search in sources :

Example 1 with ListWorkflowTemplatesPagedResponse

use of com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse in project java-dataproc by googleapis.

the class WorkflowTemplateServiceClientTest method listWorkflowTemplatesTest.

@Test
public void listWorkflowTemplatesTest() throws Exception {
    WorkflowTemplate responsesElement = WorkflowTemplate.newBuilder().build();
    ListWorkflowTemplatesResponse expectedResponse = ListWorkflowTemplatesResponse.newBuilder().setNextPageToken("").addAllTemplates(Arrays.asList(responsesElement)).build();
    mockWorkflowTemplateService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListWorkflowTemplatesPagedResponse pagedListResponse = client.listWorkflowTemplates(parent);
    List<WorkflowTemplate> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTemplatesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockWorkflowTemplateService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListWorkflowTemplatesRequest actualRequest = ((ListWorkflowTemplatesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListWorkflowTemplatesPagedResponse(com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 2 with ListWorkflowTemplatesPagedResponse

use of com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse in project java-dataproc by googleapis.

the class WorkflowTemplateServiceClientTest method listWorkflowTemplatesTest2.

@Test
public void listWorkflowTemplatesTest2() throws Exception {
    WorkflowTemplate responsesElement = WorkflowTemplate.newBuilder().build();
    ListWorkflowTemplatesResponse expectedResponse = ListWorkflowTemplatesResponse.newBuilder().setNextPageToken("").addAllTemplates(Arrays.asList(responsesElement)).build();
    mockWorkflowTemplateService.addResponse(expectedResponse);
    RegionName parent = RegionName.of("[PROJECT]", "[REGION]");
    ListWorkflowTemplatesPagedResponse pagedListResponse = client.listWorkflowTemplates(parent);
    List<WorkflowTemplate> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTemplatesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockWorkflowTemplateService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListWorkflowTemplatesRequest actualRequest = ((ListWorkflowTemplatesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListWorkflowTemplatesPagedResponse(com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 3 with ListWorkflowTemplatesPagedResponse

use of com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse in project java-dataproc by googleapis.

the class WorkflowTemplateServiceClientTest method listWorkflowTemplatesTest3.

@Test
public void listWorkflowTemplatesTest3() throws Exception {
    WorkflowTemplate responsesElement = WorkflowTemplate.newBuilder().build();
    ListWorkflowTemplatesResponse expectedResponse = ListWorkflowTemplatesResponse.newBuilder().setNextPageToken("").addAllTemplates(Arrays.asList(responsesElement)).build();
    mockWorkflowTemplateService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListWorkflowTemplatesPagedResponse pagedListResponse = client.listWorkflowTemplates(parent);
    List<WorkflowTemplate> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTemplatesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockWorkflowTemplateService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListWorkflowTemplatesRequest actualRequest = ((ListWorkflowTemplatesRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListWorkflowTemplatesPagedResponse(com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Aggregations

ListWorkflowTemplatesPagedResponse (com.google.cloud.dataproc.v1.WorkflowTemplateServiceClient.ListWorkflowTemplatesPagedResponse)3 AbstractMessage (com.google.protobuf.AbstractMessage)3 Test (org.junit.Test)3