use of org.eclipse.che.ide.api.machine.DevMachine in project che by eclipse.
the class ProjectServiceClientImplTest method setUp.
@Before
public void setUp() throws Exception {
projectServiceClient = new ProjectServiceClientImpl(wsAgentStateController, loaderFactory, asyncRequestFactory, dtoFactory, dtoUnmarshallerFactory, appContext);
DevMachine devMachine = mock(DevMachine.class);
when(devMachine.getWsAgentBaseUrl()).thenReturn("");
when(appContext.getDevMachine()).thenReturn(devMachine);
}
use of org.eclipse.che.ide.api.machine.DevMachine in project che by eclipse.
the class JsonRpcWebSocketAgentEventListener method onWsAgentStopped.
@Override
public void onWsAgentStopped(WsAgentStateEvent event) {
DevMachine devMachine = appContext.getDevMachine();
String devMachineId = devMachine.getId();
Log.debug(JsonRpcWebSocketAgentEventListener.class, "Web socket agent stopped event caught.");
initializer.terminate("ws-agent");
initializer.terminate(devMachineId);
}
use of org.eclipse.che.ide.api.machine.DevMachine in project che by eclipse.
the class DownloadWsActionTest method actionShouldBePerformed.
@Test
public void actionShouldBePerformed() throws Exception {
String baseUrl = "baseUrl";
DevMachine devMachine = mock(DevMachine.class);
when(appContext.getDevMachine()).thenReturn(devMachine);
when(devMachine.getWsAgentBaseUrl()).thenReturn(baseUrl);
when(wsAgentURLModifier.modify(anyString())).thenReturn(baseUrl);
action.actionPerformed(actionEvent);
verify(downloadContainer).setUrl(eq(baseUrl));
}
use of org.eclipse.che.ide.api.machine.DevMachine in project che by eclipse.
the class BaseTest method disarm.
@Before
public void disarm() {
when(project.getName()).thenReturn(PROJECT_NAME);
when(project.getLocation()).thenReturn(Path.valueOf(PROJECT_PATH));
when(gitOutputConsoleFactory.create(anyString())).thenReturn(console);
when(file_1.getLocation()).thenReturn(Path.valueOf(FILE_1_PATH));
when(file_2.getLocation()).thenReturn(Path.valueOf(FILE_2_PATH));
when(folder_1.getLocation()).thenReturn(Path.valueOf(FOLDER_1_PATH));
when(folder_2.getLocation()).thenReturn(Path.valueOf(FOLDER_2_PATH));
when(promiseError.getMessage()).thenReturn("error");
when(promiseError.getCause()).thenReturn(throwable);
when(throwable.getMessage()).thenReturn("error");
when(project.synchronize()).thenReturn(synchronizePromise);
DevMachine devMachine = mock(DevMachine.class);
when(devMachine.getId()).thenReturn("id");
when(appContext.getDevMachine()).thenReturn(devMachine);
}
use of org.eclipse.che.ide.api.machine.DevMachine in project che by eclipse.
the class AddToIndexPresenter method onAddClicked.
/** {@inheritDoc} */
@Override
public void onAddClicked() {
DevMachine devMachine = appContext.getDevMachine();
Resource[] resources = appContext.getResources();
Path projectLocation = appContext.getRootProject().getLocation();
Path[] paths = new Path[resources.length];
for (int i = 0; i < resources.length; i++) {
Path path = resources[i].getLocation().removeFirstSegments(projectLocation.segmentCount());
paths[i] = path.segmentCount() == 0 ? Path.EMPTY : path;
}
final GitOutputConsole console = gitOutputConsoleFactory.create(constant.addToIndexCommandName());
consolesPanelPresenter.addCommandOutput(devMachine.getId(), console);
service.add(devMachine, projectLocation, view.isUpdated(), paths).then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
console.print(constant.addSuccess());
notificationManager.notify(constant.addSuccess());
view.close();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
console.printError(constant.addFailed());
notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE);
view.close();
}
});
}
Aggregations