ListActivitiCommand extends ActivitiCommand { @Override protected Object doExecute() throws Exception { ProcessEngine pe = this.getProcessEngine(); if (pe == null) { out().println("Process Engine NOT Found!"); return null; } if (!(this.active || this.definitions || this.history || this.deployments)) { this.active = this.definitions = this.history = this.deployments = true; } if (this.deployments) { RepositoryService repo = pe.getRepositoryService(); printDeployments(out(), repo); } if (this.definitions) { RepositoryService repo = pe.getRepositoryService(); printProcessDefinitions(out(), repo); } if (this.history) { HistoryService his = pe.getHistoryService(); boolean printActive = !this.active; printHistoricProcessInstances(out(), his, printActive); } if (this.active) { RuntimeService rt = pe.getRuntimeService(); printActiveProcessInstances(out(), rt); } return null; }    }
@Test @Deployment(resources = {"diagrams/test-bpm-1.bpmn20.xml", "diagrams/test-bpm-2.bpmn20.xml", "diagrams/test-bpm-3.bpmn20.xml"}) public void testListCommand() throws Exception { ListActivitiCommand command = new ListActivitiCommand(); command.setProcessEngine(getProcessEngine()); command.setOut(getOut()); command.setErr(getErr()); command.doExecute(); assertThat(collectStdOutput()) .contains("[diagrams/test-bpm-2.bpmn20.xml]") .contains("[diagrams/test-bpm-3.bpmn20.xml]") .contains("[diagrams/test-bpm-1.bpmn20.xml]") .contains("[ListActivitiCommandTest.testListCommand]"); }