Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-05-16 14:45:18 +0000
committerMichael Valenta2002-05-16 14:45:18 +0000
commite591d2af465003068bcc058d74377b537b296b4f (patch)
treec3eb6dc2774433f1d1068b5b3d9598141f1a6679 /tests/org.eclipse.team.tests.core
parentf38ab66d1449e5a9b5cc18bd730445fe548463cc (diff)
downloadeclipse.platform.team-e591d2af465003068bcc058d74377b537b296b4f.tar.gz
eclipse.platform.team-e591d2af465003068bcc058d74377b537b296b4f.tar.xz
eclipse.platform.team-e591d2af465003068bcc058d74377b537b296b4f.zip
*** empty log message ***
Diffstat (limited to 'tests/org.eclipse.team.tests.core')
-rw-r--r--tests/org.eclipse.team.tests.core/.classpath1
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/ClientTest.java15
-rw-r--r--tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/FTPTestSetup.java33
3 files changed, 39 insertions, 10 deletions
diff --git a/tests/org.eclipse.team.tests.core/.classpath b/tests/org.eclipse.team.tests.core/.classpath
index 60fd55a00..b5763b2c4 100644
--- a/tests/org.eclipse.team.tests.core/.classpath
+++ b/tests/org.eclipse.team.tests.core/.classpath
@@ -13,7 +13,6 @@
<classpathentry kind="src" path="/org.junit"/>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
<classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.team.ftp"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/ClientTest.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/ClientTest.java
index 7dc9f2908..2eea918ce 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/ClientTest.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/ClientTest.java
@@ -48,12 +48,21 @@ public class ClientTest extends TeamTest {
return FTPTestSetup.openFTPConnection(getURL());
}
-
-
public void testCreateDirectory() throws FTPException {
FTPClient client = openFTPConnection();
try {
- client.createDirectory("test1", DEFAULT_PROGRESS_MONITOR);
+ client.createDirectory("testCreateDirectory", DEFAULT_PROGRESS_MONITOR);
+ client.deleteDirectory("testCreateDirectory", DEFAULT_PROGRESS_MONITOR);
+ } finally {
+ client.close(DEFAULT_PROGRESS_MONITOR);
+ }
+ }
+
+ public void testSimpleTransfer() throws FTPException {
+ FTPClient client = openFTPConnection();
+ try {
+ client.createDirectory("testCreateDirectory", DEFAULT_PROGRESS_MONITOR);
+ client.deleteDirectory("testCreateDirectory", DEFAULT_PROGRESS_MONITOR);
} finally {
client.close(DEFAULT_PROGRESS_MONITOR);
}
diff --git a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/FTPTestSetup.java b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/FTPTestSetup.java
index c61853945..3790be9d4 100644
--- a/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/FTPTestSetup.java
+++ b/tests/org.eclipse.team.tests.core/src/org/eclipse/team/tests/ftp/FTPTestSetup.java
@@ -20,9 +20,11 @@ import junit.extensions.TestSetup;
import junit.framework.Test;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.team.internal.ftp.FTPException;
import org.eclipse.team.internal.ftp.FTPServerLocation;
import org.eclipse.team.internal.ftp.client.FTPClient;
+import org.eclipse.team.internal.ftp.client.FTPDirectoryEntry;
import org.eclipse.team.internal.ftp.client.IFTPClientListener;
/**
@@ -79,7 +81,17 @@ public class FTPTestSetup extends TestSetup {
ftpURL = setupURL(FTP_URL);
}
- protected void scrubURL(URL url) {
+ protected void scrubCurrentDirectory(FTPClient client) throws FTPException {
+ FTPDirectoryEntry[] entries = client.listFiles(null, DEFAULT_PROGRESS_MONITOR);
+ for (int i = 0; i < entries.length; i++) {
+ FTPDirectoryEntry entry = entries[i];
+ if (entry.hasFileSemantics()) {
+ client.deleteFile(entry.getName(), DEFAULT_PROGRESS_MONITOR);
+ }
+ if (entry.hasDirectorySemantics()) {
+ client.deleteDirectory(entry.getName(), DEFAULT_PROGRESS_MONITOR);
+ }
+ }
}
protected URL setupURL(String urlString) throws MalformedURLException, FTPException {
@@ -92,11 +104,14 @@ public class FTPTestSetup extends TestSetup {
URL url = new URL(urlString);
FTPServerLocation location = FTPServerLocation.fromURL(url, false);
FTPClient client = openFTPConnection(url);
- client.close(DEFAULT_PROGRESS_MONITOR);
-
- // Initialize the repo if requested (requires rsh access)
- if( SCRUB_URL ) {
- scrubURL(url);
+ try {
+ // Initialize the repo if requested
+ // For safety, do not scrub if no path is provided
+ if( SCRUB_URL && ! new Path(url.getPath()).isEmpty()) {
+ scrubCurrentDirectory(client);
+ }
+ } finally {
+ client.close(DEFAULT_PROGRESS_MONITOR);
}
return url;
@@ -110,6 +125,12 @@ public class FTPTestSetup extends TestSetup {
FTPServerLocation location = FTPServerLocation.fromURL(url, false);
FTPClient client = new FTPClient(location, null, getListener());
client.open(DEFAULT_PROGRESS_MONITOR);
+ try {
+ client.createDirectory(url.getPath(), DEFAULT_PROGRESS_MONITOR);
+ } catch (FTPException e) {
+ // Ignore the exception
+ }
+ client.changeDirectory(url.getPath(), DEFAULT_PROGRESS_MONITOR);
return client;
}

Back to the top