Search in sources :

Example 6 with DebuggerInfo

use of org.eclipse.che.api.debug.shared.model.DebuggerInfo in project che by eclipse.

the class AbstractDebugger method connect.

@Override
public Promise<Void> connect(Map<String, String> connectionProperties) {
    if (isConnected()) {
        return Promises.reject(JsPromiseError.create("Debugger already connected"));
    }
    Promise<DebugSessionDto> connect = service.connect(debuggerType, connectionProperties);
    final DebuggerDescriptor debuggerDescriptor = toDescriptor(connectionProperties);
    Promise<Void> promise = connect.then(new Function<DebugSessionDto, Void>() {

        @Override
        public Void apply(final DebugSessionDto arg) throws FunctionException {
            DebuggerInfo debuggerInfo = arg.getDebuggerInfo();
            debuggerDescriptor.setInfo(debuggerInfo.getName() + " " + debuggerInfo.getVersion());
            setDebugSession(arg);
            preserveDebuggerState();
            startCheckingEvents();
            startDebugger(arg);
            return null;
        }
    }).catchError(new Operation<PromiseError>() {

        @Override
        public void apply(PromiseError arg) throws OperationException {
            Log.error(AbstractDebugger.class, arg.getMessage());
            throw new OperationException(arg.getCause());
        }
    });
    for (DebuggerObserver observer : observers) {
        observer.onDebuggerAttached(debuggerDescriptor, promise);
    }
    return promise;
}
Also used : DebuggerInfo(org.eclipse.che.api.debug.shared.model.DebuggerInfo) DebuggerDescriptor(org.eclipse.che.ide.debug.DebuggerDescriptor) Function(org.eclipse.che.api.promises.client.Function) JsPromiseError(org.eclipse.che.api.promises.client.js.JsPromiseError) PromiseError(org.eclipse.che.api.promises.client.PromiseError) DebugSessionDto(org.eclipse.che.api.debug.shared.dto.DebugSessionDto) DebuggerObserver(org.eclipse.che.ide.debug.DebuggerObserver) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 7 with DebuggerInfo

use of org.eclipse.che.api.debug.shared.model.DebuggerInfo in project che by eclipse.

the class ZendDbgConfigurationTest method testGetInfo.

@Test(groups = { "zendDbg" }, dependsOnGroups = { "checkPHP" })
public void testGetInfo() throws Exception {
    DebuggerInfo info = debugger.getInfo();
    assertTrue(info.getFile() == null);
    assertTrue(isNullOrEmpty(info.getVersion()));
    assertTrue(info.getName().equals("Zend Debugger"));
    assertTrue(info.getPid() == 0);
    assertTrue(info.getHost().equals(DEBUG_HOST));
    assertTrue(info.getPort() == DEBUG_PORT);
}
Also used : DebuggerInfo(org.eclipse.che.api.debug.shared.model.DebuggerInfo) Test(org.testng.annotations.Test)

Aggregations

DebuggerInfo (org.eclipse.che.api.debug.shared.model.DebuggerInfo)7 DebugSessionDto (org.eclipse.che.api.debug.shared.dto.DebugSessionDto)3 Test (org.testng.annotations.Test)3 OperationException (org.eclipse.che.api.promises.client.OperationException)2 PromiseError (org.eclipse.che.api.promises.client.PromiseError)2 JsPromiseError (org.eclipse.che.api.promises.client.js.JsPromiseError)2 DebuggerDescriptor (org.eclipse.che.ide.debug.DebuggerDescriptor)2 DebuggerObserver (org.eclipse.che.ide.debug.DebuggerObserver)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 DebuggerEventDto (org.eclipse.che.api.debug.shared.dto.event.DebuggerEventDto)1 VariablePath (org.eclipse.che.api.debug.shared.model.VariablePath)1 Function (org.eclipse.che.api.promises.client.Function)1 Operation (org.eclipse.che.api.promises.client.Operation)1 Promise (org.eclipse.che.api.promises.client.Promise)1 JsPromise (org.eclipse.che.api.promises.client.js.JsPromise)1 WsAgentStateEvent (org.eclipse.che.ide.api.machine.events.WsAgentStateEvent)1 WsAgentStateHandler (org.eclipse.che.ide.api.machine.events.WsAgentStateHandler)1 WebSocketException (org.eclipse.che.ide.websocket.WebSocketException)1