use of com.google.cloud.workflows.v1.Workflow 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()));
}
use of com.google.cloud.workflows.v1.Workflow in project java-docs-samples by GoogleCloudPlatform.
the class WorkflowsQuickstartTest method deployWorkflow.
private static void deployWorkflow(String projectId, String location, String workflowId) throws IOException, InterruptedException, ExecutionException {
if (workflowsClient == null) {
workflowsClient = WorkflowsClient.create();
}
LocationName parent = LocationName.of(projectId, location);
String source = new String(Files.readAllBytes(Paths.get("src/test/java/com/example/workflows/resources/source.yaml")));
Workflow workflow = Workflow.newBuilder().setSourceContents(source).build();
// Deploy workflow
workflowsClient.createWorkflowAsync(parent, workflow, workflowId).get();
}
use of com.google.cloud.workflows.v1.Workflow 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()));
}
Aggregations