PlainCliOutput implements CliOutput { @Override public void printWorkflow(Workflow wf, WorkflowState state) { System.out.println(Joiner.on(' ').join( wf.componentId(), wf.workflowId(), wf.configuration().schedule(), wf.configuration().offset().orElse(""), wf.configuration().dockerImage().orElse(""), wf.configuration().dockerArgs().orElse(Collections.emptyList()), wf.configuration().dockerTerminationLogging(), wf.configuration().secret().map(s -> s.name() + ':' + s.mountPath()).orElse(""), wf.configuration().serviceAccount().map(Object::toString).orElse(""), wf.configuration().resources(), wf.configuration().env(), wf.configuration().runningTimeout().map(Duration::toString).orElse(""), wf.configuration().commitSha().orElse(""), wf.configuration().retryCondition().orElse(""), state.enabled().map(Object::toString).orElse(""), state.nextNaturalTrigger().map(Object::toString).orElse(""), state.nextNaturalOffsetTrigger().map(Object::toString).orElse(""))); }  @Override void printStates(RunStateDataPayload runStateDataPayload); @Override void printEvents(List<EventInfo> eventInfos); @Override void printBackfill(Backfill backfill, boolean ignored); @Override void printBackfillPayload(BackfillPayload backfillPayload, boolean ignored); @Override void printBackfills(List<BackfillPayload> backfills, boolean ignored); @Override void printResources(List<Resource> resources); @Override void printMessage(String message); @Override void printWorkflow(Workflow wf, WorkflowState state); @Override void printWorkflows(List<Workflow> workflows); @Override void printError(String message);  }
@Test public void shouldPrintWorkflow() { final Workflow workflow = Workflow.create("foo1", WorkflowConfiguration.builder() .id("bar1") .schedule(Schedule.DAYS) .offset("6h") .dockerImage("foo/bar:baz") .dockerArgs(List.of("foo", "the", "bar")) .dockerTerminationLogging(true) .secret(Secret.create("secret-foo", "/foo-secret")) .serviceAccount("foo@bar.baz") .resources("r1", "r2") .env("FOO", "foo", "BAR", "bar") .runningTimeout(Duration.parse("PT20H")) .commitSha("deadbeef") .retryCondition("#tries<2") .build()); final WorkflowState state = WorkflowState.builder() .enabled(true) .nextNaturalTrigger(OffsetDateTime.of(2018, 1, 2, 3, 4, 5, 6, ZoneOffset.UTC).toInstant()) .nextNaturalOffsetTrigger(OffsetDateTime.of(2018, 1, 2, 9, 4, 5, 6, ZoneOffset.UTC).toInstant()) .build(); cliOutput.printWorkflow(workflow, state); assertThat(outContent.toString(), is( "foo1 bar1 DAYS 6h foo/bar:baz [foo, the, bar] true secret-foo:/foo-secret foo@bar.baz [r1, r2] {BAR=bar, " + "FOO=foo} PT20H deadbeef #tries<2 true 2018-01-02T03:04:05.000000006Z 2018-01-02T09:04:05.000000006Z\n")); }