Search in sources :

Example 1 with ZendDbgSettings

use of org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings in project che by eclipse.

the class ZendDbgFactory method create.

@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
    Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
    String breakAtFirstLineProp = normalizedProps.get("break-at-first-line");
    if (breakAtFirstLineProp == null) {
        throw new DebuggerException("Can't establish connection: debug break at first line property is unknown.");
    }
    boolean breakAtFirstLine = Boolean.valueOf(breakAtFirstLineProp);
    String clientHostIPProp = normalizedProps.get("client-host-ip");
    if (clientHostIPProp == null) {
        throw new DebuggerException("Can't establish connection: client host/IP property is unknown.");
    }
    String debugPortProp = normalizedProps.get("debug-port");
    if (debugPortProp == null) {
        throw new DebuggerException("Can't establish connection: debug port property is unknown.");
    }
    int debugPort;
    try {
        debugPort = Integer.parseInt(debugPortProp);
    } catch (NumberFormatException e) {
        throw new DebuggerException("Unknown debug port property format: " + debugPortProp);
    }
    String useSslEncryptionProp = normalizedProps.get("use-ssl-encryption");
    if (useSslEncryptionProp == null) {
        throw new DebuggerException("Can't establish connection: debug use SSL encryption property is unknown.");
    }
    boolean useSslEncryption = Boolean.valueOf(useSslEncryptionProp);
    return new ZendDebugger(new ZendDbgSettings(debugPort, clientHostIPProp, breakAtFirstLine, useSslEncryption), new ZendDbgLocationHandler(), debuggerCallback);
}
Also used : DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) Debugger(org.eclipse.che.api.debugger.server.Debugger) DebuggerFactory(org.eclipse.che.api.debugger.server.DebuggerFactory) ZendDbgSettings(org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings) DebuggerException(org.eclipse.che.api.debugger.server.exceptions.DebuggerException) ZendDbgSettings(org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map)

Example 2 with ZendDbgSettings

use of org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings in project che by eclipse.

the class ZendDbgConfigurationTest method setUp.

@BeforeMethod
public void setUp() throws Exception {
    ZendDbgSettings dbgSettings = new ZendDbgSettings(DEBUG_PORT, DEBUG_HOST, true, false);
    debugger = new ZendDebugger(dbgSettings, null, null);
}
Also used : ZendDbgSettings(org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

ZendDbgSettings (org.eclipse.che.plugin.zdb.server.connection.ZendDbgSettings)2 Map (java.util.Map)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 Debugger (org.eclipse.che.api.debugger.server.Debugger)1 DebuggerFactory (org.eclipse.che.api.debugger.server.DebuggerFactory)1 DebuggerException (org.eclipse.che.api.debugger.server.exceptions.DebuggerException)1 BeforeMethod (org.testng.annotations.BeforeMethod)1