1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Updated to use property files.

Moved getFTPHost, getSSHHost, getLinuxHost, and getWindowsHost to RSEBaseConnectionTestCase
This commit is contained in:
Kevin Doyle 2008-03-06 22:40:02 +00:00
parent 0ef2e359da
commit 64239d6800
6 changed files with 100 additions and 325 deletions

View file

@ -16,10 +16,14 @@ package org.eclipse.rse.tests.core.connection;
import java.util.Properties;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.tests.core.RSECoreTestCase;
import org.eclipse.rse.tests.internal.RSEConnectionManager;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* Abstract superclass for JUnit PDE test cases that require an IHost.
@ -87,6 +91,66 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
return connection;
}
protected IHost getSSHHost()
{
return getHost("sshConnection.properties");
}
protected IHost getFTPHost()
{
return getHost("ftpConnection.properties");
}
protected IHost getLinuxHost()
{
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
return getHost("linuxConnection.properties");
}
protected IHost getWindowsHost()
{
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
return getHost("windowsConnection.properties");
}
protected IHost getHost(String propertiesFileName) {
IHost host;
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append(propertiesFileName); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
return host;
}
/**
* Lookup/create and return the remote system connection according to the list of system parameters.
* @param systemTypeID The type id string of the remote system.

View file

@ -15,9 +15,7 @@
package org.eclipse.rse.tests.subsystems.files;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
@ -27,9 +25,6 @@ import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
public class CreateFileTestCase extends FileServiceBaseTest {
@ -56,75 +51,29 @@ public class CreateFileTestCase extends FileServiceBaseTest {
public void testCreateFileFTP() throws Exception {
//-test-author-:KevinDoyle
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("ftpConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
host = getFTPHost();
createFileAndAssertProperties();
}
public void testCreateFileDStore() throws Exception {
public void testCreateFileLinux() throws Exception {
//-test-author-:KevinDoyle
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("linuxConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
host = getLinuxHost();
createFileAndAssertProperties();
}
public void testCreateFileSSH() throws Exception {
//-test-author-:KevinDoyle
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("sshConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
host = getSSHHost();
createFileAndAssertProperties();
}
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
public void testCreateFileWindows() throws Exception {
//-test-author-:KevinDoyle
host = getWindowsHost();
createFileAndAssertProperties();
}

View file

@ -21,9 +21,7 @@ import java.net.URI;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
@ -34,9 +32,6 @@ import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
public class FileOutputStreamTestCase extends FileServiceBaseTest {
@ -56,101 +51,9 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
return null;
}
protected IHost getSSHHost()
{
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("sshConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
return host;
}
protected IHost getFTPHost()
{
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("ftpConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
return host;
}
protected IHost getLocalHost() {
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("localConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
return host;
}
protected IHost getDStoreHost()
{
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("linuxConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
host = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), host); //$NON-NLS-1$
return host;
}
public void testRSEFileStoreAppendOutputStreamLocal() throws Exception {
//-test-author-:KevinDoyle
host = getLocalHost();
host = getLocalSystemConnection();
outputStreamFileWriting(EFS.APPEND);
}
@ -160,9 +63,15 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
outputStreamFileWriting(EFS.APPEND);
}
public void testRSEFileStoreAppendOutputStreamDStore() throws Exception {
public void testRSEFileStoreAppendOutputStreamLinux() throws Exception {
//-test-author-:KevinDoyle
host = getDStoreHost();
host = getLinuxHost();
outputStreamFileWriting(EFS.APPEND);
}
public void testRSEFileStoreAppendOutputStreamWindows() throws Exception {
//-test-author-:KevinDoyle
host = getWindowsHost();
outputStreamFileWriting(EFS.APPEND);
}
@ -174,7 +83,7 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
public void testRSEFileStoreOverwriteOutputStreamLocal() throws Exception {
//-test-author-:KevinDoyle
host = getLocalHost();
host = getLocalSystemConnection();
outputStreamFileWriting(EFS.NONE);
}
@ -184,9 +93,15 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
outputStreamFileWriting(EFS.NONE);
}
public void testRSEFileStoreOverwriteOutputStreamDStore() throws Exception {
public void testRSEFileStoreOverwriteOutputStreamLinux() throws Exception {
//-test-author-:KevinDoyle
host = getDStoreHost();
host = getLinuxHost();
outputStreamFileWriting(EFS.NONE);
}
public void testRSEFileStoreOverwriteOutputStreamWindows() throws Exception {
//-test-author-:KevinDoyle
host = getWindowsHost();
outputStreamFileWriting(EFS.NONE);
}

View file

@ -18,7 +18,6 @@ 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.rse.core.IRSESystemType;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.ISystemResourceSet;
@ -116,31 +115,7 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
protected void setupFileSubSystem() {
//We need to delay if it is first case run after a workspace startup
SYSTEM_TYPE_ID = IRSESystemType.SYSTEMTYPE_LINUX_ID;
SYSTEM_ADDRESS = "SLES8RM";
SYSTEM_NAME = "sles8rm_ds";
USER_ID = "xuanchen";
PASSWORD = "xxxxxx";
/*
SYSTEM_ADDRESS = "dmcknigh3";
SYSTEM_NAME = "dmcknigh3_ds";
USER_ID = "tester";
PASSWORD = "xxxxxx";
*/
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
fPreference_ALERT_SSL = store.getBoolean(ISystemPreferencesConstants.ALERT_SSL);
fPreference_ALERT_NONSSL = store.getBoolean(ISystemPreferencesConstants.ALERT_NONSSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
IHost dstoreHost = getRemoteSystemConnection(SYSTEM_TYPE_ID, SYSTEM_ADDRESS, SYSTEM_NAME, USER_ID, PASSWORD);
IHost dstoreHost = getLinuxHost();
assertNotNull(dstoreHost);
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
@ -163,17 +138,6 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
try
{
IConnectorService connectionService = fss.getConnectorService();
//If you want to change the daemon to another port, uncomment following statements
/*
IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties();
if (properties instanceof IRemoteServerLauncher)
{
IRemoteServerLauncher sl = (IRemoteServerLauncher)properties;
sl.setDaemonPort(8008);
}
*/
//If you want to connect to a running server, uncomment the following statements
/*
@ -188,6 +152,7 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
*/
//end here
connectionService.acquireCredentials(false);
connectionService.connect(mon);
} catch(Exception e) {
@ -267,15 +232,7 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
//Then, we need to retrieve children of the tempDir to cache their information.
fss.resolveFilterString(tempDir, null, mon);
//Now, we need to have a Windows DStore connection, so that we could use super transfer to copy
//directory from DStore Unix/Linux to DStore Windows
//We need to delay if it is first case run after a workspace startup
String systemTypeID = IRSESystemType.SYSTEMTYPE_WINDOWS_ID;
String systemAddress = "LOCALHOST";
String systemName = "LOCALHOST_ds";
IHost dstoreHost = getRemoteSystemConnection(systemTypeID, systemAddress, systemName, "", "");
IHost dstoreHost = getWindowsHost();
assertNotNull(dstoreHost);
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
@ -287,6 +244,7 @@ public class FileServiceArchiveTestDStore extends FileServiceArchiveTest {
}
assertNotNull(dstoreWindowsFss);
IConnectorService dstoreWindowsConnectionService = dstoreWindowsFss.getConnectorService();
dstoreWindowsConnectionService.acquireCredentials(false);
dstoreWindowsConnectionService.connect(mon);
//Then, create a temparory directory the My Home of the DStore Windows

View file

@ -14,7 +14,6 @@ package org.eclipse.rse.tests.subsystems.files;
import junit.framework.TestSuite;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
@ -64,22 +63,7 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
protected void setupFileSubSystem() {
//We need to delay if it is first case run after a workspace startup
SYSTEM_TYPE_ID = IRSESystemType.SYSTEMTYPE_WINDOWS_ID;
SYSTEM_ADDRESS = "LOCALHOST";
SYSTEM_NAME = "LOCALHOST_ds";
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
fPreference_ALERT_SSL = store.getBoolean(ISystemPreferencesConstants.ALERT_SSL);
fPreference_ALERT_NONSSL = store.getBoolean(ISystemPreferencesConstants.ALERT_NONSSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
IHost dstoreHost = getRemoteSystemConnection(SYSTEM_TYPE_ID, SYSTEM_ADDRESS, SYSTEM_NAME, "", "");
IHost dstoreHost = getWindowsHost();
assertTrue(dstoreHost != null);
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
@ -102,17 +86,6 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
try
{
IConnectorService connectionService = fss.getConnectorService();
//If you want to change the daemon to another port, uncomment following statements
/*
IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties();
if (properties instanceof IRemoteServerLauncher)
{
IRemoteServerLauncher sl = (IRemoteServerLauncher)properties;
sl.setDaemonPort(4075);
}
*/
//If you want to connect to a running server, uncomment the following statements
/*
@ -127,6 +100,7 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
*/
//End here.
connectionService.acquireCredentials(false);
connectionService.connect(mon);
} catch(Exception e) {

View file

@ -17,10 +17,8 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.model.SystemStartHere;
@ -29,10 +27,7 @@ import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.tests.RSETestsPlugin;
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
/**
* Test cases for comparing various file subsystem operations
@ -86,7 +81,7 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
_subSystems = new ArrayList();
// setup dstore connection
addSystem(getDStoreHost());
addSystem(getLinuxHost());
// setup ssh connection
addSystem(getSSHHost());
@ -120,86 +115,6 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
_connections.add(host);
}
protected IHost getSSHHost()
{
IHost sshHost = null;
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("sshConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
sshHost = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), sshHost); //$NON-NLS-1$
return sshHost;
}
protected IHost getFTPHost()
{
IHost ftpHost = null;
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("ftpConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
ftpHost = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), ftpHost); //$NON-NLS-1$
return ftpHost;
}
protected IHost getDStoreHost()
{
IHost dstoreHost = null;
//Ensure that the SSL acknowledge dialog does not show up.
//We need to setDefault first in order to set the value of a preference.
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
store.setDefault(ISystemPreferencesConstants.ALERT_SSL, ISystemPreferencesConstants.DEFAULT_ALERT_SSL);
store.setDefault(ISystemPreferencesConstants.ALERT_NONSSL, ISystemPreferencesConstants.DEFAULT_ALERT_NON_SSL);
store.setValue(ISystemPreferencesConstants.ALERT_SSL, false);
store.setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
// Calculate the location of the test connection properties
IPath location = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
location = location.append("linuxConnection.properties"); //$NON-NLS-1$
assertNotNull("Failed to construct location to 'connection.properties' test data file!", location); //$NON-NLS-1$
assertTrue("Required test data file seems to be not a file!", location.toFile().isFile()); //$NON-NLS-1$
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
// Load the properties from the calculated location without backing up defaults
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
// Lookup and create the connection now if necessary
dstoreHost = getConnectionManager().findOrCreateConnection(properties);
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), dstoreHost); //$NON-NLS-1$
return dstoreHost;
}
/**
* Test the implicit connect of each connection when calling getRemoteFileObject().
*/