1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 12:35:22 +02:00

[240729] More flexible disabling of testcases

This commit is contained in:
Martin Oberhuber 2008-07-14 21:53:41 +00:00
parent 464ddfc950
commit c41e3fd332
7 changed files with 189 additions and 154 deletions

View file

@ -245,6 +245,16 @@ public class RSECoreTestCase extends TestCase {
System.out.println("--> disabled due to rule: " + checkString); System.out.println("--> disabled due to rule: " + checkString);
return true; 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) { if (targetName != null) {
checkString = "*." + targetName; checkString = "*." + targetName;
if (!RSETestsPlugin.isTestCaseEnabled(checkString)) { if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {

View file

@ -77,6 +77,9 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
* @return The local system type connection or <code>null</code> if the lookup fails. * @return The local system type connection or <code>null</code> if the lookup fails.
*/ */
protected IHost getLocalSystemConnection() { protected IHost getLocalSystemConnection() {
setTargetName("local");
if (isTestDisabled())
return null;
assertNotNull("Local system connection properties are not available!", localSystemConnectionProperties); //$NON-NLS-1$ assertNotNull("Local system connection properties are not available!", localSystemConnectionProperties); //$NON-NLS-1$
Exception exception = null; Exception exception = null;
@ -97,21 +100,33 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
protected IHost getSSHHost() protected IHost getSSHHost()
{ {
setTargetName("ssh");
if (isTestDisabled())
return null;
return getHost("sshConnection.properties"); return getHost("sshConnection.properties");
} }
protected IHost getFTPHost() protected IHost getFTPHost()
{ {
setTargetName("ftp");
if (isTestDisabled())
return null;
return getHost("ftpConnection.properties"); return getHost("ftpConnection.properties");
} }
protected IHost getLinuxHost() protected IHost getLinuxHost()
{ {
setTargetName("linux");
if (isTestDisabled())
return null;
return getHost("linuxConnection.properties"); return getHost("linuxConnection.properties");
} }
protected IHost getWindowsHost() protected IHost getWindowsHost()
{ {
setTargetName("windows");
if (isTestDisabled())
return null;
return getHost("windowsConnection.properties"); return getHost("windowsConnection.properties");
} }

View file

@ -22,7 +22,6 @@ import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystem;
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;
@ -40,6 +39,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
*/ */
public void testConnectionCaseInSensitive() throws Exception { public void testConnectionCaseInSensitive() throws Exception {
// -test-author-:MartinOberhuber // -test-author-:MartinOberhuber
if (isTestDisabled())
return;
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
ISystemProfile prof = RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile(); ISystemProfile prof = RSECorePlugin.getTheSystemProfileManager().getDefaultPrivateSystemProfile();
ISystemProfile testprof = RSECorePlugin.getTheSystemProfileManager().cloneSystemProfile(prof, "testConnectionCaseInSensitive"); ISystemProfile testprof = RSECorePlugin.getTheSystemProfileManager().cloneSystemProfile(prof, "testConnectionCaseInSensitive");
@ -60,7 +61,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
*/ */
public void testConnectionCreation() { public void testConnectionCreation() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnectionCreation")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$ properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$
@ -105,7 +107,8 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
*/ */
public void testConnectionRemoval() { public void testConnectionRemoval() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnectionRemoval")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
String profileName = "TestProfile"; //$NON-NLS-1$ String profileName = "TestProfile"; //$NON-NLS-1$
@ -123,12 +126,13 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
*/ */
public void testConnect() { public void testConnect() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnect")) return; //$NON-NLS-1$ IHost connection = getLocalSystemConnection();
if (isTestDisabled())
return;
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
IHost connection = getLocalSystemConnection();
ISubSystem subsystem = null; ISubSystem subsystem = null;
try { try {
subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$ subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$
@ -173,12 +177,13 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
*/ */
public void testResolveFilterString() { public void testResolveFilterString() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testResolveFilterString")) return; //$NON-NLS-1$ IHost connection = getLocalSystemConnection();
if (isTestDisabled())
return;
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
IHost connection = getLocalSystemConnection();
ISubSystem subsystem = null; ISubSystem subsystem = null;
try { try {
subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$ subsystem = getConnectionManager().getFileSubSystem(connection, "local.files"); //$NON-NLS-1$

View file

@ -1,7 +1,7 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
@ -22,29 +22,31 @@ import org.eclipse.rse.tests.core.RSECoreTestCase;
* Test various aspects of mnemonic generation and assignment. * Test various aspects of mnemonic generation and assignment.
*/ */
public class PasswordsTest extends RSECoreTestCase { public class PasswordsTest extends RSECoreTestCase {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
*/ */
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/ */
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();
} }
public void testAddRemove() { public void testAddRemove() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (isTestDisabled())
return;
IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID); IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID);
IRSESystemType defaultSystemType = PasswordPersistenceManager.DEFAULT_SYSTEM_TYPE; IRSESystemType defaultSystemType = PasswordPersistenceManager.DEFAULT_SYSTEM_TYPE;
String hostAddress = "somesystem.mycompany.com"; String hostAddress = "somesystem.mycompany.com";
boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress); boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress);
assertFalse("the initial value of this preference should be false", deny); assertFalse("the initial value of this preference should be false", deny);
String password = "password"; String password = "password";
String userId = "me"; String userId = "me";
SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType); SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType);
@ -88,14 +90,16 @@ public class PasswordsTest extends RSECoreTestCase {
returnedInfo = ppm.find(systemType, hostAddress, userId, false); returnedInfo = ppm.find(systemType, hostAddress, userId, false);
assertNull("signon info was found but should not be", returnedInfo); assertNull("signon info was found but should not be", returnedInfo);
} }
public void testSaveDenial() { public void testSaveDenial() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (isTestDisabled())
return;
IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID); IRSESystemType systemType = RSECoreRegistry.getInstance().getSystemType(IRSESystemType.SYSTEMTYPE_UNIX_ID);
String hostAddress = "somesystem.mycompany.com"; String hostAddress = "somesystem.mycompany.com";
boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress); boolean deny = RSEPreferencesManager.getDenyPasswordSave(systemType, hostAddress);
assertFalse("the initial value of this preference should be false", deny); assertFalse("the initial value of this preference should be false", deny);
String password = "password"; String password = "password";
String userId = "me"; String userId = "me";
SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType); SystemSignonInformation info = new SystemSignonInformation(hostAddress, userId, password, systemType);
@ -129,5 +133,5 @@ public class PasswordsTest extends RSECoreTestCase {
returnedInfo = ppm.find(systemType, hostAddress, userId, false); returnedInfo = ppm.find(systemType, hostAddress, userId, false);
assertNull("signon info was found but should not be", returnedInfo); assertNull("signon info was found but should not be", returnedInfo);
} }
} }

View file

@ -3,7 +3,7 @@
* This program and the accompanying materials are made available under the terms * 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 * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* David McKnight (IBM) - [207095] test case to compare same op between subsystems * David McKnight (IBM) - [207095] test case to compare same op between subsystems
* David McKnight (IBM) - [162195] new APIs for upload multi and download multi * 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.services.files.IFileService;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.tests.RSETestsPlugin;
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
/** /**
* Test cases for comparing various file subsystem operations * Test cases for comparing various file subsystem operations
*/ */
public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase { public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase {
private List _subSystems; private List _subSystems;
private List _connections; private List _connections;
private List _samplePaths; private List _samplePaths;
private String LOCALTEMPDIR = "C:\\temp"; private String LOCALTEMPDIR = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/ */
@ -50,10 +49,10 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
if (ss != null && ss.isConnected()) { if (ss != null && ss.isConnected()) {
ss.disconnect(true); ss.disconnect(true);
} }
} }
} }
if (_connections != null) if (_connections != null)
{ {
for (int j = 0; j < _connections.size(); j++) { for (int j = 0; j < _connections.size(); j++) {
@ -68,31 +67,28 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
_connections.clear(); _connections.clear();
_subSystems = null; _subSystems = null;
_connections = null; _connections = null;
super.tearDown(); super.tearDown();
} }
protected void setupConnections() { protected void setupConnections() {
if (_connections == null) if (_connections == null)
{ {
_connections = new ArrayList(); _connections = new ArrayList();
_subSystems = new ArrayList(); _subSystems = new ArrayList();
// setup dstore connection //TODO Support Windows style connections
addSystem(getLinuxHost()); //String[] connTypes = { "local", "ssh", "ftpWindows", "ftp", "linux", "windows" };
String[] connTypes = { "ssh", "ftp", "linux" };
// setup ssh connection for (int i = 0; i < connTypes.length; i++) {
addSystem(getSSHHost()); addSystem(getHost(connTypes[i] + "Connection.properties"));
}
// setup ftp connection
addSystem(getFTPHost());
_samplePaths = new ArrayList(); _samplePaths = new ArrayList();
_samplePaths.add("/usr"); _samplePaths.add("/usr");
_samplePaths.add("/usr/lib"); _samplePaths.add("/usr/lib");
_samplePaths.add("/usr/bin"); _samplePaths.add("/usr/bin");
_samplePaths.add("/bin"); _samplePaths.add("/bin");
_samplePaths.add("/etc"); _samplePaths.add("/etc");
@ -101,16 +97,16 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
} }
private void addSystem(IHost host) { private void addSystem(IHost host) {
IRemoteFileSubSystem fss = null; IRemoteFileSubSystem fss = null;
ISystemRegistry sr = SystemStartHere.getSystemRegistry(); ISystemRegistry sr = SystemStartHere.getSystemRegistry();
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class); ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
for (int i=0; i<ss.length; i++) { for (int i=0; i<ss.length; i++) {
if (ss[i] instanceof IRemoteFileSubSystem) { if (ss[i] instanceof IRemoteFileSubSystem) {
fss = (IRemoteFileSubSystem)ss[i]; fss = (IRemoteFileSubSystem)ss[i];
} }
} }
_subSystems.add(fss); _subSystems.add(fss);
_connections.add(host); _connections.add(host);
} }
@ -120,14 +116,15 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
*/ */
public void testImplicitConnectViaFileSubSystem() { public void testImplicitConnectViaFileSubSystem() {
//-test-author-:DaveMcKnight //-test-author-:DaveMcKnight
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testImplicitConnectViaFileSubSystem")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
setupConnections(); setupConnections();
String testPath = "/usr/lib"; String testPath = "/usr/lib";
for (int i = 0; i < _subSystems.size(); i++) { for (int i = 0; i < _subSystems.size(); i++) {
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
// ensure that the system is NOT connected // ensure that the system is NOT connected
if (ss.isConnected()) { if (ss.isConnected()) {
try { try {
@ -135,17 +132,17 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
catch (Exception e) { catch (Exception e) {
// disconnect failed // disconnect failed
} }
} }
String systemType = ss.getConfigurationId(); String systemType = ss.getConfigurationId();
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
IRemoteFile remoteFile = null; IRemoteFile remoteFile = null;
try { try {
remoteFile = ss.getRemoteFileObject(testPath, new NullProgressMonitor()); 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$ assertNull(systemType + ":Exception getting remote file! Possible cause: " + cause, exception); //$NON-NLS-1$
assertTrue(ss.isConnected()); 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() { public void testSingleFileQuery() {
//-test-author-:DaveMcKnight //-test-author-:DaveMcKnight
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testSingleFileQuery")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
setupConnections(); setupConnections();
String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]); String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]);
for (int i = 0; i < _subSystems.size(); i++) { for (int i = 0; i < _subSystems.size(); i++) {
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
// ensure that the system is connected // ensure that the system is connected
if (!ss.isConnected()) { if (!ss.isConnected()) {
try { try {
@ -177,19 +175,19 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
catch (Exception e) { catch (Exception e) {
// connect failed // connect failed
} }
} }
String systemType = ss.getConfigurationId(); String systemType = ss.getConfigurationId();
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
IRemoteFile[] remoteFiles = new IRemoteFile[testPaths.length]; IRemoteFile[] remoteFiles = new IRemoteFile[testPaths.length];
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
for (int f = 0; f < testPaths.length; f++) for (int f = 0; f < testPaths.length; f++)
{ {
try try
{ {
remoteFiles[f] = ss.getRemoteFileObject(testPaths[f], new NullProgressMonitor()); remoteFiles[f] = ss.getRemoteFileObject(testPaths[f], new NullProgressMonitor());
} }
@ -198,10 +196,10 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
cause = e.getLocalizedMessage(); cause = e.getLocalizedMessage();
} }
} }
long t2 = System.currentTimeMillis(); 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 // query folders
IRemoteFile[] results = null; IRemoteFile[] results = null;
@ -224,7 +222,7 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
results = (IRemoteFile[])consolidatedResults.toArray(new IRemoteFile[consolidatedResults.size()]); results = (IRemoteFile[])consolidatedResults.toArray(new IRemoteFile[consolidatedResults.size()]);
long t4 = System.currentTimeMillis(); long t4 = System.currentTimeMillis();
System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds"); System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds");
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
@ -242,25 +240,26 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
assertTrue(exists); assertTrue(exists);
} }
*/ */
} }
} }
/** /**
* Test the multi file query * Test the multi file query
*/ */
public void testMultiFileQuery() { public void testMultiFileQuery() {
//-test-author-:DaveMcKnight //-test-author-:DaveMcKnight
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testMultiFileQuery")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
setupConnections(); setupConnections();
String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]); String[] testPaths = (String[])_samplePaths.toArray(new String[_samplePaths.size()]);
for (int i = 0; i < _subSystems.size(); i++) { for (int i = 0; i < _subSystems.size(); i++) {
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
// ensure that the system is connected // ensure that the system is connected
if (!ss.isConnected()) { if (!ss.isConnected()) {
try { try {
@ -268,18 +267,18 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
catch (Exception e) { catch (Exception e) {
// connect failed // connect failed
} }
} }
String systemType = ss.getConfigurationId(); String systemType = ss.getConfigurationId();
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
IRemoteFile[] remoteFiles = null; IRemoteFile[] remoteFiles = null;
// get folders to query // get folders to query
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
try try
{ {
remoteFiles = ss.getRemoteFileObjects(testPaths, new NullProgressMonitor()); remoteFiles = ss.getRemoteFileObjects(testPaths, new NullProgressMonitor());
} }
@ -288,16 +287,16 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
e.printStackTrace(); e.printStackTrace();
cause = e.getLocalizedMessage(); cause = e.getLocalizedMessage();
} }
long t2 = System.currentTimeMillis(); 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 // query folders
IRemoteFile[] results = null; IRemoteFile[] results = null;
long t3 = System.currentTimeMillis(); long t3 = System.currentTimeMillis();
try try
{ {
results = ss.listMultiple(remoteFiles, IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor()); results = ss.listMultiple(remoteFiles, IFileService.FILE_TYPE_FILES_AND_FOLDERS, new NullProgressMonitor());
} }
catch (Exception e){ catch (Exception e){
@ -306,48 +305,50 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
cause = e.getLocalizedMessage(); cause = e.getLocalizedMessage();
} }
long t4 = System.currentTimeMillis(); long t4 = System.currentTimeMillis();
System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds"); System.out.println(systemType + ": query time = "+ (t4 - t3) + " milliseconds");
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
assertTrue(ss.isConnected()); assertTrue(ss.isConnected());
System.out.println(systemType + ":results size="+results.length); System.out.println(systemType + ":results size="+results.length);
} }
} }
/** /**
* Test the single file download * Test the single file download
*/ */
public void testSingleFileDownload() { public void testSingleFileDownload() {
//-test-author-:DaveMcKnight //-test-author-:DaveMcKnight
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testSingleFileDownload")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
setupConnections(); setupConnections();
internalFileDownload(false); internalFileDownload(false);
} }
/** /**
* Test the multi file download * Test the multi file download
*/ */
public void testMultiFileDownload() { public void testMultiFileDownload() {
//-test-author-:DaveMcKnight //-test-author-:DaveMcKnight
if (!RSETestsPlugin.isTestCaseEnabled("FileSubsystemConsistencyTestCase.testMultiFileDownload")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
setupConnections(); setupConnections();
internalFileDownload(true); internalFileDownload(true);
} }
protected void internalFileDownload(boolean multi) protected void internalFileDownload(boolean multi)
{ {
String remoteParentDir = "/usr/include"; String remoteParentDir = "/usr/include";
File tempDir = new File(LOCALTEMPDIR); File tempDir = new File(LOCALTEMPDIR);
if (!tempDir.exists()) if (!tempDir.exists())
{ {
tempDir.mkdirs(); tempDir.mkdirs();
} }
for (int i = 0; i < _subSystems.size(); i++) { for (int i = 0; i < _subSystems.size(); i++) {
IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i); IRemoteFileSubSystem ss = (IRemoteFileSubSystem)_subSystems.get(i);
// ensure that the system is connected // ensure that the system is connected
if (!ss.isConnected()) { if (!ss.isConnected()) {
try { try {
@ -355,11 +356,11 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
catch (Exception e) { catch (Exception e) {
// connect failed // connect failed
} }
} }
String systemType = ss.getConfigurationId(); String systemType = ss.getConfigurationId();
File subTempDir = new File(tempDir, systemType + (multi ? "_multi" : "_single")); File subTempDir = new File(tempDir, systemType + (multi ? "_multi" : "_single"));
if (subTempDir.exists()) if (subTempDir.exists())
{ {
@ -381,29 +382,29 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
{ {
subTempDir.mkdirs(); subTempDir.mkdirs();
} }
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
//IRemoteFile[] remoteFiles = null; //IRemoteFile[] remoteFiles = null;
try try
{ {
IProgressMonitor monitor = new NullProgressMonitor(); IProgressMonitor monitor = new NullProgressMonitor();
IRemoteFile includeDir = ss.getRemoteFileObject(remoteParentDir, monitor); IRemoteFile includeDir = ss.getRemoteFileObject(remoteParentDir, monitor);
// get all the files // get all the files
IRemoteFile[] files = ss.list(includeDir, IFileService.FILE_TYPE_FILES, monitor); IRemoteFile[] files = ss.list(includeDir, IFileService.FILE_TYPE_FILES, monitor);
System.out.println(systemType + ": downloading "+files.length+ " files"); System.out.println(systemType + ": downloading "+files.length+ " files");
// determine local locations for each // determine local locations for each
String[] destinations = new String[files.length]; String[] destinations = new String[files.length];
String[] encodings = new String[files.length]; String[] encodings = new String[files.length];
long[] fileSizes = new long[files.length]; long[] fileSizes = new long[files.length];
for (int d = 0; d < files.length; d++) for (int d = 0; d < files.length; d++)
{ {
IRemoteFile file = files[d]; IRemoteFile file = files[d];
@ -411,19 +412,19 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
encodings[d] = file.getEncoding(); encodings[d] = file.getEncoding();
fileSizes[d] = file.getLength(); fileSizes[d] = file.getLength();
} }
long t1 = System.currentTimeMillis(); long t1 = System.currentTimeMillis();
if (multi) // multi file download if (multi) // multi file download
{ {
System.out.println(systemType + ":Starting multi-file Download"); System.out.println(systemType + ":Starting multi-file Download");
// transfer the files // transfer the files
ss.downloadMultiple(files, destinations, encodings, monitor); ss.downloadMultiple(files, destinations, encodings, monitor);
} }
else // single file download else // single file download
{ {
System.out.println(systemType + ":Starting single file Download"); System.out.println(systemType + ":Starting single file Download");
for (int s = 0; s < files.length; s++) for (int s = 0; s < files.length; s++)
{ {
// transfer the files // transfer the files
@ -432,22 +433,22 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
long t2 = System.currentTimeMillis(); long t2 = System.currentTimeMillis();
System.out.println(systemType + ": download time = "+ (t2 - t1) + " milliseconds"); System.out.println(systemType + ": download time = "+ (t2 - t1) + " milliseconds");
assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$ assertNull(systemType + ":Exception getting remote files! Possible cause: " + cause, exception); //$NON-NLS-1$
assertTrue(ss.isConnected()); assertTrue(ss.isConnected());
// examine results // examine results
for (int r = 0; r < destinations.length; r++) for (int r = 0; r < destinations.length; r++)
{ {
// check results and compare their sizes // check results and compare their sizes
long expectedSize = fileSizes[r]; long expectedSize = fileSizes[r];
File destination = new File(destinations[r]); File destination = new File(destinations[r]);
long actualSize = destination.length(); long actualSize = destination.length();
boolean goodDownload = expectedSize == actualSize; boolean goodDownload = expectedSize == actualSize;
if (!goodDownload) if (!goodDownload)
{ {
System.out.println("bad download of "+ destination.getAbsolutePath()); System.out.println("bad download of "+ destination.getAbsolutePath());
@ -458,15 +459,11 @@ public class FileSubsystemConsistencyTestCase extends RSEBaseConnectionTestCase
} }
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
} }

View file

@ -1,11 +1,11 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others. * Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Tobias Schwarz (Wind River) - initial API and implementation. * Tobias Schwarz (Wind River) - initial API and implementation.
* Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * 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.core.model.ISystemRegistry;
import org.eclipse.rse.internal.ui.view.SystemView; import org.eclipse.rse.internal.ui.view.SystemView;
import org.eclipse.rse.internal.ui.view.SystemViewPart; 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.IRSEViews;
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil; import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase; import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
@ -37,13 +36,13 @@ import org.eclipse.ui.PlatformUI;
public class TestSubsystemTestCase extends RSEBaseConnectionTestCase { public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
private ITestSubSystem testSubSystem; private ITestSubSystem testSubSystem;
SystemView rseSystemView; SystemView rseSystemView;
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
*/ */
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
// all view management must happen in the UI thread! // all view management must happen in the UI thread!
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() { 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$ assertNotNull("Failed to get remote system viewer instance from RSE remote systems view!", rseSystemView); //$NON-NLS-1$
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/ */
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
rseSystemView = null; rseSystemView = null;
testSubSystem = null; testSubSystem = null;
super.tearDown(); super.tearDown();
} }
public void testAddAndDeleteDeepNodes() { public void testAddAndDeleteDeepNodes() {
//-test-author-:TobiasSchwarz //-test-author-:TobiasSchwarz
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testAddAndDeleteDeepNodes")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
// these test _must_ run in UI thread // these test _must_ run in UI thread
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() { public void run() {
@ -78,10 +78,11 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
} }
}); });
} }
public void testAddAndDeleteFlatNodes() { public void testAddAndDeleteFlatNodes() {
//-test-author-:TobiasSchwarz //-test-author-:TobiasSchwarz
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testAddAndDeleteFlatNodes")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
// these test _must_ run in UI thread // these test _must_ run in UI thread
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() { public void run() {
@ -89,14 +90,14 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
} }
}); });
} }
public void internalTestAddAndDeleteNodes(boolean deep) { public void internalTestAddAndDeleteNodes(boolean deep) {
IHost connection = getLocalSystemConnection(); IHost connection = getLocalSystemConnection();
assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$ assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
testSubSystem = null; testSubSystem = null;
try { try {
testSubSystem = getConnectionManager().getTestSubSystem(connection); testSubSystem = getConnectionManager().getTestSubSystem(connection);
@ -110,7 +111,7 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
testSubSystem.removeAllChildNodes(); testSubSystem.removeAllChildNodes();
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
registry.invalidateFiltersFor(testSubSystem); registry.invalidateFiltersFor(testSubSystem);
TestSubSystemContainerNode node = null; TestSubSystemContainerNode node = null;
for (int i=0; i<100; i++) { for (int i=0; i<100; i++) {
if (node == null) { if (node == null) {
@ -131,18 +132,19 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
rseSystemView.refresh(testSubSystem); rseSystemView.refresh(testSubSystem);
rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS); rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS);
RSEWaitAndDispatchUtil.waitAndDispatch(1000); RSEWaitAndDispatchUtil.waitAndDispatch(1000);
testSubSystem.removeAllChildNodes(); testSubSystem.removeAllChildNodes();
//registry.invalidateFiltersFor(testSubSystem); //registry.invalidateFiltersFor(testSubSystem);
//SystemPerspectiveHelpers.findRSEView().refresh(testSubSystem); //SystemPerspectiveHelpers.findRSEView().refresh(testSubSystem);
registry.fireEvent(new SystemResourceChangeEvent(testSubSystem, ISystemResourceChangeEvents.EVENT_REFRESH, testSubSystem)); registry.fireEvent(new SystemResourceChangeEvent(testSubSystem, ISystemResourceChangeEvents.EVENT_REFRESH, testSubSystem));
RSEWaitAndDispatchUtil.waitAndDispatch(1000); RSEWaitAndDispatchUtil.waitAndDispatch(1000);
} }
public void testBugzilla170728() { public void testBugzilla170728() {
//-test-author-:TobiasSchwarz //-test-author-:TobiasSchwarz
if (!RSETestsPlugin.isTestCaseEnabled("TestSubsystemTestCase.testBugzilla170728")) return; //$NON-NLS-1$ if (isTestDisabled())
return;
// these test _must_ run in UI thread // these test _must_ run in UI thread
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() { public void run() {
@ -154,10 +156,10 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
public void internalTestBugzilla170728() { public void internalTestBugzilla170728() {
IHost connection = getLocalSystemConnection(); IHost connection = getLocalSystemConnection();
assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$ assertNotNull("Failed to get local system connection", connection); //$NON-NLS-1$
Exception exception = null; Exception exception = null;
String cause = null; String cause = null;
testSubSystem = null; testSubSystem = null;
try { try {
testSubSystem = getConnectionManager().getTestSubSystem(connection); testSubSystem = getConnectionManager().getTestSubSystem(connection);
@ -179,26 +181,26 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
try { try {
mgr.createSystemFilter(mgr.getFirstDefaultSystemFilterPool(), "Node*", strings, "Node*"); //$NON-NLS-1$ //$NON-NLS-2$ mgr.createSystemFilter(mgr.getFirstDefaultSystemFilterPool(), "Node*", strings, "Node*"); //$NON-NLS-1$ //$NON-NLS-2$
TestSubSystemNode node = new TestSubSystemNode("Node 1"); //$NON-NLS-1$ TestSubSystemNode node = new TestSubSystemNode("Node 1"); //$NON-NLS-1$
testSubSystem.addChildNode(node); testSubSystem.addChildNode(node);
testSubSystem.addChildNode(new TestSubSystemNode("Node 2")); //$NON-NLS-1$ testSubSystem.addChildNode(new TestSubSystemNode("Node 2")); //$NON-NLS-1$
testSubSystem.addChildNode(new TestSubSystemNode("Node 3")); //$NON-NLS-1$ testSubSystem.addChildNode(new TestSubSystemNode("Node 3")); //$NON-NLS-1$
testSubSystem.addChildNode(new TestSubSystemNode("Node 4")); //$NON-NLS-1$ testSubSystem.addChildNode(new TestSubSystemNode("Node 4")); //$NON-NLS-1$
RSECorePlugin.getTheSystemRegistry().invalidateFiltersFor(testSubSystem); RSECorePlugin.getTheSystemRegistry().invalidateFiltersFor(testSubSystem);
rseSystemView.refresh(testSubSystem); rseSystemView.refresh(testSubSystem);
RSEWaitAndDispatchUtil.waitAndDispatch(1000); RSEWaitAndDispatchUtil.waitAndDispatch(1000);
rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS); rseSystemView.expandToLevel(testSubSystem, AbstractTreeViewer.ALL_LEVELS);
rseSystemView.refresh(testSubSystem); rseSystemView.refresh(testSubSystem);
RSEWaitAndDispatchUtil.waitAndDispatch(1000); RSEWaitAndDispatchUtil.waitAndDispatch(1000);
node.setName("Node 1 (changed)"); //$NON-NLS-1$ node.setName("Node 1 (changed)"); //$NON-NLS-1$
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
registry.fireEvent(new SystemResourceChangeEvent(node, ISystemResourceChangeEvents.EVENT_REFRESH, node)); registry.fireEvent(new SystemResourceChangeEvent(node, ISystemResourceChangeEvents.EVENT_REFRESH, node));
RSEWaitAndDispatchUtil.waitAndDispatch(10000); RSEWaitAndDispatchUtil.waitAndDispatch(10000);
} }
catch (Exception e) { catch (Exception e) {
@ -209,7 +211,7 @@ public class TestSubsystemTestCase extends RSEBaseConnectionTestCase {
//cause of the Error (the original exception) is maintained by calling //cause of the Error (the original exception) is maintained by calling
//initCause(). This will allow seeing it in the JUnit runner later on. //initCause(). This will allow seeing it in the JUnit runner later on.
Error err = new AssertionFailedError("Unhandled event loop exception"); Error err = new AssertionFailedError("Unhandled event loop exception");
err.initCause(e); err.initCause(e);
throw err; throw err;
} }
} }

View file

@ -1,7 +1,7 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * 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 * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
@ -22,26 +22,28 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
* Test various aspects of mnemonic generation and assignment. * Test various aspects of mnemonic generation and assignment.
*/ */
public class PreferencesTest extends RSECoreTestCase { public class PreferencesTest extends RSECoreTestCase {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
*/ */
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown() * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/ */
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
super.tearDown(); super.tearDown();
} }
public void testShowLists() { public void testShowLists() {
//-test-author-:DavidDykstal //-test-author-:DavidDykstal
if (isTestDisabled())
return;
Preferences store = RSEUIPlugin.getDefault().getPluginPreferences(); Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS); boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
assertTrue(showLists); assertTrue(showLists);
} }
} }