From c41e3fd332fd4285d4fe69eebf2d95875ca5426c Mon Sep 17 00:00:00 2001
From: Martin Oberhuber < martin.oberhuber@windriver.com>
Date: Mon, 14 Jul 2008 21:53:41 +0000
Subject: [PATCH] [240729] More flexible disabling of testcases
---
.../rse/tests/core/RSECoreTestCase.java | 10 +
.../connection/RSEBaseConnectionTestCase.java | 15 ++
.../connection/RSEConnectionTestCase.java | 19 +-
.../tests/core/passwords/PasswordsTest.java | 20 +-
.../FileSubsystemConsistencyTestCase.java | 203 +++++++++---------
.../testsubsystem/TestSubsystemTestCase.java | 64 +++---
.../tests/ui/preferences/PreferencesTest.java | 12 +-
7 files changed, 189 insertions(+), 154 deletions(-)
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java
index c4edd437050..a97b441cc92 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java
@@ -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)) {
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
index 21cd835afe9..f576e9fb308 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
@@ -77,6 +77,9 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
* @return The local system type connection or null
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");
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
index ef0e995bed1..7ed1c4b51f2 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
@@ -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$
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java
index a88ed5ea2d1..8f5ff871aa9 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/passwords/PasswordsTest.java
@@ -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);
}
-
+
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java
index 8bad1a306a9..2f042b89329 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/FileSubsystemConsistencyTestCase.java
@@ -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