use of org.eclipse.ecf.filetransfer.events.IRemoteFileSystemBrowseEvent in project ecf by eclipse.
the class AbstractFileSystemBrowser method createRemoteFileEvent.
/**
* @return file system directory event
*/
protected IRemoteFileSystemEvent createRemoteFileEvent() {
return new IRemoteFileSystemBrowseEvent() {
public IFileID getFileID() {
return fileID;
}
public Exception getException() {
return exception;
}
public String toString() {
// $NON-NLS-1$
StringBuffer buf = new StringBuffer("RemoteFileSystemBrowseEvent[");
// $NON-NLS-1$ //$NON-NLS-2$
buf.append("fileID=").append(fileID).append(";");
List list = (remoteFiles != null) ? Arrays.asList(remoteFiles) : null;
// $NON-NLS-1$ //$NON-NLS-2$
buf.append("files=").append(list).append("]");
return buf.toString();
}
public IRemoteFile[] getRemoteFiles() {
return remoteFiles;
}
};
}
use of org.eclipse.ecf.filetransfer.events.IRemoteFileSystemBrowseEvent in project ecf by eclipse.
the class URLBrowseTest method testBrowseUnknownHost.
public void testBrowseUnknownHost() throws Exception {
testBrowse(new URL(URLRetrieveTestUnknownHost.HTTP_UNKNOWN_HOST_URL));
Thread.sleep(3000);
assertHasEventCount(events, IRemoteFileSystemBrowseEvent.class, 1);
IRemoteFileSystemBrowseEvent event = (IRemoteFileSystemBrowseEvent) events.get(0);
assertNotNull(event);
final IRemoteFile[] remoteFiles = event.getRemoteFiles();
assertNull(remoteFiles);
Exception e = event.getException();
assertNotNull(e);
if (e instanceof BrowseFileTransferException) {
BrowseFileTransferException ifte = (BrowseFileTransferException) e;
assertTrue(ifte.getCause() instanceof UnknownHostException);
} else
fail("Event exception is not instance of BrowseFileTransferException");
}
use of org.eclipse.ecf.filetransfer.events.IRemoteFileSystemBrowseEvent in project ecf by eclipse.
the class URLBrowseTest method testBrowseURLs.
public void testBrowseURLs() throws Exception {
for (int i = 0; i < testURLs.length; i++) {
testBrowse(testURLs[i]);
Thread.sleep(10000);
}
assertHasEventCount(events, IRemoteFileSystemBrowseEvent.class, 3);
for (Iterator iterator = events.iterator(); iterator.hasNext(); ) {
IRemoteFileSystemBrowseEvent event = (IRemoteFileSystemBrowseEvent) iterator.next();
assertNotNull(event);
final IRemoteFile[] remoteFiles = event.getRemoteFiles();
assertNotNull(remoteFiles);
assertEquals(1, remoteFiles.length);
if (event.getFileID().getName().equals("http://google.com:80")) {
verifyRemoteFilesWithoutLastModifiedAndContentLength(remoteFiles);
} else {
verifyRemoteFiles(remoteFiles);
}
}
}
Aggregations