use of org.eclipse.linuxtools.internal.profiling.launch.LocalFileProxy in project linuxtools by eclipse.
the class FileProxyTest method testLocalFileProxy.
@Test
public void testLocalFileProxy() {
IRemoteFileProxy fileProxy = null;
try {
fileProxy = proxyManager.getFileProxy(localProject.getProject());
assertTrue("Should have returned a remote launcher", fileProxy instanceof LocalFileProxy);
} catch (CoreException e) {
fail("Should have returned a launcher: " + e.getCause());
}
/*
* Test getDirectorySeparator()
*/
String ds = fileProxy.getDirectorySeparator();
assertNotNull(ds);
/*
* Test getResource()
*/
IFileStore actualFileStore = fileProxy.getResource(localProject.getProject().getLocation().toOSString());
assertNotNull(actualFileStore);
IFileStore expectedFileStore = null;
try {
expectedFileStore = EFS.getStore(localProject.getLocationURI());
} catch (CoreException e) {
fail("Unabled to get FileStore to local project: " + e.getMessage());
}
assertEquals("FileStore to local project folder diverge", expectedFileStore, actualFileStore);
assertTrue(actualFileStore.fetchInfo().isDirectory());
actualFileStore = fileProxy.getResource("/filenotexits");
assertNotNull(actualFileStore);
IFileInfo fileInfo = actualFileStore.fetchInfo();
assertNotNull(fileInfo);
assertFalse(fileInfo.exists());
/*
* Test getWorkingDir()
*/
URI workingDir = fileProxy.getWorkingDir();
assertNotNull(workingDir);
assertEquals(localProject.getLocationURI(), workingDir);
/*
* Test toPath()
*/
assertEquals(localProject.getProject().getLocation().toOSString(), fileProxy.toPath(localProject.getLocationURI()));
}
use of org.eclipse.linuxtools.internal.profiling.launch.LocalFileProxy 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);
}
}
Aggregations