null
!
* @param enable Specify true
to enable the property, false
to disable the property.
*/
protected final void setProperty(String key, boolean enable) {
setProperty(key, enable ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
}
-
+
/**
* Test if the specified property is equal to the specified value.
- *
+ *
* @param key The key of the property to test. Must be not null
!
* @param value The value to compare the property with.
* @return true
if the property is equal to the specified value, false
otherwise.
@@ -125,11 +155,11 @@ public class RSECoreTestCase extends TestCase {
assert key != null;
return (value ? Boolean.TRUE : Boolean.FALSE).equals(Boolean.valueOf(properties.getProperty(key, "false"))); //$NON-NLS-1$
}
-
+
/**
* Sets the specified string value for the specified property. If the specified
* value is null
, the specified property will be removed.
- *
+ *
* @param key The key of the property to set. Must be not null
!
* @param value The string value to set or null
.
*/
@@ -143,15 +173,15 @@ public class RSECoreTestCase extends TestCase {
}
}
}
-
+
/**
* Test if the specified property is equal to the specified value. If the specified
* value is null
, this method returns true
if the specified
* property key does not exist. The comparisation is case insensitive.
- *
+ *
* @param key The key of the property to test. Must be not null
!
* @param value The value to compare the property with or null
- * @return true
if the property is equal to the specified value
+ * @return true
if the property is equal to the specified value
* or the specified value is null
and the property does not exist,
* false
otherwise.
*/
@@ -165,7 +195,7 @@ public class RSECoreTestCase extends TestCase {
/**
* Returns the configured string value of the specified property.
- *
+ *
* @param key The property key. Must be not null
.
* @return The property value or null
if the specified property does not exist.
*/
@@ -173,17 +203,92 @@ public class RSECoreTestCase extends TestCase {
assert key != null;
return properties.getProperty(key, null);
}
-
+
+ /**
+ * Return the fully qualified name of the unit test currently running. Used
+ * for pattern matching against enablement rules. Qualification is
+ * "OS_Name"."OS_Arch"."Testclass"."methodname"."connectiontype" where the
+ * connectiontype may be empty if not specified.
+ *
+ * @return the fully qualified name of the unit test currently running.
+ */
+ protected String getTestNameForCheck() {
+ String testName = getName();
+ String testClass = getClass().getName();
+ String testPackage = getClass().getPackage().getName();
+ String testClassSimpleName = testClass.substring(testPackage.length() + 1);
+ String checkName = testClassSimpleName + '.' + testName;
+ if (targetName != null) {
+ checkName = checkName + '.' + targetName;
+ }
+ if (clientName != null) {
+ checkName = clientName + '.' + checkName;
+ }
+ return checkName;
+ }
+
+ /**
+ * Check whether this test is currently disabled. Uses Introspection and
+ * JUnit Test Name to check against user-specified Properties file. Note
+ * that by default, all tests are enabled.
+ *
+ * @return true if this test should run, false otherwise.
+ */
+ protected boolean isTestDisabled() {
+ String testName = getName();
+ String testClass = getClass().getName();
+ String testPackage = getClass().getPackage().getName();
+ String testClassSimpleName = testClass.substring(testPackage.length() + 1);
+ String checkName = testClassSimpleName + '.' + testName;
+ String checkString = checkName;
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ if (targetName != null) {
+ checkString = "*." + targetName;
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ checkString = checkName + '.' + targetName;
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ if (clientName != null) {
+ checkString = getTestNameForCheck();
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ }
+ }
+ if (clientName != null) {
+ checkString = clientName + ".*";
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ checkString = clientName + '.' + checkName;
+ if (!RSETestsPlugin.isTestCaseEnabled(checkString)) {
+ System.out.println("--> disabled due to rule: " + checkString);
+ return true;
+ }
+ }
+ return false;
+ }
+
// ***** Test case life cycle management and support methods *****
final static QualifiedName BACKGROUND_TEST_EXECUTION_FINISHED = new QualifiedName(RSETestsPlugin.getDefault().getBundle().getSymbolicName(), "background_test_execution_finished"); //$NON-NLS-1$
-
+
private final class RSEBackgroundTestExecutionJob extends Job {
private final TestResult result;
-
+
/**
* Constructor.
- *
+ *
* @param result The test result object the test is reporting failures to. Must be not null
.
*/
public RSEBackgroundTestExecutionJob(TestResult result) {
@@ -191,11 +296,11 @@ public class RSECoreTestCase extends TestCase {
setUser(false);
setPriority(Job.INTERACTIVE);
setRule(ResourcesPlugin.getWorkspace().getRoot());
-
+
assert result != null;
this.result = result;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@@ -206,29 +311,29 @@ public class RSECoreTestCase extends TestCase {
result.addListener(TEST_LISTENER);
invokeTestCaseRunImpl(result);
result.removeListener(TEST_LISTENER);
-
+
monitor.done();
-
+
setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE);
// The job never fails. The test result is the real result.
return Status.OK_STATUS;
- }
+ }
}
-
+
private final static class RSEBackgroundTestExecutionJobWaiter implements IInterruptCondition {
private final Job job;
-
+
/**
* Constructor.
- *
+ *
* @param job The job to wait for the execution to finish. Must be not null
.
*/
public RSEBackgroundTestExecutionJobWaiter(Job job) {
assert job != null;
this.job = job;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#isTrue()
*/
@@ -236,23 +341,23 @@ public class RSECoreTestCase extends TestCase {
// Interrupt the wait method if the job signaled that it has finished.
return ((Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#dispose()
*/
public void dispose() { /* nothing to dispose here */ }
}
-
+
/**
* Internal accessor method to call the original junit.
* framework.TestCase.run(TestResult) implementation.
- *
+ *
* @param result The test result object the test is reporting failures to. Must be not null
.
*/
final void invokeTestCaseRunImpl(TestResult result) {
super.run(result);
}
-
+
/* (non-Javadoc)
* @see junit.framework.TestCase#run(junit.framework.TestResult)
*/
@@ -271,7 +376,7 @@ public class RSECoreTestCase extends TestCase {
job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE);
// schedule the job to run immediatelly
job.schedule();
-
+
// wait till the job finished executing
RSEWaitAndDispatchUtil.waitAndDispatch(0, new RSEBackgroundTestExecutionJobWaiter(job));
}
@@ -322,7 +427,7 @@ public class RSECoreTestCase extends TestCase {
/**
* Print the start date and time of the specified test to stdout.
- *
+ *
* @param name The name of the starting test. Must be not null
!
* @return The start time of the test in milliseconds.
*/
@@ -334,10 +439,10 @@ public class RSECoreTestCase extends TestCase {
}
return startTime;
}
-
+
/**
* Print the end date and time as well as the delay of the specified test to stdout.
- *
+ *
* @param name The name of the finished test. Must be not null
!
* @param startTime The start time of the test in milliseconds.
*/
@@ -349,7 +454,7 @@ public class RSECoreTestCase extends TestCase {
System.out.println("=== " + name + " finished at: " + DATE_FORMAT.format(new Date(endTime)) + " (duration: " + duration + " ms)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
}
-
+
/**
* Wait until the SystemProfileManager has finished loading all "autoload" profiles,
* and the RSEUIPlugin InitRSEJob has finished filling it with the default connections.
@@ -387,14 +492,14 @@ public class RSECoreTestCase extends TestCase {
waitForRSEWorkspaceInit();
switchMaximizeSystemsView();
}
-
+
/**
* Flush the event queue in order to ensure that no left-over events influence later test cases.
*
* Unhandled exceptions in the event loop event are caught as follows:
* In case multiple events from the event loop throw exceptions these are printed
* to stdout. The first exception found in the event loop is thrown to the caller.
- *
+ *
* @throws Exception in case an unhandled event loop exception was found.
*/
protected void flushEventQueue() throws Exception {
@@ -448,8 +553,8 @@ public class RSECoreTestCase extends TestCase {
flushEventQueue();
super.tearDown();
}
-
- // ***** View and perspective management and support methods *****
+
+ // ***** View and perspective management and support methods *****
/**
* Bring the RSE SystemsView to front, and toggle its "maximized" state based on what
@@ -461,14 +566,14 @@ public class RSECoreTestCase extends TestCase {
protected void switchMaximizeSystemsView() {
final String perspectiveId = getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE);
assertNotNull("Invalid null-value for test case perspective id!", perspectiveId); //$NON-NLS-1$
-
+
// all view management must happen in the UI thread!
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() {
// in case the test case is launched within a new workspace, the eclipse intro
// view is hiding everything else. Find the intro page and hide it.
hideView("org.eclipse.ui.internal.introview", perspectiveId); //$NON-NLS-1$
-
+
// toggle the Remote Systems View zoom state.
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
IViewPart part = showView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, perspectiveId);
@@ -487,17 +592,17 @@ public class RSECoreTestCase extends TestCase {
}
}
});
-
+
// Give the UI a chance to repaint if the view zoom state changed
if (isProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true)) {
System.err.println("Waiting for UI to repaint"); //$NON-NLS-1$
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
}
}
-
+
/**
* Restore the RSE SystemsView to its previous state, in case the view state
- * has been changed by {@link #switchMaximizeSystemsView()}.
+ * has been changed by {@link #switchMaximizeSystemsView()}.
*/
protected void restoreMaximizeSystemsView() {
// restore the original view zoom state
@@ -522,10 +627,10 @@ public class RSECoreTestCase extends TestCase {
});
}
}
-
+
/**
* Finds the view reference for the view identified by the specified id.
- *
+ *
* @param viewId The unique view id. Must be not null
.
* @param perspectiveId The unique perspective id within the view should be searched. Must be not null
.
* @return The view reference instance to the view or null
if not available.
@@ -533,32 +638,32 @@ public class RSECoreTestCase extends TestCase {
public final IViewReference findView(String viewId, String perspectiveId) {
assert viewId != null && perspectiveId != null;
if (viewId == null || perspectiveId == null) return null;
-
+
// First of all, we have to lookup the currently active workbench
- // of the currently active workbench window.
+ // of the currently active workbench window.
IWorkbench workbench = PlatformUI.getWorkbench();
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
// and the corresponding currently active workbench window.
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
-
+
// Now we have to switch to the specified perspecitve
try {
workbench.showPerspective(perspectiveId, window);
} catch (WorkbenchException e) {
SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
// From the active workbench window, we need the active workbench page
IWorkbenchPage page = window.getActivePage();
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
-
+
return page.findViewReference(viewId);
}
/**
* Shows and activate the view identified by the specified id.
- *
+ *
* @param viewId The unique view id. Must be not null
.
* @param perspectiveId The unique perspective id within the view should be activated. Must be not null
.
* @return The view part instance to the view or null
if it cannot be shown.
@@ -566,46 +671,46 @@ public class RSECoreTestCase extends TestCase {
public final IViewPart showView(String viewId, String perspectiveId) {
assert viewId != null && perspectiveId != null;
if (viewId == null || perspectiveId == null) return null;
-
+
// First of all, we have to lookup the currently active workbench
- // of the currently active workbench window.
+ // of the currently active workbench window.
IWorkbench workbench = PlatformUI.getWorkbench();
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
// and the corresponding currently active workbench window.
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
-
+
// Now we have to switch to the specified perspecitve
try {
workbench.showPerspective(perspectiveId, window);
} catch (WorkbenchException e) {
SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
// From the active workbench window, we need the active workbench page
IWorkbenchPage page = window.getActivePage();
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
-
+
IViewPart part = null;
try {
part = page.showView(viewId);
} catch (PartInitException e) {
SystemBasePlugin.logError("Failed to show view (id = " + viewId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
return part;
}
/**
* Hides the view identified by the specified id.
- *
+ *
* @param viewId The unique view id. Must be not null
.
* @param perspectiveId The unique perspective id the view should be hidden from. Must be not null
.
*/
public final void hideView(String viewId, String perspectiveId) {
assert viewId != null && perspectiveId != null;
if (viewId == null || perspectiveId == null) return;
-
+
IViewReference viewReference = findView(viewId, perspectiveId);
if (viewReference != null) {
// at this point we can safely asume that we can access the active page directly
@@ -616,7 +721,7 @@ public class RSECoreTestCase extends TestCase {
}
// ***** Test data management and support methods *****
-
+
/**
* Returns the absolute test data location path calculated out of the known
* test data location root (org.eclipse.rse.tests plugin location + sub
@@ -630,16 +735,16 @@ public class RSECoreTestCase extends TestCase {
*
* If the calculated test data location does not pass these conditions, the
* method will return null
.
- *
+ *
* @param relativePath A path relative to the test data location root path. Must be not null
True
if to append the current execution host operating system string, false
otherwise.
- *
+ *
* @return The root path to the test data location or null
if the test data location does cannot be read or is not a directory.
*/
protected final IPath getTestDataLocation(String relativePath, boolean appendHostOS) {
assert relativePath != null;
IPath root = null;
-
+
if (relativePath != null) {
Bundle bundle = RSETestsPlugin.getDefault().getBundle();
if (bundle != null) {
@@ -660,14 +765,14 @@ public class RSECoreTestCase extends TestCase {
}
}
}
-
+
return root;
}
// ***** Test failures log collector management and support methods *****
-
+
final TestListener TEST_LISTENER = new RSETestFailureListener();
-
+
/**
* Listens to the test executions and collect the test log files
* through the known list of test log collector delegates in a test
@@ -681,7 +786,7 @@ public class RSECoreTestCase extends TestCase {
public void startTest(Test test) {
// nothing to do on start test
}
-
+
/* (non-Javadoc)
* @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
*/
@@ -695,7 +800,7 @@ public class RSECoreTestCase extends TestCase {
error
);
RSETestsPlugin.getDefault().getLog().log(status);
-
+
// Collect the log files if at least one test log collector is known
collectTestLogs(test);
}
@@ -714,7 +819,7 @@ public class RSECoreTestCase extends TestCase {
failure
);
RSETestsPlugin.getDefault().getLog().log(status);
-
+
// Collect the log files if at least one test log collector is known
collectTestLogs(test);
}
@@ -727,10 +832,10 @@ public class RSECoreTestCase extends TestCase {
// nothing to do on end test
}
}
-
+
/**
* Collect the test logs for the failed test.
- *
+ *
* @param test The failed test. Must be not null
.
*/
protected final synchronized void collectTestLogs(Test test) {
@@ -754,11 +859,11 @@ public class RSECoreTestCase extends TestCase {
if (archivePath.toFile().createNewFile()) {
stream = new ZipOutputStream(new FileOutputStream(archivePath.toFile()));
stream.setLevel(9);
-
+
// cache the names of the entries added to the ZIP stream.
// They needs to be unique!
Set nameCache = new HashSet();
-
+
// call each test log collector delegate for the absolute file names
// and add each of the returned files to the ZIP archive.
for (int i = 0; i < delegates.length; i++) {
@@ -783,7 +888,7 @@ public class RSECoreTestCase extends TestCase {
unifier = location.removeLastSegments(1);
entryName = unifier.lastSegment() + "_" + entryName; //$NON-NLS-1$
}
-
+
// if the name is still not unique, append a count to it
long count = 0;
// force to make a copy of the current name
@@ -795,11 +900,11 @@ public class RSECoreTestCase extends TestCase {
} else {
nameCache.add(entryName);
}
-
+
ZipEntry zipEntry = new ZipEntry(entryName);
zipEntry.setTime(file.lastModified());
stream.putNextEntry(zipEntry);
-
+
// Read the file bytewise and write it bytewise to the ZIP
BufferedInputStream fileStream = null;
try {
@@ -820,13 +925,13 @@ public class RSECoreTestCase extends TestCase {
}
}
}
-
+
// If done with the current test log collector delegate, signal the delegate to dispose himself.
// This gives the delegate the chance to remove any possibly created temporary file.
delegate.dispose();
}
}
- } catch(IOException e) {
+ } catch(IOException e) {
/* ignored on purpose */
} finally {
// always close the stream if open
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java
index 485f2545385..ff8bdc81850 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java
@@ -1,15 +1,15 @@
/*******************************************************************************
* Copyright (c) 2007, 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:
* Uwe Stieber (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
- * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
+ * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
*******************************************************************************/
package org.eclipse.rse.tests.core.registries;
@@ -23,16 +23,18 @@ import org.eclipse.rse.tests.core.RSECoreTestCase;
/**
* Tests the subsystem configuration proxy functionality.
- *
+ *
* @author uwe.stieber@windriver.com
*/
public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
-
+
public void testSubSystemConfigurationProxy() {
//-test-author-:UweStieber
+ if (isTestDisabled())
+ return;
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
assertNotNull("Failed to fetch RSE system registry instance!", systemRegistry); //$NON-NLS-1$
-
+
// get all subsystem configuration proxies and pick out the ones from our
// tests plugin.
ISubSystemConfigurationProxy[] proxies = systemRegistry.getSubSystemConfigurationProxies();
@@ -44,7 +46,7 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
assertEquals("Proxy object changed hash code between two calls!", proxy.hashCode(), proxy.hashCode()); //$NON-NLS-1$
assertFalse("Unexpected return value true for proxy.equals(null)!", proxy.equals(null)); //$NON-NLS-1$
assertTrue("Unexpected return value false for proxy.equals(proxy)!", proxy.equals(proxy)); //$NON-NLS-1$
-
+
// a few specific value we test only for one well known test subsystem
if ("org.eclipse.rse.tests.subsystems.TestSubSystem".equals(proxy.getId())) { //$NON-NLS-1$
assertEquals("Unexpected return value for proxy.getDescription()!", "Test Subsystem", proxy.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -55,7 +57,7 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
assertEquals("Unexpected return value for proxy.getPriority()!", 50000, proxy.getPriority()); //$NON-NLS-1$
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$
-
+
// walk through all known system types. Only "Local" and "Windows" should match!
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
@@ -79,7 +81,7 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
assertEquals("Unexpected return value for proxy.getPriority()!", 100000, proxy.getPriority()); //$NON-NLS-1$
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$
-
+
// walk through all known system types. All system types declared by the tests plugin are expected to match
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
@@ -103,7 +105,7 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
assertEquals("Unexpected return value for proxy.getPriority()!", 2000, proxy.getPriority()); //$NON-NLS-1$
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
assertNotNull("Unexpected return value null for proxy.getSubSystemConfiguration()!", proxy.getSubSystemConfiguration()); //$NON-NLS-1$
-
+
// walk through all known system types. Only "Unix" and "Linux" should match!
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java
index fb5bdd349d6..19d258c5747 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemInterfacesTest.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* 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 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:
* David Dykstal (IBM) - initial implementation
*******************************************************************************/
package org.eclipse.rse.tests.core.registries;
@@ -23,14 +23,14 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem;
import org.eclipse.rse.tests.core.RSECoreTestCase;
/**
- * Tests the subsystem configuration proxy functionality.
- *
- * @author uwe.stieber@windriver.com
+ * Tests the subsystem interfaces.
*/
public class SubSystemInterfacesTest extends RSECoreTestCase {
-
+
public void testSubSystemFinding() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
assertNotNull("system registry not found", registry); //$NON-NLS-1$
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java
index 4f453e6c18d..e3fe516e1fb 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/initialization/InitializationTest.java
@@ -18,16 +18,17 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.rse.core.IRSEInitListener;
import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.tests.RSETestsPlugin;
/**
* Should be run on a clean workspace.
*/
public class InitializationTest extends TestCase {
-
+
public InitializationTest(String name) {
super(name);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
*/
@@ -39,16 +40,17 @@ public class InitializationTest extends TestCase {
}
});
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/
protected void tearDown() throws Exception {
super.tearDown();
}
-
+
public void testInitialization() {
//-test-author-:DavidDykstal
+ if (!RSETestsPlugin.isTestCaseEnabled("InitializationTest.testInitialization"))return; //$NON-NLS-1$
try {
IStatus status = null;
status = RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
@@ -78,5 +80,5 @@ public class InitializationTest extends TestCase {
assertFalse("listener saw phase INIT_MODEL", listener.sawPhase(RSECorePlugin.INIT_MODEL)); // shouldn't see this since it occurs before the listener is added
assertTrue("listener missed phase INIT_ALL", listener.sawPhase(RSECorePlugin.INIT_ALL));
}
-
+
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java
index 377a2d9ff29..1e90715b331 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java
@@ -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:
* Uwe Stieber (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
@@ -24,7 +24,6 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.tests.RSETestsPlugin;
import org.eclipse.rse.tests.core.IRSECoreTestCaseProperties;
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition;
@@ -43,8 +42,9 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
*/
public void testCoreTestPropertiesHandling() {
//-test-author-:UweStieber
- if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testCoreTestPropertiesHandling")) return; //$NON-NLS-1$
-
+ if (isTestDisabled())
+ return;
+
// test for our defaults
assertTrue("Unexpected default for property PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW!", isProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, false)); //$NON-NLS-1$
assertEquals("Unexpected default for property PROP_SWITCH_TO_PERSPECTIVE!", "org.eclipse.rse.ui.view.SystemPerspective", getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -79,7 +79,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
public boolean isTrue() { return params.size() > 0; }
public void dispose() { params.clear(); }
}
-
+
private static class TestJob extends Job {
final List params;
public TestJob(List params) {
@@ -87,7 +87,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
assert params != null;
this.params = params;
}
-
+
protected IStatus run(IProgressMonitor monitor) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
@@ -97,24 +97,25 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
return Status.OK_STATUS;
}
}
-
+
/**
* Test the RSEWaitAndDispatchUtil
wait methods.
*/
public void testWaitAndDispatch() {
//-test-author-:UweStieber
- if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testWaitAndDispatch")) return; //$NON-NLS-1$
-
+ if (isTestDisabled())
+ return;
+
// the simple wait and dispatch is time out based
long start = System.currentTimeMillis();
RSEWaitAndDispatchUtil.waitAndDispatch(2500);
long end = System.currentTimeMillis();
assertTrue("Failed to wait a given timeout!", (end - start) >= 2500); //$NON-NLS-1$
-
+
// the more complex wait and dispatch method has to stop
// on a given condition.
final List params = new ArrayList();
-
+
// the trick here is to make the condition true only if a
// runnable passed through the display thread. That should
// give us the asurance that the display event dispatching
@@ -125,55 +126,57 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
job.setPriority(Job.SHORT);
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule(3000);
-
+
boolean timeout = RSEWaitAndDispatchUtil.waitAndDispatch(10000, new TestWaiter(params));
assertFalse("Interrupt condition failed to stop wait method!", timeout); //$NON-NLS-1$
assertEquals("Interrupt condition failed to dispose!", 0, params.size()); //$NON-NLS-1$
}
-
+
/**
* Test accessing the test data location.
*/
public void testTestDataLocationManagement() {
//-test-author-:UweStieber
- if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testTestDataLocationManagement")) return; //$NON-NLS-1$
-
+ if (isTestDisabled())
+ return;
+
// get the pure test data location root path.
IPath root = getTestDataLocation("", false); //$NON-NLS-1$
assertNotNull("Failed to query test data location root!", root); //$NON-NLS-1$
assertTrue("Test data root location " + root.toOSString() + " is not a directory!", root.toFile().isDirectory()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Test data root location " + root.toOSString() + " cannot be read!", root.toFile().canRead()); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// get a test data location path under the root
String relative = "unittest_" + System.currentTimeMillis(); //$NON-NLS-1$
// as the directories should not exist yet, a call to getTestDataLocation must return null
IPath path = getTestDataLocation(relative, false);
assertNull("Test data location exist but should not!", path); //$NON-NLS-1$
-
+
// go and create the path now (including the OS)
String os = Platform.getOS();
assertNotNull("Failed to query current execution host operating system string!", os); //$NON-NLS-1$
path = root.append(relative + "/" + os); //$NON-NLS-1$
assertTrue("Failed to create test data location directories. Permission problem?", path.toFile().mkdirs()); //$NON-NLS-1$
-
+
// Now, the re-query must be successful.
IPath path2 = getTestDataLocation(relative, false);
assertNotNull("Test data location " + root.append(relative).toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
path2 = getTestDataLocation(relative, true);
assertNotNull("Test data location " + path.toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Delete the created pathes again
assertTrue("Failed to delete test data location " + path.toOSString() + "!", path.toFile().delete()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue("Failed to delete test data location " + root.append(relative).toOSString() + "!", root.append(relative).toFile().delete()); //$NON-NLS-1$ //$NON-NLS-2$
}
-
+
/**
* Test RSE connection manager and related functionality.
*/
public void testConnectionManager() {
//-test-author-:UweStieber
- if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testConnectionManager")) return; //$NON-NLS-1$
-
+ if (isTestDisabled())
+ return;
+
// get the pure test data location root path.
IPath location = getTestDataLocation("testConnectionManager", false); //$NON-NLS-1$
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
@@ -181,17 +184,17 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
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 test connection properties from the data file.
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, true);
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
assertEquals("Property name does not match!", "test_windows", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property profile name does not match!", "junit_test_profile", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_WINDOWS_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_WINDOWS_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$
assertEquals("Property remote system address does not match!", "128.0.0.1", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property user id does not match!", "test_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property password does not match!", "test_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// test the loading with partial connection information (with defauls)
Properties props = new Properties();
props.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID);
@@ -201,7 +204,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
assertEquals("Property name does not match!", "Local", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$
assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$
- assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$
assertEquals("Property remote system address does not match!", "localhost", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -211,7 +214,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
assertNull("Property name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$
assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$
- assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$
assertNull("Property remote system address does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$
assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java
index 4d3c0663c2f..b3c44217ff6 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java
@@ -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:
* Uwe Stieber (Wind River) - initial API and implementation
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
*******************************************************************************/
@@ -28,21 +28,22 @@ public class RSETestsPluginTestCase extends RSECoreTestCase {
*/
public void testPluginResourceBundle() {
//-test-author-:UweStieber
- if (!RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")) return; //$NON-NLS-1$
-
+ if (isTestDisabled())
+ return;
+
ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle();
assertNotNull("No resource bundle associated with RSETestsPlugin!", bundle); //$NON-NLS-1$
-
+
// our own test id must be true here, otherwise we wouldn't had
// reached this point anyway.
assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$
// a test id not listed within the resources file must be always true
assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testNeverAddThisToTheResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// this test id should be never enabled
assertFalse("Unexpected return value true!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.dontRemove.testNeverEnabledThis")); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Test the different getResourceString methods.
String expected = "testResolveString"; //$NON-NLS-1$
assertEquals("Unexpected return value!", expected, RSETestsPlugin.getResourceString("RSETestsPluginTestCase.dontRemove.testResolveString")); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java
index 0d0f0cc32b0..e76a56d7c61 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/ExportImportTest.java
@@ -1,13 +1,14 @@
/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. 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
- * 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:
* David Dykstal (IBM) - initial contribution.
* David Dykstal (IBM) - [189274] provide import and export operations for profiles
* David Dykstal (IBM) - [232126] add test for filter type persistence
+ * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
*********************************************************************************/
package org.eclipse.rse.tests.persistence;
@@ -35,10 +36,10 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.tests.core.RSECoreTestCase;
/**
- *
+ *
*/
public class ExportImportTest extends RSECoreTestCase {
-
+
ISystemProfile sourceProfile = null;
ISystemRegistry registry = null;
IRSEPersistenceManager manager = null;
@@ -47,7 +48,7 @@ public class ExportImportTest extends RSECoreTestCase {
public ExportImportTest(String name) {
super(name);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
*/
@@ -82,7 +83,7 @@ public class ExportImportTest extends RSECoreTestCase {
ISystemFilter sharedFilter = sharedFilterPool.createSystemFilter("sharedFilter", filterStrings);
sharedFilter.setType("sharedFilterType");
}
-
+
/* (non-Javadoc)
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
*/
@@ -95,6 +96,8 @@ public class ExportImportTest extends RSECoreTestCase {
*/
public void testFilterPool1() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
// find the provider
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
@@ -105,7 +108,7 @@ public class ExportImportTest extends RSECoreTestCase {
RSEEnvelope envelope = new RSEEnvelope();
envelope.add(fp);
IProgressMonitor monitor = new NullProgressMonitor();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
envelope.put(out, persistenceProvider, monitor);
// create an empty profile
ISystemProfile targetProfile = registry.createSystemProfile("profileFilterPool1", true);
@@ -143,6 +146,8 @@ public class ExportImportTest extends RSECoreTestCase {
*/
public void testHost1() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
// find the provider
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
@@ -153,7 +158,7 @@ public class ExportImportTest extends RSECoreTestCase {
RSEEnvelope envelope = new RSEEnvelope();
envelope.add(host1);
IProgressMonitor monitor = new NullProgressMonitor();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
envelope.put(out, persistenceProvider, monitor);
// import from the newly created stream
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
@@ -189,6 +194,8 @@ public class ExportImportTest extends RSECoreTestCase {
public void testPropertySet() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
}
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java
index 7b61e7c41b2..853f62af439 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/MigrationTest.java
@@ -1,11 +1,12 @@
/*********************************************************************************
- * Copyright (c) 2008 IBM Corporation. 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
- * 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:
* David Dykstal (IBM) - initial contribution.
+ * Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
*********************************************************************************/
package org.eclipse.rse.tests.persistence;
@@ -13,7 +14,7 @@ package org.eclipse.rse.tests.persistence;
import org.eclipse.rse.tests.core.RSECoreTestCase;
/**
- *
+ *
*/
public class MigrationTest extends RSECoreTestCase {
@@ -23,6 +24,8 @@ public class MigrationTest extends RSECoreTestCase {
public void testProfileMigration() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
// create a new profile
// set its persistence manager to PM1
// populate the profile
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java
index 5749be3397f..6e69611f600 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java
@@ -35,32 +35,34 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
/**
* Tests for {@link SystemPreferencesManager}.
- * Since these are persistence tests they will play with the creation and deletion of
+ * Since these are persistence tests they will play with the creation and deletion of
* profiles, hosts, filters, and other model objects. You should run this only in a
* clean workspace.
*/
public class PersistenceTest extends RSECoreTestCase {
-
+
public PersistenceTest(String name) {
super(name);
}
-
+
/* (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 testPersistenceManagerStartup() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
IRSEPersistenceManager m = RSECorePlugin.getThePersistenceManager();
for (int i = 0; i < 5; i++) {
if (m.isRestoreComplete()) break;
@@ -72,15 +74,17 @@ public class PersistenceTest extends RSECoreTestCase {
}
assertTrue("Restore not complete", m.isRestoreComplete());
}
-
+
public void testProfilePersistence() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
/*
* Set up this particular test.
*/
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
int n = registry.getSystemProfileManager().getSystemProfiles().length;
-
+
/*
* Create a new profile in this profile manager. This will be the second
* profile created. Creating a profile causes a commit.
@@ -94,15 +98,15 @@ public class PersistenceTest extends RSECoreTestCase {
} catch (Exception e) {
throw new RuntimeException(e);
}
-
+
// reload(); // reload not yet working
-
+
/*
* There should be one more profile
*/
ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles();
assertEquals(n, profiles.length);
-
+
/*
* One should be default private profile
*/
@@ -112,7 +116,7 @@ public class PersistenceTest extends RSECoreTestCase {
found = p.isDefaultPrivate();
}
assertTrue("Default private profile not found", found);
-
+
/*
* One should be the test profile
*/
@@ -122,7 +126,7 @@ public class PersistenceTest extends RSECoreTestCase {
found = p.getName().equals("bogus");
}
assertTrue("bogus profile not found", found);
-
+
/*
* Get the test profile and check its properties.
*/
@@ -133,7 +137,7 @@ public class PersistenceTest extends RSECoreTestCase {
IPropertySet[] pSets = bogus.getPropertySets();
assertNotNull(pSets);
assertEquals(0, pSets.length);
-
+
/*
* Add a property set to the profile.
*/
@@ -141,20 +145,20 @@ public class PersistenceTest extends RSECoreTestCase {
bogusProperties.addProperty("bp1", "1");
bogusProperties.addProperty("bp2", "2");
bogus.addPropertySet(bogusProperties);
-
+
// nested property set
IPropertySet bogusNestedProperties = new PropertySet("bogus_nested_properties");
bogusNestedProperties.addProperty("bnpa", "a");
bogusNestedProperties.addProperty("bnpb", "b");
bogusProperties.addPropertySet(bogusNestedProperties);
-
+
bogus.commit();
-
+
/*
* Refresh the profile manager.
*/
// reload(); // reload not yet working
-
+
/*
* Check to see if everything is still OK and that the properties are restored.
*/
@@ -169,29 +173,31 @@ public class PersistenceTest extends RSECoreTestCase {
assertNotNull(bogusProperties);
assertEquals("1", bogusProperties.getProperty("bp1").getValue());
assertEquals("2", bogusProperties.getProperty("bp2").getValue());
-
+
bogusNestedProperties = bogusProperties.getPropertySet("bogus_nested_properties");
assertNotNull(bogusNestedProperties);
assertEquals("a", bogusNestedProperties.getProperty("bnpa").getValue());
- assertEquals("b", bogusNestedProperties.getProperty("bnpb").getValue());
-
+ assertEquals("b", bogusNestedProperties.getProperty("bnpb").getValue());
+
try {
registry.deleteSystemProfile(bogus);
} catch (Exception e) {
throw new RuntimeException(e);
}
-
+
// reload(); // reload not yet working
-
+
}
public void testHostPersistence() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
/*
* Set up this particular test.
*/
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
-
+
/*
* Create a new profile in this profile manager. This will be the third
* profile created. Creating a profile causes a commit.
@@ -203,7 +209,7 @@ public class PersistenceTest extends RSECoreTestCase {
}
ISystemProfile profile = registry.getSystemProfile("bogus");
assertNotNull(profile);
-
+
try {
IRSESystemType linuxType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LINUX_ID);
registry.createHost("bogus", linuxType, "myhost", "myhost.mynet.mycompany.net", null);
@@ -218,9 +224,9 @@ public class PersistenceTest extends RSECoreTestCase {
props.addProperty("bp2", "2");
host.addPropertySet(props);
host.commit();
-
+
// reload(); // reload not yet working
-
+
/*
* Get the test profile and check its properties.
*/
@@ -232,12 +238,12 @@ public class PersistenceTest extends RSECoreTestCase {
assertNotNull(props);
assertEquals("1", props.getProperty("bp1").getValue());
assertEquals("2", props.getProperty("bp2").getValue());
-
+
}
private void reload() {
/*
- * Set up this particular test. The persistence manager acts as the family for all
+ * Set up this particular test. The persistence manager acts as the family for all
* Jobs that are created for reading and writing the persistent form of the model.
*/
IRSEPersistenceManager persistenceManager = RSECorePlugin.getThePersistenceManager();
@@ -253,12 +259,12 @@ public class PersistenceTest extends RSECoreTestCase {
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
-
+
/*
* restore the profile manager
*/
RSEUIPlugin.getDefault().restart();
}
-
+
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
index 612bb99f99d..fba94006742 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
@@ -1,7 +1,7 @@
/*******************************************************************************
* Copyright (c) 2006, 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:
@@ -28,23 +28,25 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
* Tests for {@link SystemPreferencesManager}.
*/
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 testActiveProfiles() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
RSEPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
RSEPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
String[] profiles = RSEPreferencesManager.getActiveProfiles();
@@ -60,17 +62,21 @@ public class PreferencesTest extends RSECoreTestCase {
assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus01")); //$NON-NLS-1$
assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus99")); //$NON-NLS-1$
}
-
+
public void testUserIds() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
RSEPreferencesManager.setUserId("a.b.c", "bogusUser"); //$NON-NLS-1$ //$NON-NLS-2$
assertEquals("bogusUser", RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ //$NON-NLS-2$
RSEPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$
assertNull(RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$
}
-
+
public void testDefaultUserIds() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry();
//TODO should we test deprecated methods as well? Probably yes...
IRSESystemType systemTypeDeprecated = registry.getSystemType("Local"); //$NON-NLS-1$
@@ -80,15 +86,17 @@ public class PreferencesTest extends RSECoreTestCase {
RSEPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$
assertEquals("bogus1", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
IRSESystemType localType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID);
- RSEPreferencesManager.setDefaultUserId(localType, "bogus2"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEPreferencesManager.setDefaultUserId(localType, "bogus2"); //$NON-NLS-1$
assertEquals("bogus2", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
RSEPreferencesManager.setDefaultUserId(systemType, oldValue);
assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType));
}
-
+
public void testShowLocalConnection() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
assertTrue(SystemPreferencesManager.getShowLocalConnection());
}
-
+
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java
index 653feefcf64..ab4c0c3758d 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/profiles/ProfileTest.java
@@ -23,36 +23,38 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
/**
* Tests for {@link SystemPreferencesManager}.
- * Since these are persistence tests they will play with the creation and deletion of
+ * Since these are persistence tests they will play with the creation and deletion of
* profiles, hosts, filters, and other model objects. You should run this only in a
* clean workspace.
*/
public class ProfileTest extends RSECoreTestCase {
-
+
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
ISystemProfileManager manager = registry.getSystemProfileManager();
ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
-
+
public ProfileTest(String name) {
super(name);
}
-
+
/* (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 testDefaultProfileMarking() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
assertNotNull("default profile is null", defaultProfile);
assertTrue("default profile is not active - 1", defaultProfile.isActive());
assertTrue("default profile is not marked as default", defaultProfile.isDefaultPrivate());
@@ -60,6 +62,8 @@ public class ProfileTest extends RSECoreTestCase {
public void testDefaultProfileActivation() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
registry.setSystemProfileActive(defaultProfile, true);
assertTrue("default profile is not active - 2", defaultProfile.isActive());
registry.setSystemProfileActive(defaultProfile, false); // this should be ignored
@@ -68,6 +72,8 @@ public class ProfileTest extends RSECoreTestCase {
public void testDefaultProfileRename() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
ISystemProfile profile = registry.getSystemProfile("bogus");
assertNull(profile);
@@ -89,6 +95,8 @@ public class ProfileTest extends RSECoreTestCase {
public void testProfileActivation() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
ISystemProfile profile = registry.getSystemProfile("bogus");
assertNull(profile);
@@ -107,6 +115,8 @@ public class ProfileTest extends RSECoreTestCase {
public void testDefaultProfileDeletion() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
registry.deleteSystemProfile(defaultProfile); // this should be ignored
List profiles = Arrays.asList(manager.getSystemProfiles());
@@ -116,9 +126,11 @@ public class ProfileTest extends RSECoreTestCase {
throw new RuntimeException(e);
}
}
-
+
public void testProfileDeletion() {
//-test-author-:DavidDykstal
+ if (isTestDisabled())
+ return;
try {
ISystemProfile profile = registry.getSystemProfile("bogus");
assertNull(profile);
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java
index fd29720b24f..4a35cf48e95 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/subsystems/files/CreateFileTestCase.java
@@ -1,13 +1,13 @@
/********************************************************************************
* 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
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
* Initial Contributors:
* The following IBM employees contributed to the Remote System Explorer
* component that contains this file: Kevin Doyle.
- *
+ *
* Contributors:
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
@@ -46,50 +46,53 @@ public class CreateFileTestCase extends FileServiceBaseTest {
private IRemoteFileSubSystem getRemoteFileSubSystem(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