mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
[202949] fix: [archives] copy a folder from one connection to an archive file in a different connection does not work
This commit is contained in:
parent
ae203509de
commit
508129509f
7 changed files with 814 additions and 59 deletions
|
@ -26,6 +26,7 @@
|
||||||
* Xuan Chen (IBM) - [201790] [dnd] Copy and Paste across connections to a Drive doesn't work
|
* Xuan Chen (IBM) - [201790] [dnd] Copy and Paste across connections to a Drive doesn't work
|
||||||
* Xuan Chen (IBM) - [202668] [Supertransfer] Subfolders not copied when doing first copy from dstore to Local
|
* Xuan Chen (IBM) - [202668] [Supertransfer] Subfolders not copied when doing first copy from dstore to Local
|
||||||
* Xuan Chen (IBM) - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
|
* Xuan Chen (IBM) - [202670] [Supertransfer] After doing a copy to a directory that contains folders some folders name's display "deleted"
|
||||||
|
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.files.ui.resources;
|
package org.eclipse.rse.files.ui.resources;
|
||||||
|
@ -1013,12 +1014,19 @@ public class UniversalFileTransferUtility
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
boolean isTargetArchive = targetFolder.isArchive();
|
boolean isTargetArchive = targetFolder.isArchive();
|
||||||
|
boolean isTargetVirtual = ArchiveHandlerManager.isVirtual(targetFolder.getAbsolutePath());
|
||||||
if (isTargetArchive && !targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return null;
|
if (isTargetArchive && !targetFolder.getParentRemoteFileSubSystem().getParentRemoteFileSubSystemConfiguration().supportsArchiveManagement()) return null;
|
||||||
StringBuffer newPathBuf = new StringBuffer(targetFolder.getAbsolutePath());
|
StringBuffer newPathBuf = new StringBuffer(targetFolder.getAbsolutePath());
|
||||||
if (isTargetArchive)
|
if (isTargetArchive)
|
||||||
{
|
{
|
||||||
newPathBuf.append(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
|
newPathBuf.append(ArchiveHandlerManager.VIRTUAL_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
else if (isTargetVirtual)
|
||||||
|
{
|
||||||
|
//if the target is a virtual folder, we need to append ArchiveHandlerManager.VIRTUAL_FOLDER_SEPARATOR
|
||||||
|
//instead of the file separator of the file subsystem.
|
||||||
|
newPathBuf.append(ArchiveHandlerManager.VIRTUAL_FOLDER_SEPARATOR);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int newPathBufLenth = newPathBuf.length();
|
int newPathBufLenth = newPathBuf.length();
|
||||||
|
@ -1162,7 +1170,7 @@ public class UniversalFileTransferUtility
|
||||||
if (existingFiles != null)
|
if (existingFiles != null)
|
||||||
{
|
{
|
||||||
IRemoteFile newTargetFolder = (IRemoteFile)existingFiles.get(newPath);
|
IRemoteFile newTargetFolder = (IRemoteFile)existingFiles.get(newPath);
|
||||||
if (!newTargetFolder.exists())
|
if (null != newTargetFolder && !newTargetFolder.exists())
|
||||||
{
|
{
|
||||||
newTargetFolder = targetFS.createFolder(newTargetFolder, monitor);
|
newTargetFolder = targetFS.createFolder(newTargetFolder, monitor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
|
* Kevin Doyle (IBM) - [198576] Renaming a folder directly under a Filter doesn't update children
|
||||||
* David McKnight (IBM) - [199568] Removing synchronized from internalGetChildren
|
* David McKnight (IBM) - [199568] Removing synchronized from internalGetChildren
|
||||||
* Kevin Doyle (IBM) - [197855] Can't Delete/Rename/Move a Read-Only File
|
* Kevin Doyle (IBM) - [197855] Can't Delete/Rename/Move a Read-Only File
|
||||||
|
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.files.ui.view;
|
package org.eclipse.rse.internal.files.ui.view;
|
||||||
|
@ -1535,15 +1536,25 @@ public class SystemViewRemoteFileAdapter
|
||||||
{
|
{
|
||||||
FileServiceSubSystem ss = (FileServiceSubSystem)subsys;
|
FileServiceSubSystem ss = (FileServiceSubSystem)subsys;
|
||||||
|
|
||||||
SystemSearchString searchString = new SystemSearchString("*", false, false, "*", false, false, true); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
|
|
||||||
for (int i = 0; i < initialResources.size(); i++)
|
for (int i = 0; i < initialResources.size(); i++)
|
||||||
{
|
{
|
||||||
IRemoteFile remoteFile = (IRemoteFile)initialResources.get(i);
|
IRemoteFile remoteFile = (IRemoteFile)initialResources.get(i);
|
||||||
|
|
||||||
// get all files within directory
|
// get all files within directory
|
||||||
if (remoteFile.isDirectory())
|
if (remoteFile.isDirectory())
|
||||||
{
|
{
|
||||||
|
SystemSearchString searchString = null;
|
||||||
|
if (ArchiveHandlerManager.isVirtual(remoteFile.getAbsolutePath()))
|
||||||
|
{
|
||||||
|
//If this file to create flatset with is a virtual directory, we want to make sure the includeArchives flag
|
||||||
|
//for the searchString is set to true. This way, we could search inside the archive file
|
||||||
|
searchString = new SystemSearchString("*", false, false, "*", false, true, true); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
searchString = new SystemSearchString("*", false, false, "*", false, false, true); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
// create the configuration for this folder
|
// create the configuration for this folder
|
||||||
IHostSearchResultConfiguration config = ss.createSearchConfiguration(searchSet, remoteFile, searchString);
|
IHostSearchResultConfiguration config = ss.createSearchConfiguration(searchSet, remoteFile, searchString);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
* Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
|
* Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
|
||||||
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
||||||
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
|
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
|
||||||
|
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.dstore.universal.miners;
|
package org.eclipse.rse.dstore.universal.miners;
|
||||||
|
@ -600,8 +601,14 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
UniversalServerUtilities.logError(CLASSNAME, "Invalid query type to handleSearch", null); //$NON-NLS-1$
|
UniversalServerUtilities.logError(CLASSNAME, "Invalid query type to handleSearch", null); //$NON-NLS-1$
|
||||||
return statusDone(status);
|
return statusDone(status);
|
||||||
}
|
}
|
||||||
|
//If the subject is a virtual folder, we could not just use check file.exists() to determine if we need
|
||||||
if (fileobj.exists()) {
|
//to continue process this request or not.
|
||||||
|
boolean continueSearch = true;
|
||||||
|
if (!queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR) && !fileobj.exists())
|
||||||
|
{
|
||||||
|
continueSearch = false;
|
||||||
|
}
|
||||||
|
if (continueSearch) {
|
||||||
DataElement arg1 = getCommandArgument(theElement, 1);
|
DataElement arg1 = getCommandArgument(theElement, 1);
|
||||||
DataElement arg2 = getCommandArgument(theElement, 2);
|
DataElement arg2 = getCommandArgument(theElement, 2);
|
||||||
DataElement arg3 = getCommandArgument(theElement, 3);
|
DataElement arg3 = getCommandArgument(theElement, 3);
|
||||||
|
@ -631,7 +638,7 @@ public class UniversalFileSystemMiner extends Miner {
|
||||||
searchThread.start();
|
searchThread.start();
|
||||||
|
|
||||||
updateCancellableThreads(status.getParent(), searchThread);
|
updateCancellableThreads(status.getParent(), searchThread);
|
||||||
return status;
|
//return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return statusDone(status);
|
return statusDone(status);
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* {Name} (company) - description of contribution.
|
* {Name} (company) - description of contribution.
|
||||||
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
|
* Xuan Chen (IBM) - [194293] [Local][Archives] Saving file second time in an Archive Errors
|
||||||
|
* Xuan Chen (IBM) - [202949] [archives] copy a folder from one connection to an archive file in a different connection does not work
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.clientserver.archiveutils;
|
package org.eclipse.rse.services.clientserver.archiveutils;
|
||||||
|
@ -36,6 +37,7 @@ public class ArchiveHandlerManager
|
||||||
// The string that separates the virtual part of an absolute path from the real part
|
// The string that separates the virtual part of an absolute path from the real part
|
||||||
public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$
|
public static final String VIRTUAL_SEPARATOR = "#virtual#/"; //$NON-NLS-1$
|
||||||
public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$
|
public static final String VIRTUAL_CANONICAL_SEPARATOR = "#virtual#"; //$NON-NLS-1$
|
||||||
|
public static final String VIRTUAL_FOLDER_SEPARATOR = "/"; //$NON-NLS-1$
|
||||||
|
|
||||||
// the singleton instance
|
// the singleton instance
|
||||||
protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager();
|
protected static ArchiveHandlerManager _instance = new ArchiveHandlerManager();
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
||||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
@ -128,6 +129,10 @@ public class FileServiceArchiveTest extends FileServiceBaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSourceZipFiles() throws Exception
|
public void createSourceZipFiles() throws Exception
|
||||||
|
{
|
||||||
|
createSourceZipFiles(fss);
|
||||||
|
}
|
||||||
|
public IRemoteFile createSourceZipFiles(IFileServiceSubSystem inputFss) throws Exception
|
||||||
{
|
{
|
||||||
/* build scenario */
|
/* build scenario */
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
|
@ -318,36 +323,59 @@ public class FileServiceArchiveTest extends FileServiceBaseTest {
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12ab, content);
|
createFile(epdcdump01_hex12ab, content);
|
||||||
|
|
||||||
|
IRemoteFile targetDir = null;
|
||||||
|
if (inputFss != fss)
|
||||||
|
{
|
||||||
|
//Create the tempDir inside the inputFss
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile homeDirectory = inputFss.getRemoteFileObject(".", mon);
|
||||||
|
String baseFolderName = "rsetest";
|
||||||
|
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||||
|
String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon);
|
||||||
|
targetDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
fail("Problem encountered: " + e.getStackTrace().toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targetDir = tempDir;
|
||||||
|
}
|
||||||
//now, copy folderToCopy into the folder in the remote system
|
//now, copy folderToCopy into the folder in the remote system
|
||||||
IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName1, mon);
|
IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName1, mon);
|
||||||
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class);
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class);
|
||||||
SystemRemoteResourceSet fromSet = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
SystemRemoteResourceSet fromSet = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
fromSet.addResource(sourceFolderToCopy1);
|
fromSet.addResource(sourceFolderToCopy1);
|
||||||
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
||||||
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects1, targetDir, mon, true);
|
||||||
|
|
||||||
IRemoteFile sourceFolderToCopy2 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName2, mon);
|
IRemoteFile sourceFolderToCopy2 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName2, mon);
|
||||||
ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class);
|
ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class);
|
||||||
SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(localFss, srcAdapter2);
|
SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(localFss, srcAdapter2);
|
||||||
fromSet2.addResource(sourceFolderToCopy2);
|
fromSet2.addResource(sourceFolderToCopy2);
|
||||||
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||||
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects2, targetDir, mon, true);
|
||||||
|
|
||||||
IRemoteFile zipSource1 = createFileOrFolder(tempDir.getAbsolutePath(), zipSourceFileName1, false);
|
IRemoteFile zipSource1 = createFileOrFolder(inputFss, targetDir.getAbsolutePath(), zipSourceFileName1, false);
|
||||||
assertNotNull(zipSource1);
|
assertNotNull(zipSource1);
|
||||||
IRemoteFile zipSourceFolder = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName1);
|
IRemoteFile zipSourceFolder = (IRemoteFile)getChildFromFolder(inputFss, targetDir, folderToCopyName1);
|
||||||
fss.copy(zipSourceFolder, zipSource1, folderToCopyName1, mon);
|
inputFss.copy(zipSourceFolder, zipSource1, folderToCopyName1, mon);
|
||||||
|
|
||||||
IRemoteFile zipSource2 = createFileOrFolder(tempDir.getAbsolutePath(), zipSourceFileName2, false);
|
IRemoteFile zipSource2 = createFileOrFolder(inputFss, targetDir.getAbsolutePath(), zipSourceFileName2, false);
|
||||||
assertNotNull(zipSource2);
|
assertNotNull(zipSource2);
|
||||||
IRemoteFile zipSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName2);
|
IRemoteFile zipSourceFolder2 = (IRemoteFile)getChildFromFolder(inputFss, targetDir, folderToCopyName2);
|
||||||
fss.copy(zipSourceFolder2, zipSource2, folderToCopyName2, mon);
|
inputFss.copy(zipSourceFolder2, zipSource2, folderToCopyName2, mon);
|
||||||
|
|
||||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||||
fss.resolveFilterString(tempDir, null, mon);
|
inputFss.resolveFilterString(targetDir, null, mon);
|
||||||
|
|
||||||
//Then, delete the temp folder in the junit workspace.
|
//Then, delete the temp folder in the junit workspace.
|
||||||
temp.delete(EFS.NONE, mon);
|
temp.delete(EFS.NONE, mon);
|
||||||
|
|
||||||
|
return targetDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
||||||
|
@ -2260,45 +2288,6 @@ public class FileServiceArchiveTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void testSuperTransferLocalToRemote() throws Exception {
|
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
|
||||||
IFileStore temp = createDir(tempPath, true);
|
|
||||||
|
|
||||||
createSuperTransferFolder(temp);
|
|
||||||
|
|
||||||
//Set the superTransfer preference on
|
|
||||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
|
||||||
boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
|
|
||||||
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true);
|
|
||||||
|
|
||||||
//now, copy folderToCopy into the folder in the remote system
|
|
||||||
IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
|
||||||
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class);
|
|
||||||
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
|
||||||
fromSet3.addResource(sourceFolderToCopy1);
|
|
||||||
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
|
||||||
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true);
|
|
||||||
|
|
||||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
|
||||||
Object[] children = fss.resolveFilterString(tempDir, null, mon);
|
|
||||||
//Make sure there is no temp archive file left
|
|
||||||
assertTrue(children.length == 1);
|
|
||||||
|
|
||||||
Object theCopiedFolder = getChildFromFolder(tempDir, folderToCopyName3);
|
|
||||||
assertNotNull(theCopiedFolder);
|
|
||||||
|
|
||||||
//Also make sure the copied child has the right contents.
|
|
||||||
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
|
||||||
|
|
||||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
|
||||||
checkFolderContents((IRemoteFile)theCopiedFolder, childrenToCheck, typesToCheck);
|
|
||||||
|
|
||||||
//Then, set the preference back to its original value
|
|
||||||
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER);
|
|
||||||
|
|
||||||
//Then, delete the temp folder in the junit workspace.
|
|
||||||
temp.delete(EFS.NONE, mon);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testOpenFileFromTarArchive() throws Exception {
|
public void testOpenFileFromTarArchive() throws Exception {
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
@ -2356,5 +2345,8 @@ public class FileServiceArchiveTest extends FileServiceBaseTest {
|
||||||
sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||||
assertTrue(sameContent);
|
assertTrue(sameContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,11 @@ import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
||||||
import org.eclipse.rse.core.subsystems.ServerLaunchType;
|
import org.eclipse.rse.core.subsystems.ServerLaunchType;
|
||||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
|
||||||
|
@ -90,9 +92,24 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
|
||||||
//super transfer
|
//super transfer
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferLocalToRemote"));
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferLocalToRemote"));
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreWindowsAndDStore"));
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreWindowsAndDStore"));
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
||||||
//open a virtual file in tar archive
|
//open a virtual file in tar archive
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testOpenFileFromTarArchive")); //$NON-NLS-1$
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testOpenFileFromTarArchive")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
//copy the virtual folder across connections
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileLevelTwoFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVirtualFileLevelTwoFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFLevelTwoToArchiveFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFLevelTwoToArchiveFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToArchiveFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToArchiveFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFLevelTwoFromDStoreToLocal")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testCopyVFToVFLevelTwoFromLocalToDStore")); //$NON-NLS-1$
|
||||||
|
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,6 +203,47 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSuperTransferLocalToRemote() throws Exception {
|
||||||
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
|
IFileStore temp = createDir(tempPath, true);
|
||||||
|
|
||||||
|
createSuperTransferFolder(temp);
|
||||||
|
|
||||||
|
//Set the superTransfer preference on
|
||||||
|
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
|
||||||
|
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true);
|
||||||
|
|
||||||
|
|
||||||
|
//now, copy folderToCopy into the folder in the remote system
|
||||||
|
IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(sourceFolderToCopy1);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true);
|
||||||
|
|
||||||
|
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||||
|
Object[] children = fss.resolveFilterString(tempDir, null, mon);
|
||||||
|
//Make sure there is no temp archive file left
|
||||||
|
assertTrue(children.length == 1);
|
||||||
|
|
||||||
|
Object theCopiedFolder = getChildFromFolder(tempDir, folderToCopyName3);
|
||||||
|
assertNotNull(theCopiedFolder);
|
||||||
|
|
||||||
|
//Also make sure the copied child has the right contents.
|
||||||
|
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||||
|
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents((IRemoteFile)theCopiedFolder, childrenToCheck, typesToCheck);
|
||||||
|
|
||||||
|
//Then, set the preference back to its original value
|
||||||
|
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER);
|
||||||
|
|
||||||
|
//Then, delete the temp folder in the junit workspace.
|
||||||
|
temp.delete(EFS.NONE, mon);
|
||||||
|
}
|
||||||
|
|
||||||
public void testSuperTransferDStoreWindowsAndDStore() throws Exception {
|
public void testSuperTransferDStoreWindowsAndDStore() throws Exception {
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
IFileStore temp = createDir(tempPath, true);
|
IFileStore temp = createDir(tempPath, true);
|
||||||
|
@ -271,8 +329,678 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
|
||||||
//Then, set the preference back to its original value
|
//Then, set the preference back to its original value
|
||||||
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER);
|
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER);
|
||||||
|
|
||||||
|
//delete the windows dstore temp file just created
|
||||||
|
try {
|
||||||
|
dstoreWindowsFss.delete(dstoreWindowsTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
//Then, delete the temp folder in the junit workspace.
|
//Then, delete the temp folder in the junit workspace.
|
||||||
temp.delete(EFS.NONE, mon);
|
temp.delete(EFS.NONE, mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSuperTransferDStoreToLocal() throws Exception {
|
||||||
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
|
IFileStore temp = createDir(tempPath, true);
|
||||||
|
|
||||||
|
createSuperTransferFolder(temp);
|
||||||
|
|
||||||
|
//Set the superTransfer preference on
|
||||||
|
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||||
|
boolean preference_DOSUPERTRANSFER = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
|
||||||
|
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, true);
|
||||||
|
|
||||||
|
//now, copy folderToCopy into the folder in the remote system
|
||||||
|
IRemoteFile sourceFolderToCopy1 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy1).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet1 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet1.addResource(sourceFolderToCopy1);
|
||||||
|
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet1, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
||||||
|
|
||||||
|
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||||
|
fss.resolveFilterString(tempDir, null, mon);
|
||||||
|
|
||||||
|
|
||||||
|
//Then, create a temparory directory the My Home of the Local connection
|
||||||
|
//Create a temparory directory in My Home
|
||||||
|
IRemoteFile localTempDir = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon);
|
||||||
|
String baseFolderName = "rsetest";
|
||||||
|
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||||
|
String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon);
|
||||||
|
localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
fail("Problem encountered: " + e.getStackTrace().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
//now, copy that folder in the Dstore connection into the folder in local connection
|
||||||
|
IRemoteFile sourceFolderToCopy2 = (IRemoteFile)getChildFromFolder(tempDir, folderToCopyName3);
|
||||||
|
ISystemDragDropAdapter srcAdapter2 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy2).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet2 = new SystemRemoteResourceSet(fss, srcAdapter2);
|
||||||
|
fromSet2.addResource(sourceFolderToCopy2);
|
||||||
|
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects2, localTempDir, mon, true);
|
||||||
|
|
||||||
|
Object[] localChildren = localFss.resolveFilterString(localTempDir, null, mon);
|
||||||
|
//Make sure there is no temp archive file left
|
||||||
|
assertTrue(localChildren.length == 1);
|
||||||
|
|
||||||
|
//then verify the result of copy
|
||||||
|
Object theCopiedFolderLocal = getChildFromFolder(localFss, localTempDir, folderToCopyName3);
|
||||||
|
assertNotNull(theCopiedFolderLocal);
|
||||||
|
//Also make sure the copied child has the right contents.
|
||||||
|
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||||
|
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)theCopiedFolderLocal, childrenToCheck, typesToCheck);
|
||||||
|
|
||||||
|
//Then, set the preference back to its original value
|
||||||
|
store.setValue(ISystemFilePreferencesConstants.DOSUPERTRANSFER, preference_DOSUPERTRANSFER);
|
||||||
|
|
||||||
|
//delete the windows dstore temp file just created
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
//Then, delete the temp folder in the junit workspace.
|
||||||
|
temp.delete(EFS.NONE, mon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVirtualFileFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//Create the tempDir inside the Local connection first.
|
||||||
|
IRemoteFile localTempDir = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon);
|
||||||
|
String baseFolderName = "rsetest";
|
||||||
|
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||||
|
String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon);
|
||||||
|
localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
fail("Problem encountered: " + e.getStackTrace().toString());
|
||||||
|
}
|
||||||
|
//then, create a folder inside the tempDir inside the Local connection
|
||||||
|
String folderName = "folder1";
|
||||||
|
IRemoteFile folder1 = createFileOrFolder(localFss, localTempDir.getAbsolutePath(), folderName, true);
|
||||||
|
assertNotNull(folder1);
|
||||||
|
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file into folder1
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true);
|
||||||
|
|
||||||
|
//make sure some delay before checking the result
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, folder1, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void testCopyVirtualFileLevelTwoFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//copy the zip file first.
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//Create the tempDir inside the Local connection first.
|
||||||
|
IRemoteFile localTempDir = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IRemoteFile homeDirectory = localFss.getRemoteFileObject(".", mon);
|
||||||
|
String baseFolderName = "rsetest";
|
||||||
|
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||||
|
String testFolderName = FileServiceHelper.getRandomLocation(localFss, homeFolderName, baseFolderName, mon);
|
||||||
|
localTempDir = createFileOrFolder(localFss, homeFolderName, testFolderName, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
fail("Problem encountered: " + e.getStackTrace().toString());
|
||||||
|
}
|
||||||
|
//then, create a folder inside the tempDir inside the Local connection
|
||||||
|
String folderName = "folder1";
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile folder1 = createFileOrFolder(localFss, localTempDir.getAbsolutePath(), folderName, true);
|
||||||
|
assertNotNull(folder1);
|
||||||
|
|
||||||
|
//Now, copy one of the level two folder from the zip file into folder1
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(firstLevelChild, "Team");
|
||||||
|
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true);
|
||||||
|
|
||||||
|
Thread.sleep(50);
|
||||||
|
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, folder1, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVirtualFileFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
IRemoteFile sourceZipLocation = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, sourceZipLocation, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//then, create a folder inside the tempDir inside the DStore connection
|
||||||
|
String folderName = "folder1";
|
||||||
|
IRemoteFile folder1 = createFileOrFolder(fss, tempDir.getAbsolutePath(), folderName, true);
|
||||||
|
assertNotNull(folder1);
|
||||||
|
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in Local connection into folder1
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true);
|
||||||
|
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, folder1, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(sourceZipLocation, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVirtualFileLevelTwoFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
IRemoteFile sourceZipLocation = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, sourceZipLocation, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//then, create a folder inside the tempDir inside the DStore connection
|
||||||
|
String folderName = "folder1";
|
||||||
|
IRemoteFile folder1 = createFileOrFolder(fss, tempDir.getAbsolutePath(), folderName, true);
|
||||||
|
assertNotNull(folder1);
|
||||||
|
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in Local connection into folder1
|
||||||
|
//Now, copy one of the level two folder from the zip file into folder1
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName);
|
||||||
|
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, folder1, mon, true);
|
||||||
|
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, folder1, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(sourceZipLocation, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToArchiveFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the first level virtual child of a zip file
|
||||||
|
//in local temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2);
|
||||||
|
//IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in dstore into destinationVirtualFolder
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true);
|
||||||
|
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFLevelTwoToArchiveFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the second level virtual child of a zip file
|
||||||
|
//in local temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2);
|
||||||
|
//IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
//IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, firstChild, "20070319");
|
||||||
|
|
||||||
|
//the source is a second level child of a zip file in dstore connection temp dir
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(fss, sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(fss, firstLevelChild, secondLeveChildName);
|
||||||
|
|
||||||
|
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true);
|
||||||
|
|
||||||
|
Thread.sleep(50);
|
||||||
|
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, destinationArchiveFile, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToArchiveFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
//Source zip file is from Local connection
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the first level virtual child of a zip file
|
||||||
|
//in dstore temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2);
|
||||||
|
//IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in local into destinationVirtualFolder
|
||||||
|
//First, drag the virtual folder from the local zip file
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
//The drop to the destination virtual folder in dstore connection.
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true);
|
||||||
|
|
||||||
|
//The result is in the dstore connection
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, destinationArchiveFile, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFLevelTwoToArchiveFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
//Source zip file is in local connection
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the second level virtual child of a zip file
|
||||||
|
//in dstore temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2);
|
||||||
|
//IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
//IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, firstChild, "20070319");
|
||||||
|
|
||||||
|
//the source is a second level child of a zip file in local connection temp dir
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in local into destinationVirtualFolder
|
||||||
|
//First, drag the virtual folder from the local zip file
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationArchiveFile, mon, true);
|
||||||
|
|
||||||
|
//The result is in the dstore connection
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, destinationArchiveFile, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToVFFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the first level virtual child of a zip file
|
||||||
|
//in local temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2);
|
||||||
|
IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in dstore into destinationVirtualFolder
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true);
|
||||||
|
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, destinationVirtualFolder, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToVFLevelTwoFromDStoreToLocal() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(tempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the second level virtual child of a zip file
|
||||||
|
//in local temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, zipSourceFileName2);
|
||||||
|
IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(localFss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(localFss, firstChild, "20070319");
|
||||||
|
|
||||||
|
//the source is a second level child of a zip file in dstore connection temp dir
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(fss, sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(fss, firstLevelChild, secondLeveChildName);
|
||||||
|
|
||||||
|
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(fss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true);
|
||||||
|
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(localFss, destinationVirtualFolder, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(localFss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToVFFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
//Source zip file is from Local connection
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the first level virtual child of a zip file
|
||||||
|
//in dstore temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2);
|
||||||
|
IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in local into destinationVirtualFolder
|
||||||
|
//First, drag the virtual folder from the local zip file
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) firstLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(firstLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
//The drop to the destination virtual folder in dstore connection.
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true);
|
||||||
|
|
||||||
|
//The result is in the dstore connection
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, destinationVirtualFolder, folderToCopyName1);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Team", "TypeFilters", "xuanchentp", ".compatibility", ".project"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testCopyVFToVFLevelTwoFromLocalToDStore() throws Exception {
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||||
|
|
||||||
|
//Create the zip files in dstore connection.
|
||||||
|
createSourceZipFiles();
|
||||||
|
|
||||||
|
//Create the zip files in local connection
|
||||||
|
IRemoteFile localTempDir = createSourceZipFiles(localFss);
|
||||||
|
|
||||||
|
String sourceZipFileName = zipSourceFileName1;
|
||||||
|
//Source zip file is in local connection
|
||||||
|
IRemoteFile sourceZipFile = (IRemoteFile)getChildFromFolder(localFss, localTempDir, sourceZipFileName);
|
||||||
|
assertNotNull(sourceZipFile);
|
||||||
|
|
||||||
|
//The destination is the second level virtual child of a zip file
|
||||||
|
//in dstore temp dir
|
||||||
|
IRemoteFile destinationArchiveFile = (IRemoteFile)getChildFromFolder(fss, tempDir, zipSourceFileName2);
|
||||||
|
IRemoteFile firstChild = (IRemoteFile)getChildFromFolder(fss, destinationArchiveFile, folderToCopyName2);
|
||||||
|
IRemoteFile destinationVirtualFolder = (IRemoteFile)getChildFromFolder(fss, firstChild, "20070319");
|
||||||
|
|
||||||
|
//the source is a second level child of a zip file in local connection temp dir
|
||||||
|
String secondLeveChildName = "Team";
|
||||||
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(localFss, sourceZipFile, folderToCopyName1);
|
||||||
|
IRemoteFile secondLevelChild = (IRemoteFile)getChildFromFolder(localFss, firstLevelChild, secondLeveChildName);
|
||||||
|
|
||||||
|
//Now, copy one of the folder from the zip file in local into destinationVirtualFolder
|
||||||
|
//First, drag the virtual folder from the local zip file
|
||||||
|
ISystemDragDropAdapter srcAdapter1 = (ISystemDragDropAdapter) ((IAdaptable) secondLevelChild).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
SystemRemoteResourceSet fromSet3 = new SystemRemoteResourceSet(localFss, srcAdapter1);
|
||||||
|
fromSet3.addResource(secondLevelChild);
|
||||||
|
ISystemResourceSet tempObjects3 = srcAdapter1.doDrag(fromSet3, mon);
|
||||||
|
UniversalFileTransferUtility.copyWorkspaceResourcesToRemote((SystemWorkspaceResourceSet)tempObjects3, destinationVirtualFolder, mon, true);
|
||||||
|
|
||||||
|
//The result is in the dstore connection
|
||||||
|
Thread.sleep(50);
|
||||||
|
Object copiedVirtualFolder = getChildFromFolder(fss, destinationVirtualFolder, secondLeveChildName);
|
||||||
|
|
||||||
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
|
String[] contents = {"Connections", "Filters", "profile.xmi"};
|
||||||
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
|
checkFolderContents(fss, (IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
|
//Now, need to delete the temp dir in the Local connection
|
||||||
|
try {
|
||||||
|
localFss.delete(localTempDir, mon);
|
||||||
|
} catch(SystemMessageException msg) {
|
||||||
|
//ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on deleting local temp dir: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,16 +12,25 @@ package org.eclipse.rse.tests.subsystems.files;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.core.filesystem.EFS;
|
||||||
|
import org.eclipse.core.filesystem.IFileStore;
|
||||||
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
import org.eclipse.rse.core.IRSESystemType;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
|
import org.eclipse.rse.core.model.ISystemResourceSet;
|
||||||
|
import org.eclipse.rse.core.model.SystemRemoteResourceSet;
|
||||||
import org.eclipse.rse.core.model.SystemStartHere;
|
import org.eclipse.rse.core.model.SystemStartHere;
|
||||||
|
import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
|
||||||
import org.eclipse.rse.core.subsystems.IConnectorService;
|
import org.eclipse.rse.core.subsystems.IConnectorService;
|
||||||
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
|
import org.eclipse.rse.core.subsystems.IRemoteServerLauncher;
|
||||||
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
import org.eclipse.rse.core.subsystems.IServerLauncherProperties;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
||||||
import org.eclipse.rse.core.subsystems.ServerLaunchType;
|
import org.eclipse.rse.core.subsystems.ServerLaunchType;
|
||||||
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
|
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||||
import org.eclipse.rse.services.files.IFileService;
|
import org.eclipse.rse.services.files.IFileService;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
|
@ -61,7 +70,7 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
||||||
//suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFileBigZip")); //$NON-NLS-1$
|
//suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFileBigZip")); //$NON-NLS-1$
|
||||||
|
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote"));
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote"));
|
||||||
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +152,5 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
||||||
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, fPreference_ALERT_NONSSL);
|
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, fPreference_ALERT_NONSSL);
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue