Search in sources :

Example 1 with IRemoteConnectionWorkingCopy

use of org.eclipse.remote.core.IRemoteConnectionWorkingCopy in project linuxtools by eclipse.

the class AbstractRemoteTest method createJSchConnection.

/**
 * Create a new connection. Save the connection working copy before return.
 *
 * @param connName Connection Name
 * @param connTypeId The connection type identifier
 * @return The created remote connection
 * @throws RemoteConnectionException
 */
protected static IRemoteConnection createJSchConnection(String connName, String connTypeId) throws RemoteConnectionException {
    checkConnectionInfo();
    IRemoteServicesManager manager = getServicesManager();
    IRemoteConnectionType ct = manager.getConnectionType(connTypeId);
    assertNotNull(ct);
    IRemoteConnectionWorkingCopy wc = ct.newConnection(connName);
    wc.setAttribute(JSchConnection.ADDRESS_ATTR, HOST);
    wc.setAttribute(JSchConnection.USERNAME_ATTR, USERNAME);
    wc.setSecureAttribute(JSchConnection.PASSWORD_ATTR, PASSWORD);
    IRemoteConnection conn = wc.save();
    assertNotNull(conn);
    conn.open(new NullProgressMonitor());
    assertTrue(conn.isOpen());
    return conn;
}
Also used : IRemoteConnectionType(org.eclipse.remote.core.IRemoteConnectionType) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IRemoteConnection(org.eclipse.remote.core.IRemoteConnection) IRemoteServicesManager(org.eclipse.remote.core.IRemoteServicesManager) IRemoteConnectionWorkingCopy(org.eclipse.remote.core.IRemoteConnectionWorkingCopy)

Aggregations

NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IRemoteConnection (org.eclipse.remote.core.IRemoteConnection)1 IRemoteConnectionType (org.eclipse.remote.core.IRemoteConnectionType)1 IRemoteConnectionWorkingCopy (org.eclipse.remote.core.IRemoteConnectionWorkingCopy)1 IRemoteServicesManager (org.eclipse.remote.core.IRemoteServicesManager)1