diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs
index bf0d29c9d42..3606a63265d 100644
--- a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,8 +1,8 @@
-#Tue Nov 28 18:18:22 CET 2006
+#Tue Dec 05 13:08:02 CST 2006
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4
org.eclipse.jdt.core.compiler.compliance=1.4
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.4
diff --git a/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..5f7e8abd767
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,3 @@
+#Tue Dec 05 13:08:02 CST 2006
+eclipse.preferences.version=1
+internal.default.compliance=user
diff --git a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF b/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF
index 9875f4f3140..df5336d80e9 100644
--- a/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF
+++ b/rse/tests/org.eclipse.rse.tests/META-INF/MANIFEST.MF
@@ -1,18 +1,18 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: RSE Core Tests
-Bundle-SymbolicName: org.eclipse.rse.tests.core;singleton:=true
+Bundle-SymbolicName: org.eclipse.rse.tests;singleton:=true
Bundle-Version: 1.0.1.qualifier
-Bundle-Activator: org.eclipse.rse.tests.systems.core.SystemTestPlugin
+Bundle-Activator: org.eclipse.rse.tests.RSETestsPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
Require-Bundle: org.junit,
org.eclipse.core.runtime,
+ org.eclipse.core.resources,
org.eclipse.ui,
org.eclipse.rse.core,
org.eclipse.rse.ui,
org.eclipse.rse.subsystems.files.core,
- org.eclipse.rse.subsystems.shells.core,
- org.eclipse.rse.tests.framework
+ org.eclipse.rse.subsystems.shells.core
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/rse/tests/org.eclipse.rse.tests/plugin.properties b/rse/tests/org.eclipse.rse.tests/plugin.properties
new file mode 100644
index 00000000000..669c8c761ff
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/plugin.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2001, 2004 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+#
+# Externalized MANIFEST.MF and plugin.xml strings
+#
+plugin.vendor=Eclipse.org
+plugin.name=RSE Core Tests
diff --git a/rse/tests/org.eclipse.rse.tests/plugin.xml b/rse/tests/org.eclipse.rse.tests/plugin.xml
index b622091eb2a..4d8a6316736 100644
--- a/rse/tests/org.eclipse.rse.tests/plugin.xml
+++ b/rse/tests/org.eclipse.rse.tests/plugin.xml
@@ -1,19 +1,4 @@
-
-
-
Note: Use only junit.textui.TestRunner
here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ *
+ * @param args The standard Java application command line parameters passed in. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + /** + * Combine all test into a suite and returns the test suite instance. + *
+ * Note: This method must be always called suite
! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!
+ *
+ * @return The test suite instance.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("RSE Combined Test Suite"); //$NON-NLS-1$
+
+ // add the single test suites to the overall one here.
+ suite.addTest(RSEInternalFrameworkTestSuite.suite());
+ suite.addTest(RSEConnectionTestSuite.suite());
+ suite.addTest(RSEPersistenceTestSuite.suite());
+
+ return suite;
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java
new file mode 100644
index 00000000000..d000d74619e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsPlugin.java
@@ -0,0 +1,150 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * Don Yantzi (IBM) - initial contribution.
+ * David Dykstal (IBM) - initial contribution.
+ * Uwe Stieber (Wind River) - restructuring and cleanup
+ * *******************************************************************************/
+package org.eclipse.rse.tests;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Main plugin class for the RSE JUnit tests framework. This
+ * class provides basic infra structure for accessing externalized
+ * string data.
+ */
+public class RSETestsPlugin extends AbstractUIPlugin {
+ // The shared plugin instance.
+ private static RSETestsPlugin plugin;
+ // The resource bundle associated with this plugin.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * Constructor.
+ */
+ public RSETestsPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * Returns the shared plugin instance.
+ *
+ * @return The plugin instance or null
if not yet constructed.
+ */
+ public static RSETestsPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the associated resource bundle. If necessary, the resource
+ * bundle will be initialized.
+ *
+ * @return The resource bundle instance.
+ */
+ public ResourceBundle getResourceBundle() {
+ // If the resource bundle got created already, return the
+ // existing instance.
+ if (resourceBundle != null) return resourceBundle;
+
+ // The resource bundle had not been created yet -> create it.
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.rse.tests.RSETestsResources"); //$NON-NLS-1$
+ return resourceBundle;
+ }
+
+ /**
+ * Queries the externalized string for the specified resource key from
+ * the plugins associated resource bundle.
+ *
+ * @param key The resource key. Must be not null
!
+ * @return The externalized string or the resource key enclosed in exlamation marks.
+ */
+ public static String getResourceString(String key) {
+ assert key != null;
+
+ // Query the resource bundle from the plugin instance.
+ ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle();
+ if (bundle != null) {
+ try {
+ // Lookup the key and return the corresponding string if found.
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ // return the key as is enclosed in exlamation marks.
+ }
+ }
+
+ // If we could not found the key or the bundle is invalid,
+ // return the key as is enclosed in exlamation marks.
+ return '!' + key + '!';
+ }
+
+ /**
+ * Queries the externalized string for the specified resource key from
+ * the plugins associated resource bundle. If a externalized resource
+ * for the specified key exist, a possible argument placeholder will be
+ * replaced by the specified value.
+ *
+ * @param key The resource key. Must be not null
!
+ * @param argument The content for a possible placeholder. Must be not null
.
+ * @return The externalized string or the resource key enclosed in exlamation marks.
+ */
+ public static String getResourceString(String key, Object argument) {
+ assert argument != null;
+ return getResourceString(key, new Object[] { argument });
+ }
+
+ /**
+ * Queries the externalized string for the specified resource key from
+ * the plugins associated resource bundle. If a externalized resource
+ * for the specified key exist, possible argument placeholder will be
+ * replaced by their specified values.
+ *
+ * @param key The resource key. Must be not null
!
+ * @param arguments The content for the possible arguments. Must be not null
.
+ * @return The externalized string or the resource key enclosed in exlamation marks.
+ */
+ public static String getResourceString(String key, Object[] arguments) {
+ assert arguments != null;
+ String resourceString = getResourceString(key);
+ if (!resourceString.startsWith("!")) { //$NON-NLS-1$
+ MessageFormat.format(resourceString, arguments);
+ }
+ return resourceString;
+ }
+
+ /**
+ * Checks if the test case given through the specified key is enabled for
+ * execution. A test case is considered enabled if either
+ *
null
!
+ * @return true
if the test case is enabled for execution, false
otherwise.
+ */
+ public static boolean isTestCaseEnabled(String testId) {
+ assert testId != null;
+ // Test first for the system property (explicit -D option).
+ String value = System.getProperty(testId);
+// if (value != null) return Boolean.parseBoolean(value);
+ if (value != null) return value.equals("true"); //$NON-NLS-1$
+
+ // If the system property is not set, check for the key in the resource bundle
+ value = getResourceString(testId);
+// if (value != null && !value.startsWith("!")) return Boolean.parseBoolean(value); //$NON-NLS-1$
+ if (value != null && !value.startsWith("!")) return value.equals("true"); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties
new file mode 100644
index 00000000000..908b8b7e599
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/RSETestsResources.properties
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2001, 2004 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
+
+#
+# The following section controls the execution of the single test cases.
+# Each test case can be disabled individually here.
+#
+
+RSEConnectionTestCase.testConnect=true
+RSEConnectionTestCase.testResolveFilterString=true
+
+RSEPersistenceTest.testHostCreation=true
+RSEPersistenceTest.testHostDeletion=true
+
+RSEConnectionTestCase.testConnect=true
+RSEConnectionTestCase.testResolveFilterString=true
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java
new file mode 100644
index 00000000000..a223beabe81
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/IRSECoreTestCaseProperties.java
@@ -0,0 +1,43 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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 contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.core;
+
+/**
+ * Interface declaring public known and usable core test case properties.
+ */
+public interface IRSECoreTestCaseProperties {
+ static final String PROP_BASE_KEY = "org.eclipse.rse.tests.core"; //$NON-NLS-1$
+
+ /**
+ * Boolean property controling if or if not the Remote Systems View will be
+ * expanded before the test case is starting. The original view maximized
+ * state will be restored after the test case finished.
+ *
+ * Default value is true
.
+ */
+ public static final String PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW = PROP_BASE_KEY + ".maximizeRemoteSystemsView"; //$NON-NLS-1$
+
+ /**
+ * String property specifying the perspective id to switch to before the
+ * test case is starting. The original perspective will be restored after
+ * the test case finished.
+ *
+ * Default value is org.eclipse.rse.ui.view.SystemPerspective
.
+ */
+ public static final String PROP_SWITCH_TO_PERSPECTIVE = PROP_BASE_KEY + ".switchToPerspective"; //$NON-NLS-1$
+
+ /**
+ * Boolean property controling if the test execution should be forced into a non
+ * display thread (if not already running in a non display thread anyway).
+ *
+ * Default value is false
.
+ */
+ public static final String PROP_FORCE_BACKGROUND_EXECUTION = PROP_BASE_KEY + ".forceBackgroundExecution"; //$NON-NLS-1$
+}
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
new file mode 100644
index 00000000000..07bfa22076f
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/RSECoreTestCase.java
@@ -0,0 +1,199 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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 contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.core;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+import junit.framework.TestResult;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.rse.tests.RSETestsPlugin;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Core RSE test case infra structure implementation.
+ */
+public class RSECoreTestCase extends TestCase {
+ private final Properties properties = new Properties();
+
+ /**
+ * Constructor.
+ */
+ public RSECoreTestCase() {
+ this(null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name The test name.
+ */
+ public RSECoreTestCase(String name) {
+ super(name);
+ // clear out all properties on construction.
+ properties.clear();
+ // initialize the core test properties
+ initializeProperties();
+ }
+
+ // ***** Test properties management and support methods *****
+
+ /**
+ * Initialize the core test properties. Override to modify core
+ * test properties or to add additional ones.
+ */
+ protected void initializeProperties() {
+ setProperty(IRSECoreTestCaseProperties.PROP_MAXIMIZE_REMOTE_SYSTEMS_VIEW, true);
+ setProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE, "org.eclipse.rse.ui.view.SystemPerspective"); //$NON-NLS-1$
+ setProperty(IRSECoreTestCaseProperties.PROP_FORCE_BACKGROUND_EXECUTION, false);
+ }
+
+ /**
+ * Enables or disables the specified property.
+ *
+ * @param key The key of the property to enable or disable. Must be not 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.
+ */
+ protected final boolean isProperty(String key, boolean value) {
+ 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
.
+ */
+ protected final void setProperty(String key, String value) {
+ assert key != null;
+ if (value != null) {
+ properties.setProperty(key, value);
+ } else {
+ properties.remove(key);
+ }
+ }
+
+ /**
+ * 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
+ * or the specified value is null
and the property does not exist,
+ * false
otherwise.
+ */
+ protected final boolean isProperty(String key, String value) {
+ assert key != null;
+ if (value != null) {
+ return value.equalsIgnoreCase(properties.getProperty(key));
+ } else {
+ return !properties.containsKey(key);
+ }
+ }
+
+ // ***** Test case life cycle management and support methods *****
+
+ private 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.
+ */
+ public RSEBackgroundTestExecutionJob(TestResult result) {
+ super("RSE JUnit Test Case Execution Job"); //$NON-NLS-1$
+ 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)
+ */
+ protected IStatus run(IProgressMonitor monitor) {
+ monitor.beginTask("Running test " + RSECoreTestCase.this.getName() + " ...", IProgressMonitor.UNKNOWN); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // Execute the test now.
+ RSECoreTestCase.super.run(result);
+
+ monitor.done();
+
+ setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE);
+
+ // The job never fails. The test result is the real result.
+ return Status.OK_STATUS;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#run(junit.framework.TestResult)
+ */
+ public final void run(TestResult result) {
+ if (isProperty(IRSECoreTestCaseProperties.PROP_FORCE_BACKGROUND_EXECUTION, false)) {
+ // do not force test execution into background, just call super.run(result)
+ // from with the current thread.
+ super.run(result);
+ } else {
+ // Create the background job
+ final Job job = new RSEBackgroundTestExecutionJob(result);
+ // Initialize the BACKGROUND_EXECUTION_TEST_RESULT property
+ job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE);
+ // schedule the job to run immediatelly
+ job.schedule();
+
+ // wait till the job finished executing
+ Boolean isFinished = (Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED);
+ Display display = Display.findDisplay(Thread.currentThread());
+ if (display != null) {
+ // The current thread is a display thread. The display event queue
+ // must be not blocked as otherwise asynchronous events are blocked too!!!!!
+ while (!Boolean.TRUE.equals(isFinished)) {
+ if (!display.readAndDispatch()) display.sleep();
+ isFinished = (Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED);
+ }
+ } else {
+ // The current thread is not a display thread. The thread can be put asleep
+ // for while till the test result is retried to poll.
+ while (!Boolean.TRUE.equals(isFinished)) {
+ try { Thread.sleep(500); } catch (InterruptedException e) { /* ignored on purpose */ }
+ isFinished = (Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED);
+ }
+ }
+ }
+ }
+
+
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/BaseConnectionTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
similarity index 75%
rename from rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/BaseConnectionTest.java
rename to rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
index 2f6cda1c73d..6d403513e33 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/BaseConnectionTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java
@@ -1,224 +1,231 @@
-/* *******************************************************************************
- * Copyright (c) 2006 IBM Corporation. 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:
- * Don Yantzi (IBM) - initial contribution.
- * David Dykstal (IBM) - initial contribution.
- * *******************************************************************************/
-package org.eclipse.rse.tests.systems.connection;
-
-import java.text.MessageFormat;
-import java.util.Properties;
-
-import org.eclipse.rse.core.RSECorePlugin;
-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.IServiceSubSystemConfiguration;
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
-import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
-import org.eclipse.rse.tests.framework.AnnotatingTestCase;
-import org.eclipse.rse.tests.systems.core.SystemTestPlugin;
-import org.eclipse.rse.tests.systems.core.SystemTestUtil;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-/**
- * Abstract superclass for JUnit PDE test cases that require an IHost.
- * This superclass creates a single RSE IHost that can
- * be reused by multiple testcases run during the same PDE invocation.
- *
- * @author yantzi
- */
-public class BaseConnectionTest extends AnnotatingTestCase {
-
- private IHost host = null;
- private Properties properties = null;
-
- /**
- * Constructor for ConnectionTest.
- *
- * @param name
- * Name of current test being run.
- */
- public BaseConnectionTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- properties = SystemTestUtil.loadProperties(SystemTestPlugin.getDefault().getBundle(), "SystemConnectionInfo.properties");
- host = getHost();
- }
-
- protected void tearDown() throws Exception {
- host = null;
- properties = null;
- super.tearDown();
- }
-
- /**
- * Load strings from the SystemConnectionTests.properties file. Can be used to retrieve
- * properties that influence the running of the testcase.
- * @param key the key of the string in the properties file.
- * @return the value of the property
- */
- public String getString(String key) {
- return properties.getProperty(key);
- }
-
- /**
- * Find the host used by all subclasses for this
- * invocation of the runtime workbench. If not found, then
- * create it using the associated getters to
- * change the default connection name, hostname, user ID or password (as
- * specified in SystemConnectionTests.properties).
- *
- * @return the new connection (host)
- * @throws Exception if there is a problem
- *
- * @see BaseConnectionTest#getHostName()
- * @see BaseConnectionTest#getHostAddress()
- * @see BaseConnectionTest#getSystemType()
- * @see BaseConnectionTest#getUserID()
- * @see BaseConnectionTest#getPassword()
- */
- protected IHost getHost() throws Exception {
- if (host == null) {
- String profileName = getProfileName();
- assertNotSame("need to change the profile name in SystemConnectionInfo.properties", "unknown", profileName);
- ISystemProfile profile = SystemTestUtil.findProfile(profileName);
- if (profile == null) {
- profile = SystemTestUtil.createProfile(profileName);
- }
- String hostName = getHostName();
- assertNotSame("need to change the host name in SystemConnectionInfo.properties", "unknown", hostName);
- host = SystemTestUtil.findHost(profileName, hostName);
- if (host == null) {
- String userID = getUserID();
- assertNotSame("need to change the user id in SystemConnectionInfo.properties", "unknown", userID);
- String password = getPassword();
- assertNotSame("need to change the password in SystemConnectionInfo.properties", "unknown", password);
- String hostAddress = getHostAddress();
- assertNotSame("need to change the host address in SystemConnectionInfo.properties", "unknown", hostAddress);
- host = SystemTestUtil.createHost(profileName, hostName, hostAddress, getSystemType(), userID, password);
- }
- }
- return host;
- }
-
- /**
- * Get the file subsystem for default connection.
- * Returns null if there is no subsystem with the given configuration id in this connection.
- * @param desiredConfigurationId the subsystem configuration id of the desired subsystem.
- * @return the file subsystem
- * @throws Exception if there is a problem
- */
- protected ISubSystem getFileSubSystem(String desiredConfigurationId) throws Exception {
- FileServiceSubSystem subsystem = (FileServiceSubSystem) RemoteFileUtility.getFileSubSystem(getHost());
- ISubSystemConfiguration config = subsystem.getSubSystemConfiguration();
- String activeId = config.getId();
- if (!activeId.equals(desiredConfigurationId)) {
- if (subsystem.isConnected()) {
- throw new RuntimeException(MessageFormat.format("The subsystem is connected as {}. Disconnect before changing.", new Object[] {activeId}));
- } else {
- ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry();
- ISubSystemConfiguration desiredConfiguration = registry.getSubSystemConfiguration(desiredConfigurationId);
- if (desiredConfiguration instanceof IServiceSubSystemConfiguration) {
- IServiceSubSystemConfiguration t = (IServiceSubSystemConfiguration) desiredConfiguration;
- subsystem.switchServiceFactory(t);
- }
- }
- }
- return subsystem;
- }
-
- /**
- * Get the shell subsystem for default connection
- * @return the shell subsystem
- * @throws Exception if there is a problem
- */
- protected ISubSystem getShellSubSystem() throws Exception {
- ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
- ISubSystem[] subSystems = registry.getSubSystems(getHost());
- for (int i = 0; i < subSystems.length; i++) {
- ISubSystem subSystem = subSystems[i];
- if (subSystem instanceof IShellServiceSubSystem) {
- IShellServiceSubSystem shellSubSystem = (IShellServiceSubSystem) subSystem;
- return shellSubSystem;
- }
- }
- return null;
- }
-
- /**
- * Retrieve the name for the default RSE profile used by subclasses.
- * Subclasses should override this method to override the profile name,
- * otherwise the default system type from SystemConnectionTests.properties
- * is used.
- * @return the name of the profile
- */
- protected String getProfileName() {
- return getString(ConnectionConstants.DEFAULT_PROFILE_NAME);
- }
-
- /**
- * Retrieve the name for the default RSE connection used by subclasses.
- * Subclasses should override this method to override the connection name,
- * otherwise the default system type from SystemConnectionTests.properties
- * is used.
- * @return the name of the host
- */
- protected String getHostName() {
- return getString(ConnectionConstants.DEFAULT_HOST_NAME);
- }
-
- /**
- * Retrieve the hostname for the default RSE connection used by subclasses.
- * Subclasses should override this method to override the hostname,
- * otherwise the default hostname is used.
- * @return the host address information
- */
- protected String getHostAddress() {
- return getString(ConnectionConstants.DEFAULT_IP_NAME);
- }
-
- /**
- * Retrieve the system type for the default RSE connection used by
- * subclasses. Subclasses should override this method to override the system
- * type, otherwise the default system type from
- * SystemConnectionTests.properties is used.
- * @return the system type
- */
- protected String getSystemType() {
- return getString(ConnectionConstants.DEFAULT_SYSTEM_TYPE);
- }
-
- /**
- * Retrieve the user ID for the default RSE connection used by subclasses.
- * Subclasses should override this method to override the user ID used for
- * the connection, otherwise the default system type from
- * SystemConnectionTests.properties is used.
- * @return the user id the connection will use
- */
- protected String getUserID() {
- return getString(ConnectionConstants.DEFAULT_USERID);
- }
-
- /**
- * Retrieve the password for the default RSE connection used by subclasses.
- * Subclasses should override this method to override the password used for
- * the associated hostname and user ID, otherwise the default system type
- * from SystemConnectionTests.properties is used.
- * @return the password used to establish the connection
- */
- protected String getPassword() {
- return getString(ConnectionConstants.DEFAULT_PASSWORD);
- }
-
-}
\ No newline at end of file
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * Don Yantzi (IBM) - initial contribution.
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.core.connection;
+
+import java.text.MessageFormat;
+import java.util.Properties;
+
+import org.eclipse.rse.core.RSECorePlugin;
+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.IServiceSubSystemConfiguration;
+import org.eclipse.rse.core.subsystems.ISubSystem;
+import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
+import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
+import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
+import org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem.IShellServiceSubSystem;
+import org.eclipse.rse.tests.RSETestsPlugin;
+import org.eclipse.rse.tests.core.RSECoreTestCase;
+import org.eclipse.rse.ui.RSEUIPlugin;
+
+/**
+ * Abstract superclass for JUnit PDE test cases that require an IHost.
+ * This superclass creates a single RSE IHost that can
+ * be reused by multiple testcases run during the same PDE invocation.
+ *
+ * @author yantzi
+ */
+public class RSEBaseConnectionTestCase extends RSECoreTestCase {
+ // Constants used to index into the SystemConnectionTests.properties file
+ private static final String DEFAULT_IP_NAME = "default_ip_name"; //$NON-NLS-1$
+ private static final String DEFAULT_SYSTEM_TYPE= "default_system_type"; //$NON-NLS-1$
+
+ private static final String DEFAULT_PROFILE_NAME = "default_profile_name"; //$NON-NLS-1$
+ private static final String DEFAULT_HOST_NAME = "default_host_name"; //$NON-NLS-1$
+
+ private static final String DEFAULT_USERID = "default_userid"; //$NON-NLS-1$
+ private static final String DEFAULT_PASSWORD = "default_password"; //$NON-NLS-1$
+
+ private IHost host = null;
+ private Properties properties = null;
+
+ /**
+ * Constructor.
+ *
+ * @param name The test name.
+ */
+ public RSEBaseConnectionTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ properties = RSEConnectionTestUtil.loadProperties(RSETestsPlugin.getDefault().getBundle(), "SystemConnectionInfo.properties"); //$NON-NLS-1$
+ host = getHost();
+ }
+
+ protected void tearDown() throws Exception {
+ host = null;
+ properties = null;
+ super.tearDown();
+ }
+
+ /**
+ * Load strings from the SystemConnectionTests.properties file. Can be used to retrieve
+ * properties that influence the running of the testcase.
+ * @param key the key of the string in the properties file.
+ * @return the value of the property
+ */
+ public String getString(String key) {
+ return properties.getProperty(key);
+ }
+
+ /**
+ * Find the host used by all subclasses for this
+ * invocation of the runtime workbench. If not found, then
+ * create it using the associated getters to
+ * change the default connection name, hostname, user ID or password (as
+ * specified in SystemConnectionTests.properties).
+ *
+ * @return the new connection (host)
+ * @throws Exception if there is a problem
+ *
+ * @see RSEBaseConnectionTestCase#getHostName()
+ * @see RSEBaseConnectionTestCase#getHostAddress()
+ * @see RSEBaseConnectionTestCase#getSystemType()
+ * @see RSEBaseConnectionTestCase#getUserID()
+ * @see RSEBaseConnectionTestCase#getPassword()
+ */
+ protected IHost getHost() throws Exception {
+ if (host == null) {
+ String profileName = getProfileName();
+ assertNotSame("need to change the profile name in SystemConnectionInfo.properties", "unknown", profileName); //$NON-NLS-1$ //$NON-NLS-2$
+ ISystemProfile profile = RSEConnectionTestUtil.findProfile(profileName);
+ if (profile == null) {
+ profile = RSEConnectionTestUtil.createProfile(profileName);
+ }
+ String hostName = getHostName();
+ assertNotSame("need to change the host name in SystemConnectionInfo.properties", "unknown", hostName); //$NON-NLS-1$ //$NON-NLS-2$
+ host = RSEConnectionTestUtil.findHost(profileName, hostName);
+ if (host == null) {
+ String userID = getUserID();
+ assertNotSame("need to change the user id in SystemConnectionInfo.properties", "unknown", userID); //$NON-NLS-1$ //$NON-NLS-2$
+ String password = getPassword();
+ assertNotSame("need to change the password in SystemConnectionInfo.properties", "unknown", password); //$NON-NLS-1$ //$NON-NLS-2$
+ String hostAddress = getHostAddress();
+ assertNotSame("need to change the host address in SystemConnectionInfo.properties", "unknown", hostAddress); //$NON-NLS-1$ //$NON-NLS-2$
+ host = RSEConnectionTestUtil.createHost(profileName, hostName, hostAddress, getSystemType(), userID, password);
+ }
+ }
+ return host;
+ }
+
+ /**
+ * Get the file subsystem for default connection.
+ * Returns null if there is no subsystem with the given configuration id in this connection.
+ * @param desiredConfigurationId the subsystem configuration id of the desired subsystem.
+ * @return the file subsystem
+ * @throws Exception if there is a problem
+ */
+ protected ISubSystem getFileSubSystem(String desiredConfigurationId) throws Exception {
+ FileServiceSubSystem subsystem = (FileServiceSubSystem) RemoteFileUtility.getFileSubSystem(getHost());
+ ISubSystemConfiguration config = subsystem.getSubSystemConfiguration();
+ String activeId = config.getId();
+ if (!activeId.equals(desiredConfigurationId)) {
+ if (subsystem.isConnected()) {
+ throw new RuntimeException(MessageFormat.format("The subsystem is connected as {0}. Disconnect before changing.", new Object[] {activeId})); //$NON-NLS-1$
+ } else {
+ ISystemRegistry registry = RSECorePlugin.getDefault().getSystemRegistry();
+ ISubSystemConfiguration desiredConfiguration = registry.getSubSystemConfiguration(desiredConfigurationId);
+ if (desiredConfiguration instanceof IServiceSubSystemConfiguration) {
+ IServiceSubSystemConfiguration t = (IServiceSubSystemConfiguration) desiredConfiguration;
+ subsystem.switchServiceFactory(t);
+ }
+ }
+ }
+ return subsystem;
+ }
+
+ /**
+ * Get the shell subsystem for default connection
+ * @return the shell subsystem
+ * @throws Exception if there is a problem
+ */
+ protected ISubSystem getShellSubSystem() throws Exception {
+ ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
+ ISubSystem[] subSystems = registry.getSubSystems(getHost());
+ for (int i = 0; i < subSystems.length; i++) {
+ ISubSystem subSystem = subSystems[i];
+ if (subSystem instanceof IShellServiceSubSystem) {
+ IShellServiceSubSystem shellSubSystem = (IShellServiceSubSystem) subSystem;
+ return shellSubSystem;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Retrieve the name for the default RSE profile used by subclasses.
+ * Subclasses should override this method to override the profile name,
+ * otherwise the default system type from SystemConnectionTests.properties
+ * is used.
+ * @return the name of the profile
+ */
+ protected String getProfileName() {
+ return getString(DEFAULT_PROFILE_NAME);
+ }
+
+ /**
+ * Retrieve the name for the default RSE connection used by subclasses.
+ * Subclasses should override this method to override the connection name,
+ * otherwise the default system type from SystemConnectionTests.properties
+ * is used.
+ * @return the name of the host
+ */
+ protected String getHostName() {
+ return getString(DEFAULT_HOST_NAME);
+ }
+
+ /**
+ * Retrieve the hostname for the default RSE connection used by subclasses.
+ * Subclasses should override this method to override the hostname,
+ * otherwise the default hostname is used.
+ * @return the host address information
+ */
+ protected String getHostAddress() {
+ return getString(DEFAULT_IP_NAME);
+ }
+
+ /**
+ * Retrieve the system type for the default RSE connection used by
+ * subclasses. Subclasses should override this method to override the system
+ * type, otherwise the default system type from
+ * SystemConnectionTests.properties is used.
+ * @return the system type
+ */
+ protected String getSystemType() {
+ return getString(DEFAULT_SYSTEM_TYPE);
+ }
+
+ /**
+ * Retrieve the user ID for the default RSE connection used by subclasses.
+ * Subclasses should override this method to override the user ID used for
+ * the connection, otherwise the default system type from
+ * SystemConnectionTests.properties is used.
+ * @return the user id the connection will use
+ */
+ protected String getUserID() {
+ return getString(DEFAULT_USERID);
+ }
+
+ /**
+ * Retrieve the password for the default RSE connection used by subclasses.
+ * Subclasses should override this method to override the password used for
+ * the associated hostname and user ID, otherwise the default system type
+ * from SystemConnectionTests.properties is used.
+ * @return the password used to establish the connection
+ */
+ protected String getPassword() {
+ return getString(DEFAULT_PASSWORD);
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
similarity index 68%
rename from rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTest.java
rename to rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
index cf6f304ad99..0a5f61b76a9 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java
@@ -1,63 +1,69 @@
-/* *******************************************************************************
- * Copyright (c) 2006 IBM Corporation. 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:
- * Don Yantzi (IBM) - initial contribution.
- * David Dykstal (IBM) - initial contribution.
- * *******************************************************************************/
-package org.eclipse.rse.tests.systems.connection;
-
-import org.eclipse.rse.core.subsystems.ISubSystem;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
-
-/**
- * Basic connection tests.
- */
-public class ConnectionTest extends BaseConnectionTest {
-
- public ConnectionTest(String name) {
- super(name);
- }
-
- /**
- * Test the connect and disconnect methods
- * @throws Exception if there is a problem
- */
- public void testConnect() throws Exception {
- ISubSystem subsystem = getFileSubSystem("dstore.files");
- assertNotNull("No dstore.files subystem", subsystem);
-// subsystem.getConnectorService().setPort(4036);
-// ((RemoteServerLauncher)subsystem.getConnectorService().getRemoteServerLauncherProperties()).setDaemonPort(4036);
- RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_SSL, false);
- RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
- subsystem.connect();
- assertTrue("Subsystem not connected", subsystem.isConnected());
- subsystem.disconnect();
- assertFalse(subsystem.isConnected());
- }
-
- /**
- * Test resolving a filter string.
- * @throws Exception if there is a problem
- */
- public void testResolveFilterString() throws Exception {
- ISubSystem subsystem = getFileSubSystem("dstore.files");
- assertNotNull("No dstore.files subystem", subsystem);
- try {
- subsystem.connect();
- assertTrue("subsystem not connected", subsystem.isConnected());
- Object[] objects = subsystem.resolveFilterString(null, "/bin/*");
- assertNotNull("A null result was returned from resolveFilterString.", objects);
- assertTrue("No entries found in home directory.", objects.length > 0);
- } finally {
- if (subsystem.isConnected()) {
- subsystem.disconnect();
- }
- }
- }
-
-}
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * Don Yantzi (IBM) - initial contribution.
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.core.connection;
+
+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;
+
+/**
+ * Basic connection tests.
+ */
+public class RSEConnectionTestCase extends RSEBaseConnectionTestCase {
+
+ public RSEConnectionTestCase(String name) {
+ super(name);
+ }
+
+ /**
+ * Test the connect and disconnect methods
+ * @throws Exception if there is a problem
+ */
+ public void testConnect() throws Exception {
+ if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testConnect")) return; //$NON-NLS-1$
+
+ ISubSystem subsystem = getFileSubSystem("dstore.files"); //$NON-NLS-1$
+ assertNotNull("No dstore.files subystem", subsystem); //$NON-NLS-1$
+// subsystem.getConnectorService().setPort(4036);
+// ((RemoteServerLauncher)subsystem.getConnectorService().getRemoteServerLauncherProperties()).setDaemonPort(4036);
+ RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_SSL, false);
+ RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.ALERT_NONSSL, false);
+ subsystem.connect();
+ assertTrue("Subsystem not connected", subsystem.isConnected()); //$NON-NLS-1$
+ subsystem.disconnect();
+ Thread.sleep(5000); // disconnect runs as a separate job, give it some time to disconnect
+ assertFalse(subsystem.isConnected());
+ }
+
+ /**
+ * Test resolving a filter string.
+ * @throws Exception if there is a problem
+ */
+ public void testResolveFilterString() throws Exception {
+ if (!RSETestsPlugin.isTestCaseEnabled("RSEConnectionTestCase.testResolveFilterString")) return; //$NON-NLS-1$
+
+ ISubSystem subsystem = getFileSubSystem("dstore.files"); //$NON-NLS-1$
+ assertNotNull("No dstore.files subystem", subsystem); //$NON-NLS-1$
+ try {
+ subsystem.connect();
+ assertTrue("subsystem not connected", subsystem.isConnected()); //$NON-NLS-1$
+ Object[] objects = subsystem.resolveFilterString(null, "/bin/*"); //$NON-NLS-1$
+ assertNotNull("A null result was returned from resolveFilterString.", objects); //$NON-NLS-1$
+ assertTrue("No entries found in home directory.", objects.length > 0); //$NON-NLS-1$
+ } finally {
+ if (subsystem.isConnected()) {
+ subsystem.disconnect();
+ }
+ }
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java
new file mode 100644
index 00000000000..c3854665ade
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestSuite.java
@@ -0,0 +1,48 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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 contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.core.connection;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Main class bundling all RSE connection test cases.
+ */
+public class RSEConnectionTestSuite {
+
+ /**
+ * Standard Java application main method. Allows to launch the test
+ * suite from outside as part of nightly runs, headless runs or other.
+ *
Note: Use only junit.textui.TestRunner
here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ *
+ * @param args The standard Java application command line parameters passed in. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + /** + * Combine all test into a suite and returns the test suite instance. + *
+ * Note: This method must be always called suite
! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!
+ *
+ * @return The test suite instance. + */ + public static Test suite() { + TestSuite suite = new TestSuite("RSE Connection Test Suite"); //$NON-NLS-1$ + // add the single test suites to the overall one here. + suite.addTestSuite(RSEConnectionTestCase.class); + + return suite; + } +} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestUtil.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestUtil.java similarity index 95% rename from rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestUtil.java rename to rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestUtil.java index bceefa5b78b..12b6cd000b4 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestUtil.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestUtil.java @@ -1,215 +1,215 @@ -/* ******************************************************************************* - * Copyright (c) 2006 IBM Corporation. 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: - * Don Yantzi (IBM) - initial contribution. - * David Dykstal (IBM) - initial contribution. - * *******************************************************************************/ -package org.eclipse.rse.tests.systems.core; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Properties; - -import org.eclipse.rse.core.ISystemUserIdConstants; -import org.eclipse.rse.core.PasswordPersistenceManager; -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.model.SystemSignonInformation; -import org.eclipse.rse.model.ISystemRegistryUI; -import org.eclipse.rse.model.ISystemResourceChangeEvents; -import org.eclipse.rse.model.SystemRegistry; -import org.eclipse.rse.model.SystemResourceChangeEvent; -import org.eclipse.rse.ui.RSEUIPlugin; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.Shell; -import org.osgi.framework.Bundle; - -/** - * SystemTestUtil is a collection of static utility methods for creating - * RSE system connections and associated RSE artifacts (filter pools, filters, etc...) to assist - * you in writing your JUnit plug-in testcases. - *
- * Since most JUnit PDE testcases create a brand new workspace when they start you will likely need - * to create a new RSE connection to start your testing. The "createSystemConnection(...) methods - * are therefore your most likely starting point. - *
- * Note: If your testcases subclasses AbstractSystemConnectionTest then you can use the getConnection() - * method instead. - * - * @author yantzi - */ -public class SystemTestUtil { - - /** - * Load a properties file and return the Properties object. - * @param bundle The bundle containing the properties. - * @param propertiesFileName the properties file name relative to the bundle. - * @return the Properties object, may be empty if no such file is found or an error occurs. - */ - public static Properties loadProperties(Bundle bundle, String propertiesFileName) { - URL url = bundle.getEntry(propertiesFileName); - Properties result = new Properties(); - try { - InputStream in = url.openStream(); - result.load(in); - in.close(); - } catch (IOException e) { - } - return result; - } - - /** - * @param profileName The profile in which to look for the host. - * @param hostName The host to look for. - * @return The requested host (connection) or null if none was found. - */ - public static IHost findHost(String profileName, String hostName) { - IHost host = null; - ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); - ISystemProfile profile = registry.getSystemProfile(profileName); - if (profile != null) { - host = registry.getHost(profile, hostName); - } - return host; - } - - /** - * Create a new system connection. - * If a user ID and password are not provided then the testcase will pause while the user - * is prompted to signon. - * - * @param profileName The name of an existing RSE profile under which this connection should be created. - * @param hostName The name for the new RSE connection. - * @param hostAddress The IP address or name for the new RSE connection. - * @param systemType the system type of the new connection. - * @param userid The user ID for the new RSE connection. May be null. - * @param password The password to be used in conjunction with the user ID for - * connecting to the remote system. May be null. - * @return A new RSE IHost for the specified host information - * @throws Exception - */ - public static IHost createHost(String profileName, String hostName, String hostAddress, String systemType, String userid, String password) throws Exception { - ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); - IHost connection = registry.createHost(profileName, systemType, hostName, hostAddress, null, userid, ISystemUserIdConstants.USERID_LOCATION_CONNECTION, null); - if (userid != null && password != null) { - savePassword(hostAddress, userid, password, systemType); // register password for this hostname - } - return connection; - } - - /** - * Delete a host given its name and the name of its profile. If the host is not found then - * do nothing. - * @param profileName the name of the profile containing the host - * @param hostName the name of the host to delete - */ - public static void deleteHost(String profileName, String hostName) { - IHost host = findHost(profileName, hostName); - if (host != null) { - SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); - registry.deleteHost(host); - registry.fireEvent(new SystemResourceChangeEvent(host, ISystemResourceChangeEvents.EVENT_DELETE, registry)); - } - } - - /** - * Find a profile given its name. - * @param profileName the name of the profile to find - * @return the ISystemProfile that was found. - */ - public static ISystemProfile findProfile(String profileName) { - ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); - ISystemProfile profile = registry.getSystemProfile(profileName); - return profile; - } - - /** - * Creates a new profile. If the profile already exists, it throws an exception. - * @param profileName The name of the profile to create. - * @return The profile that was created. - * @throws RuntimeException if the profile exists or it cannot be created. - */ - public static ISystemProfile createProfile(String profileName) { - ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); - ISystemProfile profile = findProfile(profileName); - if (profile != null) { - throw new RuntimeException(MessageFormat.format("Profile {0} already exists.", new Object[] { profileName })); - } - try { - profile = registry.createSystemProfile(profileName, true); - } catch (Exception e) { - throw new RuntimeException(e); - } - return profile; - } - - /** - * Save the password assocaited with the specified hostname and userid. This method overwrites any previously - * saved password for the specified hostname and user ID. - * - * @param hostname The hostname to save the password for. - * @param userid The user ID to save the password for. - * @param password The password to be saved. - * @param systemtype the system type of the new connection - * - * @return true if the password was saved okay or false if it was not able to be saved - */ - public static boolean savePassword(String hostname, String userid, String password, String systemtype) { - SystemSignonInformation info = new SystemSignonInformation(hostname, userid, password, systemtype); - return (PasswordPersistenceManager.getInstance().add(info, true) == PasswordPersistenceManager.RC_OK); - } - - /** - * Retrieve the default RSE system profile. If the default profile has not been renamed from the default - * name ("Private") then the profile is renamed to the DEFAULT_PROFILE_NAME specified in - * SystemConnectionTests.properties. - * @param profileName the name the default profile will become. - * @return The default RSE system profile. - * @throws Exception of the profile cannot be found - */ - public static ISystemProfile getDefaultProfile(String profileName) throws Exception { - ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISystemProfile defaultProfile = sr.getSystemProfileManager().getDefaultPrivateSystemProfile(); - if (defaultProfile != null && defaultProfile.getName().equals("Private")) { - sr.renameSystemProfile(defaultProfile, profileName); - } - return defaultProfile; - } - - /** - * Rename the default RSE system profile. - * - * @param name The new name for the default RSE system profile. - * - * @return The default RSE system profile - * @throws Exception if the profile cannot be renamed - */ - public static ISystemProfile renameDefaultProfile(String name) throws Exception { - ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISystemProfile defaultProfile = sr.getSystemProfileManager().getDefaultPrivateSystemProfile(); - if (defaultProfile != null) { - sr.renameSystemProfile(defaultProfile, name); - } - return defaultProfile; - } - - /** - * Display a simple String message to the user. This can be used to provide testing instructions to the user - * to guide them through semi-automated test cases. - * @param shell the shell on which to show the message - * @param message the message to show - */ - public static void displayMessage(Shell shell, String message) { - MessageBox msgBox = new MessageBox(shell); - msgBox.setMessage(message); - msgBox.open(); - } - -} +/* ******************************************************************************* + * Copyright (c) 2006 IBM Corporation. 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: + * Don Yantzi (IBM) - initial contribution. + * David Dykstal (IBM) - initial contribution. + * *******************************************************************************/ +package org.eclipse.rse.tests.core.connection; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Properties; + +import org.eclipse.rse.core.ISystemUserIdConstants; +import org.eclipse.rse.core.PasswordPersistenceManager; +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.model.SystemSignonInformation; +import org.eclipse.rse.model.ISystemRegistryUI; +import org.eclipse.rse.model.ISystemResourceChangeEvents; +import org.eclipse.rse.model.SystemRegistry; +import org.eclipse.rse.model.SystemResourceChangeEvent; +import org.eclipse.rse.ui.RSEUIPlugin; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; +import org.osgi.framework.Bundle; + +/** + * RSEConnectionTestUtil is a collection of static utility methods for creating + * RSE system connections and associated RSE artifacts (filter pools, filters, etc...) to assist + * you in writing your JUnit plug-in testcases. + *
+ * Since most JUnit PDE testcases create a brand new workspace when they start you will likely need + * to create a new RSE connection to start your testing. The "createSystemConnection(...) methods + * are therefore your most likely starting point. + *
+ * Note: If your testcases subclasses AbstractSystemConnectionTest then you can use the getConnection() + * method instead. + * + * @author yantzi + */ +public class RSEConnectionTestUtil { + + /** + * Load a properties file and return the Properties object. + * @param bundle The bundle containing the properties. + * @param propertiesFileName the properties file name relative to the bundle. + * @return the Properties object, may be empty if no such file is found or an error occurs. + */ + public static Properties loadProperties(Bundle bundle, String propertiesFileName) { + URL url = bundle.getEntry(propertiesFileName); + Properties result = new Properties(); + try { + InputStream in = url.openStream(); + result.load(in); + in.close(); + } catch (IOException e) { + } + return result; + } + + /** + * @param profileName The profile in which to look for the host. + * @param hostName The host to look for. + * @return The requested host (connection) or null if none was found. + */ + public static IHost findHost(String profileName, String hostName) { + IHost host = null; + ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); + ISystemProfile profile = registry.getSystemProfile(profileName); + if (profile != null) { + host = registry.getHost(profile, hostName); + } + return host; + } + + /** + * Create a new system connection. + * If a user ID and password are not provided then the testcase will pause while the user + * is prompted to signon. + * + * @param profileName The name of an existing RSE profile under which this connection should be created. + * @param hostName The name for the new RSE connection. + * @param hostAddress The IP address or name for the new RSE connection. + * @param systemType the system type of the new connection. + * @param userid The user ID for the new RSE connection. May be null. + * @param password The password to be used in conjunction with the user ID for + * connecting to the remote system. May be null. + * @return A new RSE IHost for the specified host information + * @throws Exception + */ + public static IHost createHost(String profileName, String hostName, String hostAddress, String systemType, String userid, String password) throws Exception { + ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); + IHost connection = registry.createHost(profileName, systemType, hostName, hostAddress, null, userid, ISystemUserIdConstants.USERID_LOCATION_CONNECTION, null); + if (userid != null && password != null) { + savePassword(hostAddress, userid, password, systemType); // register password for this hostname + } + return connection; + } + + /** + * Delete a host given its name and the name of its profile. If the host is not found then + * do nothing. + * @param profileName the name of the profile containing the host + * @param hostName the name of the host to delete + */ + public static void deleteHost(String profileName, String hostName) { + IHost host = findHost(profileName, hostName); + if (host != null) { + SystemRegistry registry = RSEUIPlugin.getTheSystemRegistry(); + registry.deleteHost(host); + registry.fireEvent(new SystemResourceChangeEvent(host, ISystemResourceChangeEvents.EVENT_DELETE, registry)); + } + } + + /** + * Find a profile given its name. + * @param profileName the name of the profile to find + * @return the ISystemProfile that was found. + */ + public static ISystemProfile findProfile(String profileName) { + ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); + ISystemProfile profile = registry.getSystemProfile(profileName); + return profile; + } + + /** + * Creates a new profile. If the profile already exists, it throws an exception. + * @param profileName The name of the profile to create. + * @return The profile that was created. + * @throws RuntimeException if the profile exists or it cannot be created. + */ + public static ISystemProfile createProfile(String profileName) { + ISystemRegistryUI registry = RSEUIPlugin.getTheSystemRegistry(); + ISystemProfile profile = findProfile(profileName); + if (profile != null) { + throw new RuntimeException(MessageFormat.format("Profile {0} already exists.", new Object[] { profileName })); //$NON-NLS-1$ + } + try { + profile = registry.createSystemProfile(profileName, true); + } catch (Exception e) { + throw new RuntimeException(e); + } + return profile; + } + + /** + * Save the password assocaited with the specified hostname and userid. This method overwrites any previously + * saved password for the specified hostname and user ID. + * + * @param hostname The hostname to save the password for. + * @param userid The user ID to save the password for. + * @param password The password to be saved. + * @param systemtype the system type of the new connection + * + * @return true if the password was saved okay or false if it was not able to be saved + */ + public static boolean savePassword(String hostname, String userid, String password, String systemtype) { + SystemSignonInformation info = new SystemSignonInformation(hostname, userid, password, systemtype); + return (PasswordPersistenceManager.getInstance().add(info, true) == PasswordPersistenceManager.RC_OK); + } + + /** + * Retrieve the default RSE system profile. If the default profile has not been renamed from the default + * name ("Private") then the profile is renamed to the DEFAULT_PROFILE_NAME specified in + * SystemConnectionTests.properties. + * @param profileName the name the default profile will become. + * @return The default RSE system profile. + * @throws Exception of the profile cannot be found + */ + public static ISystemProfile getDefaultProfile(String profileName) throws Exception { + ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); + ISystemProfile defaultProfile = sr.getSystemProfileManager().getDefaultPrivateSystemProfile(); + if (defaultProfile != null && defaultProfile.getName().equals("Private")) { //$NON-NLS-1$ + sr.renameSystemProfile(defaultProfile, profileName); + } + return defaultProfile; + } + + /** + * Rename the default RSE system profile. + * + * @param name The new name for the default RSE system profile. + * + * @return The default RSE system profile + * @throws Exception if the profile cannot be renamed + */ + public static ISystemProfile renameDefaultProfile(String name) throws Exception { + ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); + ISystemProfile defaultProfile = sr.getSystemProfileManager().getDefaultPrivateSystemProfile(); + if (defaultProfile != null) { + sr.renameSystemProfile(defaultProfile, name); + } + return defaultProfile; + } + + /** + * Display a simple String message to the user. This can be used to provide testing instructions to the user + * to guide them through semi-automated test cases. + * @param shell the shell on which to show the message + * @param message the message to show + */ + public static void displayMessage(Shell shell, String message) { + MessageBox msgBox = new MessageBox(shell); + msgBox.setMessage(message); + msgBox.open(); + } + +} diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java new file mode 100644 index 00000000000..5a1f5352ab4 --- /dev/null +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestSuite.java @@ -0,0 +1,49 @@ +/* ******************************************************************************* + * Copyright (c) 2006 IBM Corporation. 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 contribution. + * *******************************************************************************/ +package org.eclipse.rse.tests.internal; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Main class bundling all internal test case asuring the consistent + * functionality of the test framework itself. + */ +public class RSEInternalFrameworkTestSuite { + + /** + * Standard Java application main method. Allows to launch the test + * suite from outside as part of nightly runs, headless runs or other. + *
Note: Use only junit.textui.TestRunner
here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ *
+ * @param args The standard Java application command line parameters passed in. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + /** + * Combine all test into a suite and returns the test suite instance. + *
+ * Note: This method must be always called suite
! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!
+ *
+ * @return The test suite instance.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("RSE Internal Framework Test Suite"); //$NON-NLS-1$
+ // add the single test suites to the overall one here.
+ suite.addTestSuite(RSETestsPluginTestCase.class);
+
+ return suite;
+ }
+}
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
new file mode 100644
index 00000000000..e9518b961ce
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSETestsPluginTestCase.java
@@ -0,0 +1,32 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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 contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.internal;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.rse.tests.RSETestsPlugin;
+import org.eclipse.rse.tests.core.RSECoreTestCase;
+
+/**
+ * Test cases testing the functionality of the RSETestsPlugin
class.
+ */
+public class RSETestsPluginTestCase extends RSECoreTestCase {
+
+ /**
+ * Test the association of the resource bundle to the plugin and related
+ * resource bundle functionality.
+ */
+ public void testPluginResourceBundle() {
+ if (!RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")) return; //$NON-NLS-1$
+
+ ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle();
+ assertNotNull("No resource bundle associated with RSETestsPlugin!", bundle); //$NON-NLS-1$
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTest.java
new file mode 100644
index 00000000000..e1cfadaa9d6
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTest.java
@@ -0,0 +1,40 @@
+package org.eclipse.rse.tests.persistence;
+
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.tests.RSETestsPlugin;
+import org.eclipse.rse.tests.core.RSECoreTestCase;
+import org.eclipse.rse.tests.core.connection.RSEConnectionTestUtil;
+
+public class RSEPersistenceTest extends RSECoreTestCase {
+
+ public RSEPersistenceTest(String name) {
+ super(name);
+ }
+
+ public void testHostCreation() throws Exception {
+ if (!RSETestsPlugin.isTestCaseEnabled("RSEPersistenceTest.testHostCreation")) return; //$NON-NLS-1$
+
+ ISystemProfile profile = RSEConnectionTestUtil.findProfile("TestProfile"); //$NON-NLS-1$
+ if (profile == null) {
+ RSEConnectionTestUtil.createProfile("TestProfile"); //$NON-NLS-1$
+ }
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost1", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost2", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost3", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost4", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost5", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ RSEConnectionTestUtil.createHost("TestProfile", "TestHost6", "localhost", "Unix", "userid", "password"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ }
+
+ public void testHostDeletion() throws Exception {
+ if (!RSETestsPlugin.isTestCaseEnabled("RSEPersistenceTest.testHostDeletion")) return; //$NON-NLS-1$
+
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost1"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost2"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost3"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost4"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost5"); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEConnectionTestUtil.deleteHost("TestProfile", "TestHost6"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTestSuite.java
new file mode 100644
index 00000000000..27f4b1469d6
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/RSEPersistenceTestSuite.java
@@ -0,0 +1,39 @@
+package org.eclipse.rse.tests.persistence;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Main class bundling all RSE connection test cases.
+ */
+public class RSEPersistenceTestSuite {
+
+ /**
+ * Standard Java application main method. Allows to launch the test
+ * suite from outside as part of nightly runs, headless runs or other.
+ *
Note: Use only junit.textui.TestRunner
here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ *
+ * @param args The standard Java application command line parameters passed in. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + /** + * Combine all test into a suite and returns the test suite instance. + *
+ * Note: This method must be always called suite
! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!
+ *
+ * @return The test suite instance.
+ */
+ public static Test suite() {
+ TestSuite suite = new TestSuite("RSE Persistence Test Suite"); //$NON-NLS-1$
+ // add the single test suites to the overall one here.
+ suite.addTestSuite(RSEPersistenceTest.class);
+
+ return suite;
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionConstants.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionConstants.java
deleted file mode 100644
index 040bada68a7..00000000000
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/* *******************************************************************************
- * Copyright (c) 2006 IBM Corporation. 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:
- * Don Yantzi (IBM) - initial contribution.
- * David Dykstal (IBM) - initial contribution.
- * *******************************************************************************/
-package org.eclipse.rse.tests.systems.connection;
-
-/**
- * Constants used to index into the SystemConnectionTests.properties file
- */
-public interface ConnectionConstants {
-
- public static final String DEFAULT_IP_NAME = "default_ip_name";
- public static final String DEFAULT_SYSTEM_TYPE= "default_system_type";
-
- public static final String DEFAULT_PROFILE_NAME = "default_profile_name";
- public static final String DEFAULT_HOST_NAME = "default_host_name";
-
- public static final String DEFAULT_USERID = "default_userid";
- public static final String DEFAULT_PASSWORD = "default_password";
-
-}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTestSuite.java
deleted file mode 100644
index 6b05c7dd8fc..00000000000
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/connection/ConnectionTestSuite.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/* *******************************************************************************
- * Copyright (c) 2006 IBM Corporation. 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 contribution.
- * *******************************************************************************/
-package org.eclipse.rse.tests.systems.connection;
-
-import junit.framework.TestSuite;
-
-import org.eclipse.rse.tests.framework.ITestSuiteProvider;
-
-public class ConnectionTestSuite implements ITestSuiteProvider {
-
- public TestSuite getSuite(String arg) {
- TestSuite suite = new TestSuite("Connection Test");
- suite.addTest(new ConnectionTest("testConnect"));
- suite.addTest(new ConnectionTest("testResolveFilterString"));
- return suite;
- }
-
-}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestPlugin.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestPlugin.java
deleted file mode 100644
index ec64a630251..00000000000
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/core/SystemTestPlugin.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/* *******************************************************************************
- * Copyright (c) 2006 IBM Corporation. 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:
- * Don Yantzi (IBM) - initial contribution.
- * David Dykstal (IBM) - initial contribution.
- * *******************************************************************************/
-package org.eclipse.rse.tests.systems.core;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class SystemTestPlugin extends AbstractUIPlugin {
-
- private static SystemTestPlugin singleton = null;
-
- /**
- * Constructs a new plugin.
- * The plugin should be constructed by the workbench exactly once,
- * so it is saved as a singleton.
- */
- public SystemTestPlugin() {
- super();
- singleton = this;
- }
-
- /**
- * @return the singleton plugin.
- */
- public static SystemTestPlugin getDefault() {
- return singleton;
- }
-
-}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTest.java
deleted file mode 100644
index f9f5dd619f4..00000000000
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.rse.tests.systems.persistence;
-
-import org.eclipse.rse.core.model.ISystemProfile;
-import org.eclipse.rse.tests.framework.AnnotatingTestCase;
-import org.eclipse.rse.tests.systems.core.SystemTestUtil;
-
-public class PersistenceTest extends AnnotatingTestCase {
-
- public PersistenceTest(String name) {
- super(name);
- }
-
- public void testHostCreation() throws Exception {
- ISystemProfile profile = SystemTestUtil.findProfile("TestProfile");
- if (profile == null) {
- SystemTestUtil.createProfile("TestProfile");
- }
- SystemTestUtil.createHost("TestProfile", "TestHost1", "localhost", "Unix", "userid", "password");
- SystemTestUtil.createHost("TestProfile", "TestHost2", "localhost", "Unix", "userid", "password");
- SystemTestUtil.createHost("TestProfile", "TestHost3", "localhost", "Unix", "userid", "password");
- SystemTestUtil.createHost("TestProfile", "TestHost4", "localhost", "Unix", "userid", "password");
- SystemTestUtil.createHost("TestProfile", "TestHost5", "localhost", "Unix", "userid", "password");
- SystemTestUtil.createHost("TestProfile", "TestHost6", "localhost", "Unix", "userid", "password");
- }
-
- public void testHostDeletion() throws Exception {
- SystemTestUtil.deleteHost("TestProfile", "TestHost1");
- SystemTestUtil.deleteHost("TestProfile", "TestHost2");
- SystemTestUtil.deleteHost("TestProfile", "TestHost3");
- SystemTestUtil.deleteHost("TestProfile", "TestHost4");
- SystemTestUtil.deleteHost("TestProfile", "TestHost5");
- SystemTestUtil.deleteHost("TestProfile", "TestHost6");
- }
-
-}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTestSuite.java
deleted file mode 100644
index 820c04b9861..00000000000
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/systems/persistence/PersistenceTestSuite.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package org.eclipse.rse.tests.systems.persistence;
-
-import junit.framework.TestSuite;
-
-import org.eclipse.rse.tests.framework.ITestSuiteProvider;
-
-public class PersistenceTestSuite implements ITestSuiteProvider {
-
- public TestSuite getSuite(String argument) {
- TestSuite suite = new TestSuite("Persistence Test Suite");
- if (argument == null || argument.equals("create")) {
- suite.addTest(new PersistenceTest("testHostCreation"));
- }
- if (argument == null || argument.equals("delete")) {
- suite.addTest(new PersistenceTest("testHostDeletion"));
- }
- return suite;
- }
-
-}
diff --git a/rse/tests/org.eclipse.rse.tests/test.xml b/rse/tests/org.eclipse.rse.tests/test.xml
index 7462c094272..f719961b5b1 100644
--- a/rse/tests/org.eclipse.rse.tests/test.xml
+++ b/rse/tests/org.eclipse.rse.tests/test.xml
@@ -1,14 +1,19 @@
+
+