Search in sources :

Example 11 with CommandImpl

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"));
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) DtoWithPid(org.eclipse.che.api.machine.shared.dto.execagent.event.DtoWithPid) ArrayList(java.util.ArrayList) TestResult(org.eclipse.che.api.testing.shared.TestResult) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 12 with CommandImpl

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);
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl)

Example 13 with CommandImpl

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;
    }
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) HashMap(java.util.HashMap) CommandType(org.eclipse.che.ide.api.command.CommandType) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 14 with CommandImpl

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();
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) ChoiceDialog(org.eclipse.che.ide.api.dialogs.ChoiceDialog) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 15 with CommandImpl

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();
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl)

Aggregations

CommandImpl (org.eclipse.che.ide.api.command.CommandImpl)28 OperationException (org.eclipse.che.api.promises.client.OperationException)9 CommandType (org.eclipse.che.ide.api.command.CommandType)6 ArrayList (java.util.ArrayList)5 PromiseError (org.eclipse.che.api.promises.client.PromiseError)5 Test (org.junit.Test)5 TestResult (org.eclipse.che.api.testing.shared.TestResult)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Operation (org.eclipse.che.api.promises.client.Operation)3 ConfirmCallback (org.eclipse.che.ide.api.dialogs.ConfirmCallback)3 CommandOutputConsole (org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole)3 Matchers.anyString (org.mockito.Matchers.anyString)3 MatchResult (com.google.gwt.regexp.shared.MatchResult)2 Machine (org.eclipse.che.api.core.model.machine.Machine)2 ChoiceDialog (org.eclipse.che.ide.api.dialogs.ChoiceDialog)2 URL (com.google.gwt.http.client.URL)1 RegExp (com.google.gwt.regexp.shared.RegExp)1 Inject (com.google.inject.Inject)1 Singleton (com.google.inject.Singleton)1