mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[240729] More flexible disabling of testcases
This commit is contained in:
parent
464ddfc950
commit
c41e3fd332
7 changed files with 189 additions and 154 deletions
|
@ -245,6 +245,16 @@ public class RSECoreTestCase extends TestCase {
|
|||
System.out.println("--> disabled due to rule: " + checkString);
|
||||
return true;
|
||||
}
|
||||
checkString = testClassSimpleName + ".*";
|
||||
if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
|
||||
System.out.println("--> disabled due to rule: " + checkString);
|
||||
return true;
|
||||
}
|
||||
checkString = "*." + testName;
|
||||
if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
|
||||
System.out.println("--> disabled due to rule: " + checkString);
|
||||
return true;
|
||||
}
|
||||
if (targetName != null) {
|
||||
checkString = "*." + targetName;
|
||||
if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
|
||||
|
|
|
@ -77,6 +77,9 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
|
|||
* @return The local system type connection or <code>null</code> if the lookup fails.
|
||||
*/
|
||||
protected IHost getLocalSystemConnection() {
|
||||
setTargetName("local");
|
||||
if (isTestDisabled())
|
||||
return null;
|
||||
assertNotNull("Local system connection properties are not available!", localSystemConnectionProperties); //$NON-NLS-1$
|
||||
|
||||
Exception exception = null;
|
||||
|
@ -97,21 +100,33 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
|
|||
|
||||
protected IHost getSSHHost()
|
||||
{
|
||||
setTargetName("ssh");
|
||||
if (isTestDisabled())
|
||||
return null;
|
||||
return getHost("sshConnection.properties");
|
||||
}
|
||||
|
||||
protected IHost getFTPHost()
|
||||
{
|
||||
setTargetName("ftp");
|
||||
if (isTestDisabled())
|
||||
return null;
|
||||
return getHost("ftpConnection.properties");
|
||||
}
|
||||
|
||||
protected IHost getLinuxHost()
|
||||
{
|
||||
setTargetName("linux");
|
||||
if (isTestDisabled())
|
||||
return null;
|
||||
return getHost("linuxConnection.properties");
|
||||
}
|
||||
|
||||
protected IHost getWindowsHost()
|
||||
{
|
||||
setTargetName("windows");
|
||||
if (isTestDisabled())
|
||||
return null;
|
||||
return getHost("windowsConnection.properties");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.eclipse.rse.core.model.IHost;
|
|||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
@ -40,6 +39,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testConnectionCaseInSensitive() throws Exception {
|
||||
// -test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||
ISystemProfile prof = RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile();
|
||||
ISystemProfile testprof = RSECorePlugin.getTheSystemProfileManager().cloneSystemProfile(prof, "testConnectionCaseInSensitive");
|
||||
|
@ -60,7 +61,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testConnectionCreation() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnectionCreation")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$
|
||||
|
@ -105,7 +107,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testConnectionRemoval() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnectionRemoval")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
String profileName = "TestProfile"; //$NON-NLS-1$
|
||||
|
||||
|
@ -123,12 +126,13 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testConnect() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnect")) return; //$NON-NLS-1$
|
||||
IHost connection = getLocalSystemConnection();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
|
||||
IHost connection = getLocalSystemConnection();
|
||||
ISubSystem subsystem = null;
|
||||
try {
|
||||
subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$
|
||||
|
@ -173,12 +177,13 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testResolveFilterString() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testResolveFilterString")) return; //$NON-NLS-1$
|
||||
IHost connection = getLocalSystemConnection();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
|
||||
IHost connection = getLocalSystemConnection();
|
||||
ISubSystem subsystem = null;
|
||||
try {
|
||||
subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
|
@ -22,29 +22,31 @@ import org.eclipse.rse.tests.core.RSECoreTestCase;
|
|||
* Test various aspects of mnemonic generation and assignment.
|
||||
*/
|
||||
public class PasswordsTest extends RSECoreTestCase {
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
public void testAddRemove() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID);
|
||||
IRSESystemType defaultSystemType = PasswordPersistenceManager.DEFAULT_SYSTEM_TYPE;
|
||||
String hostAddress = "somesystem.mycompany.com";
|
||||
boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress);
|
||||
assertFalse("the initial value of this preference should be false", deny);
|
||||
|
||||
|
||||
String password = "password";
|
||||
String userId = "me";
|
||||
SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType);
|
||||
|
@ -88,14 +90,16 @@ public class PasswordsTest extends RSECoreTestCase {
|
|||
returnedInfo = ppm.find(systemType, hostAddress, userId, false);
|
||||
assertNull("signon info was found but should not be", returnedInfo);
|
||||
}
|
||||
|
||||
|
||||
public void testSaveDenial() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID);
|
||||
String hostAddress = "somesystem.mycompany.com";
|
||||
boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress);
|
||||
assertFalse("the initial value of this preference should be false", deny);
|
||||
|
||||
|
||||
String password = "password";
|
||||
String userId = "me";
|
||||
SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType);
|
||||
|
@ -129,5 +133,5 @@ public class PasswordsTest extends RSECoreTestCase {
|
|||
returnedInfo = ppm.find(systemType, hostAddress, userId, false);
|
||||
assertNull("signon info was found but should not be", returnedInfo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* David McKnight (IBM) - [207095] test case to compare same op between subsystems
|
||||
* David McKnight (IBM) - [162195] new APIs for upload multi and download multi
|
||||
|
@ -26,20 +26,19 @@ import org.eclipse.rse.core.subsystems.ISubSystem;
|
|||
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.RSEBaseConnectionTestCase;
|
||||
|
||||
/**
|
||||
* Test cases for comparing various file subsystem operations
|
||||
*/
|
||||
public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase {
|
||||
|
||||
|
||||
private List _subSystems;
|
||||
private List _connections;
|
||||
private List _samplePaths;
|
||||
|
||||
private String LOCALTEMPDIR = "C:\\temp";
|
||||
|
||||
|
||||
private String LOCALTEMPDIR = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
|
@ -50,10 +49,10 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
if (ss != null && ss.isConnected()) {
|
||||
ss.disconnect(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (_connections != null)
|
||||
{
|
||||
for (int j = 0; j < _connections.size(); j++) {
|
||||
|
@ -68,31 +67,28 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
_connections.clear();
|
||||
_subSystems = null;
|
||||
_connections = null;
|
||||
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected void setupConnections() {
|
||||
if (_connections == null)
|
||||
{
|
||||
_connections = new ArrayList();
|
||||
_subSystems = new ArrayList();
|
||||
|
||||
// setup dstore connection
|
||||
addSystem(getLinuxHost());
|
||||
|
||||
// setup ssh connection
|
||||
addSystem(getSSHHost());
|
||||
|
||||
// setup ftp connection
|
||||
addSystem(getFTPHost());
|
||||
|
||||
|
||||
|
||||
//TODO Support Windows style connections
|
||||
//String[] connTypes = { "local", "ssh", "ftpWindows", "ftp", "linux", "windows" };
|
||||
String[] connTypes = { "ssh", "ftp", "linux" };
|
||||
for (int i = 0; i < connTypes.length; i++) {
|
||||
addSystem(getHost(connTypes[i] + "Connection.properties"));
|
||||
}
|
||||
|
||||
_samplePaths = new ArrayList();
|
||||
_samplePaths.add("/usr");
|
||||
_samplePaths.add("/usr/lib");
|
||||
_samplePaths.add("/usr");
|
||||
_samplePaths.add("/usr/lib");
|
||||
_samplePaths.add("/usr/bin");
|
||||
_samplePaths.add("/bin");
|
||||
_samplePaths.add("/etc");
|
||||
|
@ -101,16 +97,16 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addSystem(IHost host) {
|
||||
IRemoteFileSubSystem fss = null;
|
||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
|
||||
for (int i=0; i<ss.length; i++) {
|
||||
if (ss[i] instanceof IRemoteFileSubSystem) {
|
||||
fss = (IRemoteFileSubSystem)ss[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
_subSystems.add(fss);
|
||||
_connections.add(host);
|
||||
}
|
||||
|
@ -120,14 +116,15 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
*/
|
||||
public void testImplicitConnectViaFileSubSystem() {
|
||||
//-test-author-:DaveMcKnight
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testImplicitConnectViaFileSubSystem")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setupConnections();
|
||||
|
||||
|
||||
String testPath = "/usr/lib";
|
||||
|
||||
for (int i = 0; i < _subSystems.size(); i++) {
|
||||
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
|
||||
|
||||
|
||||
// ensure that the system is NOT connected
|
||||
if (ss.isConnected()) {
|
||||
try {
|
||||
|
@ -135,17 +132,17 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
catch (Exception e) {
|
||||
// disconnect failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String systemType = ss.getConfigurationId();
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
IRemoteFile remoteFile = null;
|
||||
|
||||
|
||||
try {
|
||||
remoteFile = ss.getRemoteFileObject(testPath, new NullProgressMonitor());
|
||||
}
|
||||
|
@ -156,20 +153,21 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
|
||||
assertNull(systemType + ":Exception getting remote file! Possible cause: " + cause, exception); //$NON-NLS-1$
|
||||
assertTrue(ss.isConnected());
|
||||
assertNotNull(systemType + ":Unexpected return value for getRemoteFile(). Remote file is null!", remoteFile);
|
||||
assertNotNull(systemType + ":Unexpected return value for getRemoteFile(). Remote file is null!", remoteFile);
|
||||
}
|
||||
}
|
||||
public void testSingleFileQuery() {
|
||||
//-test-author-:DaveMcKnight
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testSingleFileQuery")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setupConnections();
|
||||
|
||||
|
||||
|
||||
|
||||
String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]);
|
||||
|
||||
for (int i = 0; i < _subSystems.size(); i++) {
|
||||
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
|
||||
|
||||
|
||||
// ensure that the system is connected
|
||||
if (!ss.isConnected()) {
|
||||
try {
|
||||
|
@ -177,19 +175,19 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
catch (Exception e) {
|
||||
// connect failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String systemType = ss.getConfigurationId();
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
IRemoteFile[] remoteFiles = new IRemoteFile[testPaths.length];
|
||||
|
||||
|
||||
long t1 = System.currentTimeMillis();
|
||||
for (int f = 0; f < testPaths.length; f++)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
remoteFiles[f] = ss.getRemoteFileObject(testPaths[f], new NullProgressMonitor());
|
||||
}
|
||||
|
@ -198,10 +196,10 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
cause = e.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long t2 = System.currentTimeMillis();
|
||||
|
||||
System.out.println(systemType + ": get files time = "+ (t2 - t1) + " milliseconds");
|
||||
|
||||
System.out.println(systemType + ": get files time = "+ (t2 - t1) + " milliseconds");
|
||||
|
||||
// query folders
|
||||
IRemoteFile[] results = null;
|
||||
|
@ -224,7 +222,7 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
results = (IRemoteFile[])consolidatedResults.toArray(new IRemoteFile[consolidatedResults.size()]);
|
||||
long t4 = System.currentTimeMillis();
|
||||
|
||||
|
||||
System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds");
|
||||
|
||||
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
|
||||
|
@ -242,25 +240,26 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
assertTrue(exists);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the multi file query
|
||||
*/
|
||||
public void testMultiFileQuery() {
|
||||
//-test-author-:DaveMcKnight
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testMultiFileQuery")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setupConnections();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]);
|
||||
|
||||
for (int i = 0; i < _subSystems.size(); i++) {
|
||||
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
|
||||
|
||||
|
||||
// ensure that the system is connected
|
||||
if (!ss.isConnected()) {
|
||||
try {
|
||||
|
@ -268,18 +267,18 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
catch (Exception e) {
|
||||
// connect failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String systemType = ss.getConfigurationId();
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
IRemoteFile[] remoteFiles = null;
|
||||
|
||||
|
||||
// get folders to query
|
||||
long t1 = System.currentTimeMillis();
|
||||
try
|
||||
try
|
||||
{
|
||||
remoteFiles = ss.getRemoteFileObjects(testPaths, new NullProgressMonitor());
|
||||
}
|
||||
|
@ -288,16 +287,16 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
e.printStackTrace();
|
||||
cause = e.getLocalizedMessage();
|
||||
}
|
||||
|
||||
|
||||
long t2 = System.currentTimeMillis();
|
||||
|
||||
|
||||
System.out.println(systemType + ": get files time = "+ (t2 - t1) + " milliseconds");
|
||||
|
||||
// query folders
|
||||
IRemoteFile[] results = null;
|
||||
long t3 = System.currentTimeMillis();
|
||||
try
|
||||
{
|
||||
{
|
||||
results = ss.listMultiple(remoteFiles, IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor());
|
||||
}
|
||||
catch (Exception e){
|
||||
|
@ -306,48 +305,50 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
cause = e.getLocalizedMessage();
|
||||
}
|
||||
long t4 = System.currentTimeMillis();
|
||||
|
||||
|
||||
System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds");
|
||||
|
||||
|
||||
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
|
||||
assertTrue(ss.isConnected());
|
||||
|
||||
System.out.println(systemType + ":results size="+results.length);
|
||||
System.out.println(systemType + ":results size="+results.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the single file download
|
||||
*/
|
||||
public void testSingleFileDownload() {
|
||||
//-test-author-:DaveMcKnight
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testSingleFileDownload")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setupConnections();
|
||||
internalFileDownload(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the multi file download
|
||||
*/
|
||||
public void testMultiFileDownload() {
|
||||
//-test-author-:DaveMcKnight
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testMultiFileDownload")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setupConnections();
|
||||
internalFileDownload(true);
|
||||
}
|
||||
|
||||
protected void internalFileDownload(boolean multi)
|
||||
|
||||
protected void internalFileDownload(boolean multi)
|
||||
{
|
||||
String remoteParentDir = "/usr/include";
|
||||
File tempDir = new File(LOCALTEMPDIR);
|
||||
File tempDir = new File(LOCALTEMPDIR);
|
||||
if (!tempDir.exists())
|
||||
{
|
||||
tempDir.mkdirs();
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < _subSystems.size(); i++) {
|
||||
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
|
||||
|
||||
|
||||
// ensure that the system is connected
|
||||
if (!ss.isConnected()) {
|
||||
try {
|
||||
|
@ -355,11 +356,11 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
catch (Exception e) {
|
||||
// connect failed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String systemType = ss.getConfigurationId();
|
||||
|
||||
|
||||
File subTempDir = new File(tempDir, systemType + (multi ? "_multi" : "_single"));
|
||||
if (subTempDir.exists())
|
||||
{
|
||||
|
@ -381,29 +382,29 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
{
|
||||
subTempDir.mkdirs();
|
||||
}
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
//IRemoteFile[] remoteFiles = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
IProgressMonitor monitor = new NullProgressMonitor();
|
||||
IRemoteFile includeDir = ss.getRemoteFileObject(remoteParentDir, monitor);
|
||||
|
||||
|
||||
// get all the files
|
||||
IRemoteFile[] files = ss.list(includeDir, IFileService.FILE_TYPE_FILES, monitor);
|
||||
|
||||
System.out.println(systemType + ": downloading "+files.length+ " files");
|
||||
|
||||
|
||||
|
||||
|
||||
// determine local locations for each
|
||||
String[] destinations = new String[files.length];
|
||||
String[] encodings = new String[files.length];
|
||||
long[] fileSizes = new long[files.length];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for (int d = 0; d < files.length; d++)
|
||||
{
|
||||
IRemoteFile file = files[d];
|
||||
|
@ -411,19 +412,19 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
encodings[d] = file.getEncoding();
|
||||
fileSizes[d] = file.getLength();
|
||||
}
|
||||
|
||||
|
||||
long t1 = System.currentTimeMillis();
|
||||
if (multi) // multi file download
|
||||
{
|
||||
System.out.println(systemType + ":Starting multi-file Download");
|
||||
|
||||
|
||||
// transfer the files
|
||||
ss.downloadMultiple(files, destinations, encodings, monitor);
|
||||
}
|
||||
else // single file download
|
||||
{
|
||||
System.out.println(systemType + ":Starting single file Download");
|
||||
|
||||
|
||||
for (int s = 0; s < files.length; s++)
|
||||
{
|
||||
// transfer the files
|
||||
|
@ -432,22 +433,22 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
long t2 = System.currentTimeMillis();
|
||||
System.out.println(systemType + ": download time = "+ (t2 - t1) + " milliseconds");
|
||||
|
||||
|
||||
|
||||
|
||||
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
|
||||
assertTrue(ss.isConnected());
|
||||
|
||||
|
||||
// examine results
|
||||
for (int r = 0; r < destinations.length; r++)
|
||||
{
|
||||
// check results and compare their sizes
|
||||
long expectedSize = fileSizes[r];
|
||||
|
||||
|
||||
File destination = new File(destinations[r]);
|
||||
long actualSize = destination.length();
|
||||
|
||||
|
||||
boolean goodDownload = expectedSize == actualSize;
|
||||
|
||||
|
||||
if (!goodDownload)
|
||||
{
|
||||
System.out.println("bad download of "+ destination.getAbsolutePath());
|
||||
|
@ -458,15 +459,11 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
|
|||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Tobias Schwarz (Wind River) - initial API and implementation.
|
||||
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
|
||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||
|
@ -24,7 +24,6 @@ import org.eclipse.rse.core.model.IHost;
|
|||
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||
import org.eclipse.rse.internal.ui.view.SystemView;
|
||||
import org.eclipse.rse.internal.ui.view.SystemViewPart;
|
||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||
import org.eclipse.rse.tests.core.IRSEViews;
|
||||
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
|
||||
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
||||
|
@ -37,13 +36,13 @@ import org.eclipse.ui.PlatformUI;
|
|||
public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||
private ITestSubSystem testSubSystem;
|
||||
SystemView rseSystemView;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
|
||||
// all view management must happen in the UI thread!
|
||||
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -57,20 +56,21 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
});
|
||||
assertNotNull("Failed to get remote system viewer instance from RSE remote systems view!", rseSystemView); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
rseSystemView = null;
|
||||
testSubSystem = null;
|
||||
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
public void testAddAndDeleteDeepNodes() {
|
||||
//-test-author-:TobiasSchwarz
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testAddAndDeleteDeepNodes")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
// these test _must_ run in UI thread
|
||||
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -78,10 +78,11 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void testAddAndDeleteFlatNodes() {
|
||||
//-test-author-:TobiasSchwarz
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testAddAndDeleteFlatNodes")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
// these test _must_ run in UI thread
|
||||
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -89,14 +90,14 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void internalTestAddAndDeleteNodes(boolean deep) {
|
||||
IHost connection = getLocalSystemConnection();
|
||||
assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
|
||||
|
||||
testSubSystem = null;
|
||||
try {
|
||||
testSubSystem = getConnectionManager().getTestSubSystem(connection);
|
||||
|
@ -110,7 +111,7 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
testSubSystem.removeAllChildNodes();
|
||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||
registry.invalidateFiltersFor(testSubSystem);
|
||||
|
||||
|
||||
TestSubSystemContainerNode node = null;
|
||||
for (int i=0; i<100; i++) {
|
||||
if (node == null) {
|
||||
|
@ -131,18 +132,19 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
rseSystemView.refresh(testSubSystem);
|
||||
rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS);
|
||||
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
||||
|
||||
|
||||
testSubSystem.removeAllChildNodes();
|
||||
//registry.invalidateFiltersFor(testSubSystem);
|
||||
|
||||
|
||||
//SystemPerspectiveHelpers.findRSEView().refresh(testSubSystem);
|
||||
registry.fireEvent(new SystemResourceChangeEvent(testSubSystem, ISystemResourceChangeEvents.EVENT_REFRESH, testSubSystem));
|
||||
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
||||
}
|
||||
|
||||
|
||||
public void testBugzilla170728() {
|
||||
//-test-author-:TobiasSchwarz
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testBugzilla170728")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
// these test _must_ run in UI thread
|
||||
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -154,10 +156,10 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
public void internalTestBugzilla170728() {
|
||||
IHost connection = getLocalSystemConnection();
|
||||
assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
|
||||
|
||||
testSubSystem = null;
|
||||
try {
|
||||
testSubSystem = getConnectionManager().getTestSubSystem(connection);
|
||||
|
@ -179,26 +181,26 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
|
||||
try {
|
||||
mgr.createSystemFilter(mgr.getFirstDefaultSystemFilterPool(), "Node*", strings, "Node*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
|
||||
TestSubSystemNode node = new TestSubSystemNode("Node 1"); //$NON-NLS-1$
|
||||
testSubSystem.addChildNode(node);
|
||||
testSubSystem.addChildNode(new TestSubSystemNode("Node 2")); //$NON-NLS-1$
|
||||
testSubSystem.addChildNode(new TestSubSystemNode("Node 3")); //$NON-NLS-1$
|
||||
testSubSystem.addChildNode(new TestSubSystemNode("Node 4")); //$NON-NLS-1$
|
||||
|
||||
|
||||
RSECorePlugin.getTheSystemRegistry().invalidateFiltersFor(testSubSystem);
|
||||
rseSystemView.refresh(testSubSystem);
|
||||
|
||||
|
||||
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
||||
rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS);
|
||||
rseSystemView.refresh(testSubSystem);
|
||||
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
||||
|
||||
|
||||
node.setName("Node 1 (changed)"); //$NON-NLS-1$
|
||||
|
||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||
registry.fireEvent(new SystemResourceChangeEvent(node, ISystemResourceChangeEvents.EVENT_REFRESH, node));
|
||||
|
||||
|
||||
RSEWaitAndDispatchUtil.waitAndDispatch(10000);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -209,7 +211,7 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
//cause of the Error (the original exception) is maintained by calling
|
||||
//initCause(). This will allow seeing it in the JUnit runner later on.
|
||||
Error err = new AssertionFailedError("Unhandled event loop exception");
|
||||
err.initCause(e);
|
||||
err.initCause(e);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
|
@ -22,26 +22,28 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
|||
* Test various aspects of mnemonic generation and assignment.
|
||||
*/
|
||||
public class PreferencesTest extends RSECoreTestCase {
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
public void testShowLists() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
|
||||
boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
|
||||
assertTrue(showLists);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue