@Override protected void setUp() throws Exception { File baseTempFile = File.createTempFile("test", ".txt"); // $NON-NLS-1$ //$NON-NLS-2$ baseTempFile.deleteOnExit(); File baseDirectory = baseTempFile.getParentFile(); LocalConnectionPoint lcp = new LocalConnectionPoint(); lcp.setPath(new Path(baseDirectory.getAbsolutePath())); clientManager = lcp; SFTPConnectionPoint ftpcp = new SFTPConnectionPoint(); ftpcp.setHost(getConfig().getProperty("sftp.host")); // $NON-NLS-1$ ftpcp.setLogin(getConfig().getProperty("sftp.username")); // $NON-NLS-1$ ftpcp.setPassword(getConfig().getProperty("sftp.password").toCharArray()); ftpcp.setPort( Integer.valueOf(getConfig().getProperty("sftp.port", "22"))); // $NON-NLS-1$ //$NON-NLS-2$ ftpcp.setPath(Path.fromPortableString(getConfig().getProperty("sftp.path"))); // $NON-NLS-1$ serverManager = ftpcp; ConnectionContext context = new ConnectionContext(); context.put(ConnectionContext.COMMAND_LOG, System.out); CoreIOPlugin.setConnectionContext(ftpcp, context); fileName = "file name.txt"; folderName = "folder name"; super.setUp(); }
private synchronized IConnectionFileManager getConnectionFileManager() { if (connectionFileManager == null) { // find contributed first connectionFileManager = (IFTPConnectionFileManager) super.getAdapter(IFTPConnectionFileManager.class); if (connectionFileManager == null && Platform.getAdapterManager() .hasAdapter(this, IFTPConnectionFileManager.class.getName())) { connectionFileManager = (IFTPConnectionFileManager) Platform.getAdapterManager() .loadAdapter(this, IFTPConnectionFileManager.class.getName()); } if (connectionFileManager == null) { connectionFileManager = new FTPConnectionFileManager(); } ConnectionContext context = CoreIOPlugin.getConnectionContext(this); if (context != null) { CoreIOPlugin.setConnectionContext(connectionFileManager, context); } connectionFileManager.init( host, port, path, login, password, passiveMode, transferType, encoding, timezone); } return connectionFileManager; }
/** @see junit.framework.TestCase#setUp() */ protected void setUp() throws Exception { ConnectionContext context = new ConnectionContext(); context.put(ConnectionContext.COMMAND_LOG, System.out); CoreIOPlugin.setConnectionContext(clientManager, context); context.put(ConnectionContext.COMMAND_LOG, System.out); CoreIOPlugin.setConnectionContext(serverManager, context); clientDirectory = clientManager.getRoot().getFileStore(new Path("/client" + System.currentTimeMillis())); assertNotNull(clientDirectory); clientDirectory.mkdir(EFS.NONE, null); serverDirectory = serverManager.getRoot().getFileStore(new Path("/server" + System.currentTimeMillis())); assertNotNull(serverDirectory); serverDirectory.mkdir(EFS.NONE, null); super.setUp(); }
/* (non-Javadoc) * @see com.aptana.ide.core.io.ConnectionPoint#connect(boolean, org.eclipse.core.runtime.IProgressMonitor) */ @Override public void connect(boolean force, IProgressMonitor monitor) throws CoreException { if (!force && isConnected()) { return; } ConnectionContext context = CoreIOPlugin.getConnectionContext(this); if (context != null) { CoreIOPlugin.setConnectionContext(connectionFileManager, context); } getConnectionFileManager().connect(monitor); }