Search in sources :

Example 1 with SSHFileProxy

use of org.eclipse.linuxtools.internal.ssh.proxy.SSHFileProxy in project linuxtools by eclipse.

the class RemoteProxyManagerTest method testGetFileProxy.

@Test
public void testGetFileProxy() {
    IRemoteFileProxy fp;
    try {
        /*
			 * Test the proxy for local URIs and project
			 */
        fp = proxyManager.getFileProxy(URI.create("/path/to/file"));
        assertTrue("Should return a local file proxy", fp instanceof LocalFileProxy);
        fp = proxyManager.getFileProxy(URI.create("file:/path/to/file"));
        assertTrue("Should return a local file proxy", fp instanceof LocalFileProxy);
        fp = proxyManager.getFileProxy(localProject.getLocationURI());
        assertTrue("Should return a local file proxy", fp instanceof LocalFileProxy);
        fp = proxyManager.getFileProxy(localProject.getProject());
        assertTrue("Should return a local file proxy", fp instanceof LocalFileProxy);
        /*
			 * Test the proxy for remote URIs and project
			 */
        fp = proxyManager.getFileProxy(URI.create("ssh://" + CONNECTION_NAME + "/path/to/file"));
        assertTrue("Should have returned a remote file proxy", fp instanceof RDTFileProxy);
        fp = proxyManager.getFileProxy(syncProject.getProject());
        assertTrue("Should have returned a remote file proxy", fp instanceof RDTFileProxy);
        /*
			 * Test the proxy for jsch connection scheme
			 */
        fp = proxyManager.getFileProxy(URI.create("jsch://" + USERNAME + "@" + HOST + ":22/path/to/file"));
        assertTrue("Should have returned a remote file proxy", fp instanceof SSHFileProxy);
    } catch (CoreException e) {
        fail("Should have returned a file proxy: " + e.getCause());
    }
    /*
		 * Test the proxy for unsupported URIs
		 */
    try {
        // As of org.eclipse.remote 2.0, remotetools scheme is no longer
        // support
        fp = proxyManager.getFileProxy(URI.create("remotetools://MyConnection/path/to/file"));
        fail("remotetools scheme should not be recognized");
    } catch (CoreException e) {
        assertTrue(e.getMessage(), true);
    }
}
Also used : LocalFileProxy(org.eclipse.linuxtools.internal.profiling.launch.LocalFileProxy) CoreException(org.eclipse.core.runtime.CoreException) SSHFileProxy(org.eclipse.linuxtools.internal.ssh.proxy.SSHFileProxy) IRemoteFileProxy(org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy) RDTFileProxy(org.eclipse.linuxtools.internal.rdt.proxy.RDTFileProxy) AbstractProxyTest(org.eclipse.linuxtools.remote.proxy.tests.AbstractProxyTest) Test(org.junit.Test)

Aggregations

CoreException (org.eclipse.core.runtime.CoreException)1 LocalFileProxy (org.eclipse.linuxtools.internal.profiling.launch.LocalFileProxy)1 RDTFileProxy (org.eclipse.linuxtools.internal.rdt.proxy.RDTFileProxy)1 SSHFileProxy (org.eclipse.linuxtools.internal.ssh.proxy.SSHFileProxy)1 IRemoteFileProxy (org.eclipse.linuxtools.profiling.launch.IRemoteFileProxy)1 AbstractProxyTest (org.eclipse.linuxtools.remote.proxy.tests.AbstractProxyTest)1 Test (org.junit.Test)1