use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class TestServiceClientTest method sucessfulTestsAfterCompilation.
@Test
public void sucessfulTestsAfterCompilation() {
Promise<CommandImpl> compileCommandPromise = createCommandPromise(new CommandImpl("test-compile", "mvn test-compile -f ${current.project.path}", "mvn"));
when(devMachine.getDescriptor()).thenReturn(machine);
Promise<TestResult> resultPromise = testServiceClient.runTestsAfterCompilation(projectPath, testFramework, parameters, statusNotification, compileCommandPromise);
triggerProcessEvents(processStartResponse(true), processStarted(), processStdErr("A small warning"), processStdOut("BUILD SUCCESS"), processDied());
verify(testServiceClient).sendTests(projectPath, testFramework, parameters);
verify(statusNotification).setContent("Compiling the project before starting the test session.");
verify(execAgentCommandManager).startProcess("DevMachineId", new CommandImpl("test-compile", "mvn test-compile -f " + rootOfProjects + "/" + projectPath, "mvn"));
verify(statusNotification).setContent(TestServiceClient.EXECUTING_TESTS_MESSAGE);
resultPromise.then(testResult -> {
Assert.assertNotNull(testResult);
});
ArrayList<String> eventStrings = new ArrayList<>();
for (DtoWithPid event : consoleEvents) {
eventStrings.add(event.toString());
}
Assert.assertEquals(eventStrings, Arrays.asList("Started", "StdErr - A small warning", "StdOut - BUILD SUCCESS", "Died"));
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class CommandProducerAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
CommandImpl command = commandProducer.createCommand(machine);
commandManager.executeCommand(command, machine);
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class EditCommandsPresenter method refreshView.
private void refreshView() {
reset();
List<CommandImpl> allCommands = commandManager.getCommands();
Map<CommandType, List<CommandImpl>> typeToCommands = new HashMap<>();
for (CommandType type : commandTypeRegistry.getCommandTypes()) {
final List<CommandImpl> commandsOfType = new ArrayList<>();
for (CommandImpl command : allCommands) {
if (type.getId().equals(command.getType())) {
commandsOfType.add(command);
}
}
Collections.sort(commandsOfType, commandsComparator);
typeToCommands.put(type, commandsOfType);
}
view.setData(typeToCommands);
view.setFilterState(!allCommands.isEmpty());
if (commandProcessingCallback != null) {
commandProcessingCallback.onCompleted();
commandProcessingCallback = null;
}
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class EditCommandsPresenter method onCommandSelected.
@Override
public void onCommandSelected(final CommandImpl command) {
if (!isViewModified()) {
handleCommandSelection(command);
return;
}
final ConfirmCallback saveCallback = new ConfirmCallback() {
@Override
public void accepted() {
updateCommand(editedCommand).then(new Operation<CommandImpl>() {
@Override
public void apply(CommandImpl arg) throws OperationException {
refreshView();
handleCommandSelection(command);
}
});
}
};
final ConfirmCallback discardCallback = new ConfirmCallback() {
@Override
public void accepted() {
refreshView();
handleCommandSelection(command);
}
};
ChoiceDialog dialog = dialogFactory.createChoiceDialog(machineLocale.editCommandsSaveChangesTitle(), machineLocale.editCommandsSaveChangesConfirmation(editedCommand.getName()), coreLocale.save(), machineLocale.editCommandsSaveChangesDiscard(), saveCallback, discardCallback);
dialog.show();
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class EditCommandsPresenter method onCloseClicked.
@Override
public void onCloseClicked() {
onNameChanged();
final CommandImpl selectedCommand = view.getSelectedCommand();
if (selectedCommand != null && isViewModified()) {
onCommandSelected(selectedCommand);
}
view.close();
}
Aggregations