Skip to content

Commit

Permalink
CHE-1785: save preview URL for the command
Browse files Browse the repository at this point in the history
Signed-off-by: Valeriy Svydenko <[email protected]>
  • Loading branch information
Valeriy Svydenko committed Jul 26, 2016
1 parent 66cfa38 commit e0b49af
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public void executeCommand(@NotNull final CommandConfiguration configuration, @N
public void apply(String arg) throws OperationException {
final CommandDto command = dtoFactory.createDto(CommandDto.class)
.withName(configuration.getName())
.withAttributes(configuration.getAttributes())
.withCommandLine(arg)
.withType(configuration.getType().getId());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public void apply(List<MachineProcessDto> arg) throws OperationException {
for (MachineProcessDto machineProcessDto : arg) {
final CommandDto commandDto = dtoFactory.createDto(CommandDto.class)
.withName(machineProcessDto.getName())
.withAttributes(machineProcessDto.getAttributes())
.withCommandLine(machineProcessDto.getCommandLine())
.withType(machineProcessDto.getType());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
import com.google.web.bindery.event.shared.EventBus;

import org.eclipse.che.api.core.model.machine.MachineStatus;
import org.eclipse.che.ide.api.machine.DevMachine;
import org.eclipse.che.ide.api.machine.MachineServiceClient;
import org.eclipse.che.ide.api.machine.events.DevMachineStateEvent;
import org.eclipse.che.api.machine.shared.dto.CommandDto;
import org.eclipse.che.api.machine.shared.dto.MachineConfigDto;
import org.eclipse.che.api.machine.shared.dto.MachineDto;
Expand All @@ -28,6 +25,11 @@
import org.eclipse.che.api.promises.client.PromiseError;
import org.eclipse.che.api.workspace.shared.dto.WorkspaceDto;
import org.eclipse.che.ide.api.app.AppContext;
import org.eclipse.che.ide.api.dialogs.ConfirmDialog;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
import org.eclipse.che.ide.api.machine.DevMachine;
import org.eclipse.che.ide.api.machine.MachineServiceClient;
import org.eclipse.che.ide.api.machine.events.DevMachineStateEvent;
import org.eclipse.che.ide.api.notification.NotificationManager;
import org.eclipse.che.ide.api.notification.StatusNotification;
import org.eclipse.che.ide.api.notification.StatusNotification.DisplayMode;
Expand All @@ -47,8 +49,6 @@
import org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandConsoleFactory;
import org.eclipse.che.ide.extension.machine.client.outputspanel.console.CommandOutputConsole;
import org.eclipse.che.ide.extension.machine.client.perspective.terminal.TerminalPresenter;
import org.eclipse.che.ide.api.dialogs.DialogFactory;
import org.eclipse.che.ide.api.dialogs.ConfirmDialog;
import org.eclipse.che.ide.extension.machine.client.processes.actions.ConsoleTreeContextMenuFactory;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -66,6 +66,7 @@
import static org.eclipse.che.ide.extension.machine.client.processes.ProcessTreeNode.ProcessNodeType.ROOT_NODE;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyMap;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
Expand Down Expand Up @@ -186,6 +187,7 @@ public void shouldRestoreState() throws Exception {
when(commandDto.withName(anyString())).thenReturn(commandDto);
when(commandDto.withCommandLine(anyString())).thenReturn(commandDto);
when(commandDto.withType(anyString())).thenReturn(commandDto);
when(commandDto.withAttributes(anyMap())).thenReturn(commandDto);

MachineProcessDto machineProcessDto = mock(MachineProcessDto.class);
when(machineProcessDto.getOutputChannel()).thenReturn(OUTPUT_CHANNEL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
import org.eclipse.che.dto.shared.DTO;

import java.util.List;
import java.util.Map;

/**
* Describes process created from {@link Command} in machine
*
* @author andrew00x
*/
@DTO
public interface MachineProcessDto extends MachineProcess, Hyperlinks {
public interface MachineProcessDto extends CommandDto, MachineProcess, Hyperlinks {
void setPid(int pid);

MachineProcessDto withPid(int pid);
Expand All @@ -51,4 +52,6 @@ public interface MachineProcessDto extends MachineProcess, Hyperlinks {

@Override
MachineProcessDto withLinks(List<Link> links);

MachineProcessDto withAttributes(Map<String, String> attributes);
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public static MachineProcessDto asDto(MachineProcess machineProcess) {
.withCommandLine(machineProcess.getCommandLine())
.withAlive(machineProcess.isAlive())
.withName(machineProcess.getName())
.withAttributes(machineProcess.getAttributes())
.withType(machineProcess.getType())
.withOutputChannel(machineProcess.getOutputChannel())
.withLinks(null);
Expand Down

0 comments on commit e0b49af

Please sign in to comment.