mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 07:05:24 +02:00
[240729] More flexible disabling of testcases
This commit is contained in:
parent
13fce66f31
commit
464ddfc950
24 changed files with 1383 additions and 1085 deletions
|
@ -1,5 +1,5 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2001, 2007 IBM Corporation and others.
|
||||
# Copyright (c) 2001, 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
|
||||
|
@ -8,6 +8,7 @@
|
|||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
# Uwe Stieber (Wind River) - Rework test data location & connection management
|
||||
# Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
|
||||
###############################################################################
|
||||
|
||||
#
|
||||
|
@ -36,6 +37,23 @@ TestSubsystemTestCase.testAddAndDeleteDeepNodes=true
|
|||
TestSubsystemTestCase.testAddAndDeleteFlatNodes=true
|
||||
TestSubsystemTestCase.testBugzilla170728=true
|
||||
|
||||
#
|
||||
# The following section controls enablement of test cases by target or client platform.
|
||||
# Uncomment a line to disable running unit tests on the specified target connection.
|
||||
# Target connections refer to connection properties files, e.g. ftp --> ftpConnection.properties
|
||||
# For active target connections, the Properties file must contain valid connection properties.
|
||||
#
|
||||
*.ftp=true
|
||||
*.ftpWindows=true
|
||||
*.linux=true
|
||||
*.local=true
|
||||
*.ssh=true
|
||||
*.windows=true
|
||||
|
||||
Windows_XP.x86.*=true
|
||||
Linux.x86.*=true
|
||||
Linux.ppc.*=true
|
||||
|
||||
#
|
||||
# The following section contains externalized string for the single classes
|
||||
#
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
|
@ -28,11 +28,11 @@ import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
|||
* Each testcase method should leave the host pool as it was prior to running the method.
|
||||
*/
|
||||
public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||
|
||||
|
||||
static final int NUMBER_OF_HOSTS = 6; // number of hosts
|
||||
private IHost hostArray[] = null;
|
||||
private ISystemRegistry registry = null;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
registry = RSECorePlugin.getTheSystemRegistry();
|
||||
createHosts();
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
|
@ -49,9 +49,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
deleteHosts();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
||||
public void testMoveOneUp() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
||||
IHost[] hosts = new IHost[] {host};
|
||||
|
@ -62,9 +64,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
registry.moveHosts("TestProfile", hosts, 1);
|
||||
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
||||
}
|
||||
|
||||
|
||||
public void testMoveManyUp() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost[] hosts = new IHost[] {hostArray[NUMBER_OF_HOSTS - 1], hostArray[NUMBER_OF_HOSTS - 2]};
|
||||
registry.moveHosts("TestProfile", hosts, -2);
|
||||
|
@ -80,6 +84,8 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testMoveFirstUp() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost host = hostArray[0];
|
||||
assertEquals(0, registry.getHostPosition(host));
|
||||
|
@ -90,6 +96,8 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testMoveOneDown() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost host = hostArray[1]; // second in the list
|
||||
assertEquals(1, registry.getHostPosition(host));
|
||||
|
@ -99,9 +107,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
registry.moveHosts("TestProfile", hosts, -1);
|
||||
assertEquals(1, registry.getHostPosition(host));
|
||||
}
|
||||
|
||||
|
||||
public void testMoveManyDown() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost[] hosts = new IHost[] {hostArray[0], hostArray[2], hostArray[4]};
|
||||
assertEquals(0, registry.getHostPosition(hostArray[0]));
|
||||
|
@ -119,8 +129,10 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testMoveLastDown() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
||||
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
||||
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
||||
IHost[] hosts = new IHost[] {host};
|
||||
registry.moveHosts("TestProfile", hosts, 1); // should not actually move
|
||||
|
@ -129,16 +141,18 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testNoHost() throws Exception {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
checkPrecondition();
|
||||
IHost[] hosts = new IHost[] {};
|
||||
registry.moveHosts("TestProfile", hosts, -1); // should not fail
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the test hosts.
|
||||
*/
|
||||
private void createHosts() throws Exception {
|
||||
|
||||
|
||||
hostArray = new IHost[NUMBER_OF_HOSTS];
|
||||
|
||||
/* Common host properties */
|
||||
|
@ -149,28 +163,28 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
|||
properties.setProperty(IRSEConnectionProperties.ATTR_USERID, "userid"); //$NON-NLS-1$
|
||||
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$
|
||||
IRSEConnectionProperties props = getConnectionManager().loadConnectionProperties(properties, false);
|
||||
|
||||
|
||||
for (int i = 0; i < hostArray.length; i++) {
|
||||
String hostName = getHostName(i);
|
||||
properties.setProperty(IRSEConnectionProperties.ATTR_NAME, hostName); //$NON-NLS-1$
|
||||
properties.setProperty(IRSEConnectionProperties.ATTR_NAME, hostName);
|
||||
hostArray[i] = getConnectionManager().findOrCreateConnection(props);
|
||||
assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), hostArray[i]); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void deleteHosts() {
|
||||
for (int i = 1; i < hostArray.length; i++) {
|
||||
registry.deleteHost(hostArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void checkPrecondition() {
|
||||
for (int i = 0; i < hostArray.length; i++) {
|
||||
assertEquals("Precondition check failed", i, registry.getHostPosition(hostArray[i]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getHostName(int i) {
|
||||
String hostName = "TestHost" + Integer.toString(i);
|
||||
return hostName;
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
/********************************************************************************
|
||||
* 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
|
||||
*
|
||||
* 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) - fix build against 3.2.1, fix javadoc errors
|
||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||
* Martin Oberhuber (Wind River) - [219086] flush event queue to shield tests from each other
|
||||
* Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.tests.core;
|
||||
|
||||
|
@ -66,10 +67,17 @@ import org.osgi.framework.Bundle;
|
|||
public class RSECoreTestCase extends TestCase {
|
||||
// Test properties storage.
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
|
||||
// Internal. Used to remember view zoom state changes.
|
||||
private final String PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED = "rseSystemsViewZoomStateChanged"; //$NON-NLS-1$
|
||||
|
||||
|
||||
// Target name, if set.
|
||||
private String targetName = null;
|
||||
|
||||
// Client name, if set.
|
||||
private static final String defaultClientName = (System.getProperty("os.name") + '.' + System.getProperty("os.arch")).replace(' ', '_');
|
||||
private String clientName = defaultClientName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
|
@ -79,7 +87,7 @@ public class RSECoreTestCase extends TestCase {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param name The test name.
|
||||
*/
|
||||
public RSECoreTestCase(String name) {
|
||||
|
@ -90,8 +98,30 @@ public class RSECoreTestCase extends TestCase {
|
|||
initializeProperties();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the target platform against which this test runs. Must be
|
||||
* done from Constructor. Used to filter tests in {@link #isTestDisabled()}.
|
||||
*
|
||||
* @param targetName target platform name.
|
||||
*/
|
||||
public void setTargetName(String targetName) {
|
||||
this.targetName = targetName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the client platform on which this test runs. Usually not
|
||||
* necessary, since the default is computed automatically. If set, this must
|
||||
* be done from the Constructor. Used to filter tests in
|
||||
* {@link #isTestDisabled()}.
|
||||
*
|
||||
* @param clientName client platform name.
|
||||
*/
|
||||
public void setClientName(String clientName) {
|
||||
this.clientName = clientName;
|
||||
}
|
||||
|
||||
// ***** Test properties management and support methods *****
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the core test properties. Override to modify core
|
||||
* test properties or to add additional ones.
|
||||
|
@ -103,20 +133,20 @@ public class RSECoreTestCase extends TestCase {
|
|||
setProperty(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, false);
|
||||
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enables or disables the specified property.
|
||||
*
|
||||
*
|
||||
* @param key The key of the property to enable or disable. Must be not <code>null</code>!
|
||||
* @param enable Specify <code>true</code> to enable the property, <code>false</code> 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 <code>null</code>!
|
||||
* @param value The value to compare the property with.
|
||||
* @return <code>true</code> if the property is equal to the specified value, <code>false</code> 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 <code>null</code>, the specified property will be removed.
|
||||
*
|
||||
*
|
||||
* @param key The key of the property to set. Must be not <code>null</code>!
|
||||
* @param value The string value to set or <code>null</code>.
|
||||
*/
|
||||
|
@ -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 <code>null</code>, this method returns <code>true</code> 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 <code>null</code>!
|
||||
* @param value The value to compare the property with or <code>null</code>
|
||||
* @return <code>true</code> if the property is equal to the specified value
|
||||
* @return <code>true</code> if the property is equal to the specified value
|
||||
* or the specified value is <code>null</code> and the property does not exist,
|
||||
* <code>false</code> 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 <code>null</code>.
|
||||
* @return The property value or <code>null</code> 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 <code>null</code>.
|
||||
*/
|
||||
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 <code>null</code>.
|
||||
*/
|
||||
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 <code>junit.
|
||||
* framework.TestCase.run(TestResult) implementation.
|
||||
*
|
||||
*
|
||||
* @param result The test result object the test is reporting failures to. Must be not <code>null</code>.
|
||||
*/
|
||||
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 <code>null</code>!
|
||||
* @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 <code>null</code>!
|
||||
* @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.
|
||||
* <p>
|
||||
* 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 <code>null</code>.
|
||||
* @param perspectiveId The unique perspective id within the view should be searched. Must be not <code>null</code>.
|
||||
* @return The view reference instance to the view or <code>null</code> 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 <code>null</code>.
|
||||
* @param perspectiveId The unique perspective id within the view should be activated. Must be not <code>null</code>.
|
||||
* @return The view part instance to the view or <code>null</code> 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 <code>null</code>.
|
||||
* @param perspectiveId The unique perspective id the view should be hidden from. Must be not <code>null</code>.
|
||||
*/
|
||||
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 (<i>org.eclipse.rse.tests plugin location + sub
|
||||
|
@ -630,16 +735,16 @@ public class RSECoreTestCase extends TestCase {
|
|||
* </ul><br>
|
||||
* If the calculated test data location does not pass these conditions, the
|
||||
* method will return <code>null</code>.
|
||||
*
|
||||
*
|
||||
* @param relativePath A path relative to the test data location root path. Must be not <code>null</code!
|
||||
* @param appendHostOS <code>True</code> if to append the current execution host operating system string, <code>false</code> otherwise.
|
||||
*
|
||||
*
|
||||
* @return The root path to the test data location or <code>null</code> 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 <code>null</code>.
|
||||
*/
|
||||
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
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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 <code>RSEWaitAndDispatchUtil</code> 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$
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ss.length; i++) {
|
||||
if (ss[i] instanceof FileServiceSubSystem) {
|
||||
fss = (IRemoteFileSubSystem)ss[i];
|
||||
return fss;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void testCreateFileFTP() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
|
||||
host = getFTPHost();
|
||||
host = getFTPHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
createFileAndAssertProperties();
|
||||
}
|
||||
|
||||
|
||||
public void testCreateFileLinux() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
|
||||
// Lookup and create the connection now if necessary
|
||||
host = getLinuxHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
createFileAndAssertProperties();
|
||||
}
|
||||
|
||||
|
||||
public void testCreateFileSSH() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
|
||||
host = getSSHHost();
|
||||
host = getSSHHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
createFileAndAssertProperties();
|
||||
}
|
||||
|
||||
|
||||
public void testCreateFileWindows() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
|
||||
host = getWindowsHost();
|
||||
host = getWindowsHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
createFileAndAssertProperties();
|
||||
}
|
||||
|
||||
|
||||
public void createFileAndAssertProperties() throws Exception {
|
||||
String SYSTEM_TYPE = host.getSystemType().getLabel();
|
||||
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
||||
|
||||
|
||||
// Need to create a temporary directory for the new file to be created in.
|
||||
// this is to ensure we don't overwrite any previous files.
|
||||
inputFss.connect(new NullProgressMonitor(), false);
|
||||
|
@ -98,7 +101,7 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
|||
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
||||
tempDirectory = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
||||
|
||||
|
||||
tempDirPath = tempDirectory.getAbsolutePath();
|
||||
IHostFile hostfile = inputFss.getFileService().createFile(tempDirPath, fileName, new NullProgressMonitor());
|
||||
assertTrue(SYSTEM_TYPE + ": hostfile doesn't exist.", hostfile.exists());
|
||||
|
@ -110,11 +113,11 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
|||
assertEquals(SYSTEM_TYPE + ": file size's do not match.", 0, hostfile.getSize());
|
||||
long modDate = hostfile.getModifiedDate();
|
||||
assertTrue(SYSTEM_TYPE + ": modification date is not greater than 0.", modDate > 0);
|
||||
|
||||
|
||||
// perform cleanup, so EFS uses the right file service next time
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
||||
public void cleanup() throws Exception {
|
||||
if (host != null) {
|
||||
if (tempDirectory != null) {
|
||||
|
@ -127,10 +130,10 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
|||
host = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
cleanup();
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||
* David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect()
|
||||
|
@ -30,7 +30,6 @@ import org.eclipse.rse.internal.services.files.ftp.FTPService;
|
|||
import org.eclipse.rse.services.files.IFileService;
|
||||
import org.eclipse.rse.services.files.IHostFile;
|
||||
import org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration;
|
||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
|
||||
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
|
||||
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
||||
|
@ -42,7 +41,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
|
|||
public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||
private ISubSystem subSystem;
|
||||
private IHost connection;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
|
@ -56,7 +55,7 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
|
||||
subSystem = null;
|
||||
connection = null;
|
||||
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
|
@ -65,11 +64,12 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public void testFTPReadAccessToRemoteHost() {
|
||||
//-test-author-:UweStieber
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FTPFileSubsystemTestCase.testFTPReadAccessToRemoteHost")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
|
||||
assertNotNull("Failed to get RSE system registry instance!", systemRegistry); //$NON-NLS-1$
|
||||
|
||||
|
||||
// Calculate the location of the test connection properties
|
||||
IPath location = getTestDataLocation("testFTPReadAccessToRemoteHost", false); //$NON-NLS-1$
|
||||
assertNotNull("Cannot locate test data! Missing test data location?", location); //$NON-NLS-1$
|
||||
|
@ -77,20 +77,20 @@ public class FTPFileSubsystemTestCase 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 properties from the calculated location without backing up defaults
|
||||
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
|
||||
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
|
||||
|
||||
|
||||
// Lookup and create the connection now if necessary
|
||||
connection = getConnectionManager().findOrCreateConnection(properties);
|
||||
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$
|
||||
// expand the connection in the UI
|
||||
RSEUIPlugin.getTheSystemRegistryUI().expandHost(connection);
|
||||
|
||||
|
||||
Exception exception = null;
|
||||
String cause = null;
|
||||
|
||||
|
||||
subSystem = null;
|
||||
try {
|
||||
subSystem = getConnectionManager().getFileSubSystem(connection, "ftp.files"); //$NON-NLS-1$
|
||||
|
@ -103,12 +103,12 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
|
||||
ISubSystemConfiguration configuration = subSystem.getSubSystemConfiguration();
|
||||
assertNotNull("Failed to get ftp.files subsystem configuration instance!", configuration); //$NON-NLS-1$
|
||||
|
||||
|
||||
// The ftp.files subsystem supports filtering, therefor ISubSystem.getChildren() is expected
|
||||
// to return a non null value.
|
||||
assertTrue("Unexpected return value false for ftp.files subsystem configuration supportFilters()!", configuration.supportsFilters()); //$NON-NLS-1$
|
||||
assertNotNull("Unexpected return value null for ftp.files subsystem getChildren()!", subSystem.getChildren()); //$NON-NLS-1$
|
||||
|
||||
|
||||
// get access to the services
|
||||
assertTrue("ftp.files subsystem configuration instance is not of expected type FileServiceSubSystemConfiguration!", configuration instanceof FTPFileSubSystemConfiguration); //$NON-NLS-1$
|
||||
FTPFileSubSystemConfiguration ftpConfiguration = (FTPFileSubSystemConfiguration)configuration;
|
||||
|
@ -116,12 +116,12 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
assertNotNull("Failed to get IFileService instance from ftp.files subsystem configuration!", service); //$NON-NLS-1$
|
||||
assertTrue("IFileService instance is not of expected type FTPService!", service instanceof FTPService); //$NON-NLS-1$
|
||||
final FTPService ftpService = (FTPService)service;
|
||||
|
||||
|
||||
// configure the service to use passive ftp
|
||||
IPropertySet set = new PropertySet("testFTPReadAccessToRemoteHost"); //$NON-NLS-1$
|
||||
set.addProperty("passive", "true"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
ftpService.setPropertySet(set);
|
||||
|
||||
|
||||
// we expect that the subsystem is not connected yet
|
||||
assertFalse("ftp.files subsystem is unexpectedly connected!", subSystem.isConnected()); //$NON-NLS-1$
|
||||
try {
|
||||
|
@ -138,20 +138,20 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
// if we could not connect in 10 sec. we give up here. The server might be not reachable
|
||||
// or exceeded the max number of connection or ... or ... or ... Just do not fail in this case.
|
||||
if (!subSystem.isConnected() || !ftpService.isConnected()) return;
|
||||
|
||||
|
||||
// expand the subsystem
|
||||
RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(subSystem);
|
||||
|
||||
|
||||
// now we have the service reference and can start reading things from the server
|
||||
IHostFile[] roots = ftpService.getRoots(new NullProgressMonitor());
|
||||
assertNotNull("Failed to get root nodes from ftp.files service!", roots); //$NON-NLS-1$
|
||||
|
||||
|
||||
FTPClient ftpClient = ftpService.getFTPClient();
|
||||
assertNotNull("Failed to get FTPClient instance!", ftpClient); //$NON-NLS-1$
|
||||
|
||||
|
||||
exception = null;
|
||||
cause = null;
|
||||
|
||||
|
||||
FTPFile[] files = null;
|
||||
try {
|
||||
files = ftpClient.listFiles();
|
||||
|
@ -161,7 +161,7 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
|||
}
|
||||
assertNull("Failed to list the files from ftp server " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME) + "! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
assertNotNull("Unexpected return value null for FTPClient.listFiles()!", files); //$NON-NLS-1$
|
||||
|
||||
|
||||
if (ftpService.isConnected()) ftpService.disconnect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -49,82 +49,102 @@ public class FileOutputStreamTestCase 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<ss.length; i++) {
|
||||
if (ss[i] instanceof FileServiceSubSystem) {
|
||||
fss = (IRemoteFileSubSystem)ss[i];
|
||||
return fss;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreAppendOutputStreamLocal() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getLocalSystemConnection();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.APPEND);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreAppendOutputStreamFTP() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getFTPHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.APPEND);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreAppendOutputStreamLinux() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getLinuxHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.APPEND);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreAppendOutputStreamWindows() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getWindowsHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.APPEND);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreAppendOutputStreamSSH() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getSSHHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.APPEND);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreOverwriteOutputStreamLocal() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getLocalSystemConnection();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.NONE);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreOverwriteOutputStreamFTP() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getFTPHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.NONE);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreOverwriteOutputStreamLinux() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getLinuxHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.NONE);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreOverwriteOutputStreamWindows() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getWindowsHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.NONE);
|
||||
}
|
||||
|
||||
|
||||
public void testRSEFileStoreOverwriteOutputStreamSSH() throws Exception {
|
||||
//-test-author-:KevinDoyle
|
||||
host = getSSHHost();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
outputStreamFileWriting(EFS.NONE);
|
||||
}
|
||||
|
||||
|
||||
public void outputStreamFileWriting(int options) throws Exception {
|
||||
// RSE URI: rse://SYSTEM_ADDRESS/PATH_TO_FIlE
|
||||
OutputStream outputStream = null;
|
||||
InputStream inputStream = null;
|
||||
|
||||
|
||||
// Create temporary folder
|
||||
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
||||
inputFss.connect(new NullProgressMonitor(), false);
|
||||
|
@ -134,37 +154,37 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
|||
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
||||
IRemoteFile targetDir = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
||||
tempDirectory = targetDir;
|
||||
|
||||
|
||||
String path = targetDir.getAbsolutePath();
|
||||
|
||||
|
||||
String systemType = host.getSystemType().getLabel();
|
||||
if (host.getSystemType().isWindows()) {
|
||||
path = path.replace('\\', '/');
|
||||
}
|
||||
path = fixPathForURI(path);
|
||||
URI uri = new URI("rse", host.getHostName(), path, null);
|
||||
|
||||
|
||||
IFileStore parentFS = RSEFileStore.getInstance(uri);
|
||||
createDir(parentFS, true);
|
||||
|
||||
|
||||
IFileStore childFS = parentFS.getChild("append.txt");
|
||||
|
||||
|
||||
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
||||
|
||||
String contents = getRandomString();
|
||||
byte[] readBytes = new byte[contents.length()];
|
||||
outputStream.write(contents.getBytes());
|
||||
outputStream.close();
|
||||
|
||||
|
||||
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
||||
inputStream.read(readBytes);
|
||||
|
||||
|
||||
String input = new String(readBytes);
|
||||
inputStream.close();
|
||||
assertTrue(systemType + ": Contents incorrect writing to an empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input));
|
||||
|
||||
|
||||
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
||||
|
||||
|
||||
String write = " " + getRandomString();
|
||||
if ((options & EFS.APPEND) != 0) {
|
||||
contents += write;
|
||||
|
@ -173,23 +193,23 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
|||
}
|
||||
outputStream.write(write.getBytes());
|
||||
outputStream.close();
|
||||
|
||||
|
||||
readBytes = new byte[contents.length()];
|
||||
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
||||
inputStream.read(readBytes);
|
||||
|
||||
|
||||
input = new String(readBytes);
|
||||
inputStream.close();
|
||||
assertTrue(systemType + ": Contents incorrect writing to a non-empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input));
|
||||
// Cleanup, so IFileStore uses the correct connection next time.
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adapt a local file system path such that it can be used as
|
||||
* path in an URI. Converts path delimiters do '/' default
|
||||
* delimiter, and adds a slash in front if necessary.
|
||||
*
|
||||
* path in an URI. Converts path delimiters do '/' default
|
||||
* delimiter, and adds a slash in front if necessary.
|
||||
*
|
||||
* Copied from RSEFileSystemContributor as it's private
|
||||
* @param path the path to adapt
|
||||
* @return adapted path
|
||||
|
@ -212,7 +232,7 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
|||
//</adapted from org.eclipse.core.filesystem.URIUtil.toURI() Copyright(c) 2005, 2006 IBM>
|
||||
return pathBuf.toString();
|
||||
}
|
||||
|
||||
|
||||
public void cleanup() throws Exception {
|
||||
if (host != null) {
|
||||
if (tempDirectory != null) {
|
||||
|
@ -225,7 +245,7 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
|||
host = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
cleanup();
|
||||
super.tearDown();
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
* 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:
|
||||
*
|
||||
* Contributors:
|
||||
* Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.tests.subsystems.files;
|
||||
|
@ -23,26 +23,25 @@ import org.eclipse.rse.core.model.SystemWorkspaceResourceSet;
|
|||
import org.eclipse.rse.core.subsystems.ISystemDragDropAdapter;
|
||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||
|
||||
public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||
|
||||
protected String folderToCopyName1 = "RemoteSystemsConnections";
|
||||
protected String folderToCopyName2 = "6YLT5Xa";
|
||||
protected String folderToCopyName3 = "folderToCopy";
|
||||
|
||||
|
||||
protected String tarSourceFileName1;
|
||||
protected String tarSourceFileName2;
|
||||
|
||||
|
||||
protected String tarSourceFolderName1 = "META-INF";
|
||||
protected String tarSourceFolderName2 = "org";
|
||||
|
||||
|
||||
protected String tarSourceForOpenTest;
|
||||
protected String tarSourceForOpenFolderName1 = "META-INF";
|
||||
protected String tarSourceForOpenFolderName2 = "org";
|
||||
|
||||
|
||||
protected String testName;
|
||||
|
||||
|
||||
protected String fileContentString1 = "this is just some dummy content \n to a remote file \n to test an open operation";
|
||||
|
||||
/**
|
||||
|
@ -52,17 +51,17 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
public FileServiceArchiveBaseTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
public static IWorkspace getWorkspace() {
|
||||
return ResourcesPlugin.getWorkspace();
|
||||
}
|
||||
|
||||
|
||||
public void createSourceFolders() throws Exception
|
||||
{
|
||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||
IFileStore temp = createDir(tempPath, true);
|
||||
String content = getRandomString();
|
||||
|
||||
|
||||
// create the source folder used for copy or move
|
||||
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
||||
createDir(folderToCopy, true);
|
||||
|
@ -81,7 +80,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12aaaa, content);
|
||||
|
||||
|
||||
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
||||
createDir(aaaab, true);
|
||||
IFileStore features = aaaab.getChild("features");
|
||||
|
@ -94,15 +93,15 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12a, content);
|
||||
|
||||
|
||||
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12a1, content);
|
||||
|
||||
|
||||
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
||||
content = getRandomString();
|
||||
createFile(RSE_SDK_2_0RC1_zip, content);
|
||||
|
||||
|
||||
//now, copy folderToCopy into the folder in the remote system
|
||||
IRemoteFile sourceFolderToCopy3 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
||||
ISystemDragDropAdapter srcAdapter3 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy3).getAdapter(ISystemDragDropAdapter.class);
|
||||
|
@ -110,20 +109,20 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fromSet3.addResource(sourceFolderToCopy3);
|
||||
ISystemResourceSet tempObjects3 = srcAdapter3.doDrag(fromSet3, mon);
|
||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true);
|
||||
|
||||
|
||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||
fss.resolveFilterString(tempDir, null, mon);
|
||||
|
||||
|
||||
//Then, delete the temp folder in the junit workspace.
|
||||
temp.delete(EFS.NONE, mon);
|
||||
}
|
||||
|
||||
|
||||
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
||||
|
||||
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
||||
{
|
||||
|
||||
|
||||
String content = getRandomString();
|
||||
|
||||
|
||||
// create the source folder used for copy or move
|
||||
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
||||
createDir(folderToCopy, true);
|
||||
|
@ -142,7 +141,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12aaaa, content);
|
||||
|
||||
|
||||
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
||||
createDir(aaaab, true);
|
||||
IFileStore features = aaaab.getChild("features");
|
||||
|
@ -155,25 +154,25 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12a, content);
|
||||
|
||||
|
||||
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
||||
content = getRandomString();
|
||||
createFile(epdcdump01_hex12a1, content);
|
||||
|
||||
|
||||
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
||||
content = getRandomString();
|
||||
createFile(RSE_SDK_2_0RC1_zip, content);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void createTarSourceForOpen() throws Exception
|
||||
{
|
||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||
IFileStore temp = createDir(tempPath, true);
|
||||
String content = getRandomString();
|
||||
|
||||
|
||||
//Now, we need to construct a "source.tar" archive file
|
||||
//We will construct the content of the tar file in folders "META-INF" and "org"
|
||||
//Then we copy this folder into a tar file by RSE API.
|
||||
|
@ -183,7 +182,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore MANIFEST_MF = META_INF.getChild("MANIFEST.MF");
|
||||
content = fileContentString1;
|
||||
createFile(MANIFEST_MF, content);
|
||||
|
||||
|
||||
//create folder "org"
|
||||
IFileStore org = temp.getChild("org");
|
||||
createDir(org, true);
|
||||
|
@ -197,7 +196,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
createDir(core, true);
|
||||
IFileStore internal = dstore.getChild("internal");
|
||||
createDir(internal, true);
|
||||
|
||||
|
||||
//now create directory inside "core":
|
||||
IFileStore client = core.getChild("client");
|
||||
createDir(client, true);
|
||||
|
@ -214,7 +213,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Activator_java = core.getChild("Activator.java");
|
||||
content = fileContentString1;
|
||||
createFile(Activator_java, content);
|
||||
|
||||
|
||||
//now, some contents on client folder
|
||||
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
||||
content = getRandomString();
|
||||
|
@ -222,12 +221,12 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
||||
content = fileContentString1;
|
||||
createFile(ConnectionStatus_java, content);
|
||||
|
||||
|
||||
//now, some contents in java folder
|
||||
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
||||
content = getRandomString();
|
||||
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
||||
|
||||
|
||||
//now, some contents in miners folder
|
||||
IFileStore Miner_java = miners.getChild("Miner.java");
|
||||
content = getRandomString();
|
||||
|
@ -235,7 +234,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
||||
content = getRandomString();
|
||||
createFile(MinerThread_java, content);
|
||||
|
||||
|
||||
//now, some contents in model folder
|
||||
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
||||
content = getRandomString();
|
||||
|
@ -246,21 +245,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Handler_java = model.getChild("Handler.java");
|
||||
content = getRandomString();
|
||||
createFile(Handler_java, content);
|
||||
|
||||
|
||||
//now, some contents in server folder
|
||||
IFileStore Server_java = server.getChild("Server.java");
|
||||
content = getRandomString();
|
||||
createFile(Server_java, content);
|
||||
|
||||
|
||||
//now, some contents in util folder
|
||||
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
||||
content = fileContentString1;
|
||||
createFile(StringCompare_java, content);
|
||||
|
||||
|
||||
//now, create the contents in "internal" folder
|
||||
IFileStore core1 = internal.getChild("core");
|
||||
createDir(core1, true);
|
||||
|
||||
|
||||
//then create some folder in this "core" folder
|
||||
IFileStore client1 = core1.getChild("client");
|
||||
createDir(client1, true);
|
||||
|
@ -270,7 +269,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
createDir(server1, true);
|
||||
IFileStore util1 = core1.getChild("util");
|
||||
createDir(util1, true);
|
||||
|
||||
|
||||
//now, some contents on client folder
|
||||
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
||||
content = getRandomString();
|
||||
|
@ -278,8 +277,8 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
||||
content = getRandomString();
|
||||
createFile(ConnectionStatus_java1, content);
|
||||
|
||||
|
||||
|
||||
|
||||
//now, some contents in model folder
|
||||
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
||||
content = getRandomString();
|
||||
|
@ -290,17 +289,17 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
||||
content = getRandomString();
|
||||
createFile(Handler_java1, content);
|
||||
|
||||
|
||||
//now, some contents in server folder
|
||||
IFileStore Server_java1 = server1.getChild("Server.java");
|
||||
content = getRandomString();
|
||||
createFile(Server_java1, content);
|
||||
|
||||
|
||||
//now, some contents in util folder
|
||||
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
||||
content = getRandomString();
|
||||
createFile(StringCompare_java1, content);
|
||||
|
||||
|
||||
//now, copy META_INF into the folder in the remote system
|
||||
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName1, mon);
|
||||
assertNotNull(META_INF_folder);
|
||||
|
@ -309,7 +308,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fromSet.addResource(META_INF_folder);
|
||||
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
||||
|
||||
|
||||
//now, copy org into the folder in the remote system
|
||||
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName2, mon);
|
||||
assertNotNull(org_folder);
|
||||
|
@ -318,31 +317,31 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fromSet2.addResource(org_folder);
|
||||
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
||||
|
||||
|
||||
//now, create tar file in the host
|
||||
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceForOpenTest, false);
|
||||
assertNotNull(tarSource);
|
||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName1);
|
||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName1);
|
||||
assertNotNull(tarSourceFolder1);
|
||||
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName2);
|
||||
fss.copy(tarSourceFolder1, tarSource, tarSourceForOpenFolderName1, mon);
|
||||
fss.copy(tarSourceFolder2, tarSource, tarSourceForOpenFolderName2, mon);
|
||||
|
||||
|
||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||
fss.resolveFilterString(tempDir, null, mon);
|
||||
|
||||
|
||||
//Then, delete the temp folder in the junit workspace.
|
||||
temp.delete(EFS.NONE, mon);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void createSourceTarFiles() throws Exception
|
||||
{
|
||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||
IFileStore temp = createDir(tempPath, true);
|
||||
String content = getRandomString();
|
||||
|
||||
|
||||
//Now, we need to construct a "source.tar" archive file
|
||||
//We will construct the content of the tar file in folders "META-INF" and "org"
|
||||
//Then we copy this folder into a tar file by RSE API.
|
||||
|
@ -365,7 +364,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
createDir(core, true);
|
||||
IFileStore internal = dstore.getChild("internal");
|
||||
createDir(internal, true);
|
||||
|
||||
|
||||
//now create directory inside "core":
|
||||
IFileStore client = core.getChild("client");
|
||||
createDir(client, true);
|
||||
|
@ -382,7 +381,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Activator_java = core.getChild("Activator.java");
|
||||
content = getRandomString();
|
||||
createFile(Activator_java, content);
|
||||
|
||||
|
||||
//now, some contents on client folder
|
||||
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
||||
content = getRandomString();
|
||||
|
@ -390,12 +389,12 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
||||
content = getRandomString();
|
||||
createFile(ConnectionStatus_java, content);
|
||||
|
||||
|
||||
//now, some contents in java folder
|
||||
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
||||
content = getRandomString();
|
||||
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
||||
|
||||
|
||||
//now, some contents in miners folder
|
||||
IFileStore Miner_java = miners.getChild("Miner.java");
|
||||
content = getRandomString();
|
||||
|
@ -403,7 +402,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
||||
content = getRandomString();
|
||||
createFile(MinerThread_java, content);
|
||||
|
||||
|
||||
//now, some contents in model folder
|
||||
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
||||
content = getRandomString();
|
||||
|
@ -414,21 +413,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Handler_java = model.getChild("Handler.java");
|
||||
content = getRandomString();
|
||||
createFile(Handler_java, content);
|
||||
|
||||
|
||||
//now, some contents in server folder
|
||||
IFileStore Server_java = server.getChild("Server.java");
|
||||
content = getRandomString();
|
||||
createFile(Server_java, content);
|
||||
|
||||
|
||||
//now, some contents in util folder
|
||||
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
||||
content = getRandomString();
|
||||
createFile(StringCompare_java, content);
|
||||
|
||||
|
||||
//now, create the contents in "internal" folder
|
||||
IFileStore core1 = internal.getChild("core");
|
||||
createDir(core1, true);
|
||||
|
||||
|
||||
//then create some folder in this "core" folder
|
||||
IFileStore client1 = core1.getChild("client");
|
||||
createDir(client1, true);
|
||||
|
@ -438,7 +437,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
createDir(server1, true);
|
||||
IFileStore util1 = core1.getChild("util");
|
||||
createDir(util1, true);
|
||||
|
||||
|
||||
//now, some contents on client folder
|
||||
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
||||
content = getRandomString();
|
||||
|
@ -446,8 +445,8 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
||||
content = getRandomString();
|
||||
createFile(ConnectionStatus_java1, content);
|
||||
|
||||
|
||||
|
||||
|
||||
//now, some contents in model folder
|
||||
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
||||
content = getRandomString();
|
||||
|
@ -458,17 +457,17 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
||||
content = getRandomString();
|
||||
createFile(Handler_java1, content);
|
||||
|
||||
|
||||
//now, some contents in server folder
|
||||
IFileStore Server_java1 = server1.getChild("Server.java");
|
||||
content = getRandomString();
|
||||
createFile(Server_java1, content);
|
||||
|
||||
|
||||
//now, some contents in util folder
|
||||
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
||||
content = getRandomString();
|
||||
createFile(StringCompare_java1, content);
|
||||
|
||||
|
||||
//now, copy META_INF into the folder in the remote system
|
||||
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName1, mon);
|
||||
assertNotNull(META_INF_folder);
|
||||
|
@ -477,7 +476,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fromSet.addResource(META_INF_folder);
|
||||
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
||||
|
||||
|
||||
//now, copy org into the folder in the remote system
|
||||
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName2, mon);
|
||||
assertNotNull(org_folder);
|
||||
|
@ -486,21 +485,22 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fromSet2.addResource(org_folder);
|
||||
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
||||
|
||||
|
||||
//now, create tar file in the host
|
||||
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceFileName1, false);
|
||||
assertNotNull(tarSource);
|
||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName1);
|
||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName1);
|
||||
assertNotNull(tarSourceFolder1);
|
||||
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName2);
|
||||
fss.copy(tarSourceFolder1, tarSource, tarSourceFolderName1, mon);
|
||||
fss.copy(tarSourceFolder2, tarSource, tarSourceFolderName2, mon);
|
||||
}
|
||||
|
||||
|
||||
public void testCreateTarFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//Create the zip file first.
|
||||
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
||||
assertNotNull(newArchiveFile);
|
||||
|
@ -509,73 +509,74 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
assertTrue(newArchiveFile.canWrite());
|
||||
assertEquals(newArchiveFile.getName(), testName);
|
||||
assertEquals(newArchiveFile.getParentPath(), tempDirPath);
|
||||
|
||||
|
||||
//fss.resolveFilterString(filterString, monitor)
|
||||
|
||||
|
||||
//Now, we want to create a text file inside.
|
||||
String childName = "aaa.txt";
|
||||
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||
assertNotNull(file1);
|
||||
|
||||
|
||||
childName = "bbb.txt";
|
||||
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||
assertNotNull(file2);
|
||||
|
||||
|
||||
//Create a folder
|
||||
childName = "folder1";
|
||||
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
||||
assertNotNull(folder1);
|
||||
|
||||
|
||||
//Now, check the contents
|
||||
String[] namesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
||||
int[] typesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||
checkFolderContents(newArchiveFile, namesToCheck, typesToCheck);
|
||||
|
||||
|
||||
//Now, create some files inside the folder.
|
||||
String secondLevelChildName = "ccc.exe";
|
||||
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||
assertNotNull(levelTwoChild1);
|
||||
|
||||
|
||||
secondLevelChildName = "ddd.bat";
|
||||
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||
assertNotNull(levelTwoChild2);
|
||||
|
||||
|
||||
secondLevelChildName = "another Folder"; //folder with space
|
||||
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
||||
assertNotNull(levelTwoChild3);
|
||||
|
||||
|
||||
//Now, check the contents
|
||||
String[] namesToCheck1 = {"ccc.exe", "ddd.bat", "another Folder"};
|
||||
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||
checkFolderContents(folder1, namesToCheck1, typesToCheck1);
|
||||
}
|
||||
|
||||
|
||||
public void testCopyToTarArchiveFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createSourceTarFiles();
|
||||
createSourceFolders();
|
||||
|
||||
|
||||
String tarTargetFileName = tarSourceFileName1;
|
||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||
assertNotNull(targetTarFile);
|
||||
|
||||
|
||||
String sourceFolderName = folderToCopyName3;
|
||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
||||
assertNotNull(sourceFolder);
|
||||
|
||||
|
||||
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
||||
fss.copy(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
||||
|
||||
|
||||
Object theCopiedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
||||
|
||||
|
||||
assertNotNull(theCopiedChild);
|
||||
|
||||
|
||||
//Also make sure the copied child has the right contents.
|
||||
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||
|
||||
|
||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck);
|
||||
}
|
||||
|
@ -584,29 +585,30 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testCopyTarVirtualFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createSourceTarFiles();
|
||||
|
||||
|
||||
String sourceFileName = tarSourceFileName1;
|
||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||
assertNotNull(sourceTarFile);
|
||||
|
||||
|
||||
//then, create a folder inside the tempDir
|
||||
String folderName = "folder1";
|
||||
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
||||
assertNotNull(folder1);
|
||||
|
||||
|
||||
//Get one of its fourth level children, and copy the folder to there.
|
||||
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||
assertNotNull(firstLevelChild);
|
||||
|
||||
|
||||
fss.copy(firstLevelChild, folder1, tarSourceFolderName1, mon);
|
||||
|
||||
|
||||
Object copiedVirtualFolder = getChildFromFolder(folder1, tarSourceFolderName1);
|
||||
assertNotNull(copiedVirtualFolder);
|
||||
|
||||
|
||||
String[] contents = {"MANIFEST.MF"};
|
||||
int[] typesToCheck = {TYPE_FILE};
|
||||
checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||
|
@ -615,32 +617,33 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testMoveToTarArchiveFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createSourceTarFiles();
|
||||
createSourceFolders();
|
||||
|
||||
|
||||
String tarTargetFileName = tarSourceFileName1;
|
||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||
assertNotNull(targetTarFile);
|
||||
|
||||
|
||||
String sourceFolderName = folderToCopyName3;
|
||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
||||
assertNotNull(sourceFolder);
|
||||
|
||||
|
||||
fss.move(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
||||
|
||||
|
||||
Object theMovedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
||||
|
||||
|
||||
assertNotNull(theMovedChild);
|
||||
|
||||
|
||||
//Also make sure the copied child has the right contents.
|
||||
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||
|
||||
|
||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||
checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck);
|
||||
|
||||
|
||||
//make sure the original folder is gone.
|
||||
Object originalSource = getChildFromFolder(tempDir, sourceFolderName);
|
||||
assertNull(originalSource);
|
||||
|
@ -650,35 +653,36 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testMoveTarVirtualFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createSourceTarFiles();
|
||||
|
||||
|
||||
String sourceFileName = tarSourceFileName1;
|
||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||
assertNotNull(sourceTarFile);
|
||||
|
||||
|
||||
//then, create a folder inside the tempDir
|
||||
//then, create a folder inside the tempDir
|
||||
String folderName = "folder1";
|
||||
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
||||
assertNotNull(folder1);
|
||||
|
||||
|
||||
//Now, copy one of the folder from the zip file into folder1
|
||||
String movedFolderName = tarSourceFolderName1;
|
||||
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||
assertNotNull(firstLevelChild);
|
||||
fss.move(firstLevelChild, folder1, movedFolderName, mon);
|
||||
|
||||
|
||||
Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName);
|
||||
|
||||
|
||||
assertNotNull(movedVirtualFolder);
|
||||
|
||||
|
||||
String[] contents = {"MANIFEST.MF"};
|
||||
int[] typesToCheck = {TYPE_FILE};
|
||||
checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck);
|
||||
|
||||
|
||||
//Now, make sure the moved virtual folder is gone from its original zip file
|
||||
IRemoteFile tmp = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||
assertNull(tmp);
|
||||
|
@ -687,59 +691,60 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testRenameTarVirtualFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//Create the zip file first.
|
||||
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
||||
|
||||
|
||||
//Now, we want to create a text file inside.
|
||||
String childName = "aaa.txt";
|
||||
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||
assertNotNull(file1);
|
||||
|
||||
|
||||
childName = "bbb.txt";
|
||||
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||
assertNotNull(file2);
|
||||
|
||||
|
||||
//Create a folder
|
||||
childName = "folder1";
|
||||
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
||||
assertNotNull(folder1);
|
||||
|
||||
|
||||
//Now, check the contents
|
||||
String[] levelOneNamesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
||||
int[] levalOneTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||
checkFolderContents(newArchiveFile, levelOneNamesToCheck, levalOneTypesToCheck);
|
||||
|
||||
|
||||
//Now, create some files inside the folder.
|
||||
String secondLevelChildName = "ccc.exe";
|
||||
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||
assertNotNull(levelTwoChild1);
|
||||
|
||||
|
||||
secondLevelChildName = "ddd.bat";
|
||||
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||
assertNotNull(levelTwoChild2);
|
||||
|
||||
|
||||
secondLevelChildName = "another Folder"; //folder with space
|
||||
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
||||
assertNotNull(levelTwoChild3);
|
||||
|
||||
|
||||
//Now, check the contents
|
||||
String[] levelTwoNamesToCheck = {"ccc.exe", "ddd.bat", "another Folder"};
|
||||
int[] levalTwoTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||
checkFolderContents(folder1, levelTwoNamesToCheck, levalTwoTypesToCheck);
|
||||
|
||||
|
||||
//Now rename one of the text file in the first level:
|
||||
IRemoteFile childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "aaa.txt");
|
||||
fss.rename(childToRename, "aaa1.txt", mon);
|
||||
//Now rename one of the folder in the first level
|
||||
childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder1");
|
||||
fss.rename(childToRename, "folder2", mon);
|
||||
|
||||
|
||||
//Check the result of rename
|
||||
String[] newLevelOneNamesToCheck = {"aaa1.txt", "bbb.txt", "folder2"};
|
||||
checkFolderContents(newArchiveFile, newLevelOneNamesToCheck, levalOneTypesToCheck);
|
||||
|
||||
|
||||
//Now rename one of the text file in the second level:
|
||||
IRemoteFile thisFolder = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder2");
|
||||
childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "ddd.bat");
|
||||
|
@ -747,7 +752,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
//Now rename one of the folder in the second level
|
||||
childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "another Folder");
|
||||
fss.rename(childToRename, "some folder$", mon);
|
||||
|
||||
|
||||
//Check the result of rename
|
||||
String[] newLevelTwoNamesToCheck = {"ccc.exe", "ddd1.bat", "some folder$"};
|
||||
checkFolderContents(thisFolder, newLevelTwoNamesToCheck, levalTwoTypesToCheck);
|
||||
|
@ -755,15 +760,16 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testDeleteTarVirtualFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createSourceTarFiles();
|
||||
|
||||
|
||||
String sourceFileName = tarSourceFileName1;
|
||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||
assertNotNull(sourceTarFile);
|
||||
|
||||
|
||||
//delete a file from level 2
|
||||
String parentForFileToDeleteName ="META-INF";
|
||||
IRemoteFile parentForFileToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForFileToDeleteName);
|
||||
|
@ -775,50 +781,50 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
fss.delete(fileToToDelete, mon);
|
||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||
assertNull(fileToToDelete);
|
||||
|
||||
|
||||
//then, get directory "java" under org/eclipse/dstore/core
|
||||
String parentForDirectoryToDeleteName ="org";
|
||||
IRemoteFile parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForDirectoryToDeleteName);
|
||||
assertNotNull(parentForDirectoryToDelete);
|
||||
|
||||
|
||||
parentForDirectoryToDeleteName ="eclipse";
|
||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||
assertNotNull(parentForDirectoryToDelete);
|
||||
|
||||
|
||||
parentForDirectoryToDeleteName ="dstore";
|
||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||
assertNotNull(parentForDirectoryToDelete);
|
||||
|
||||
|
||||
parentForDirectoryToDeleteName ="core";
|
||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||
assertNotNull(parentForDirectoryToDelete);
|
||||
|
||||
|
||||
String directoryToDeleteName = "java";
|
||||
IRemoteFile directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||
//Now, delete this directory
|
||||
fss.delete(directoryToDelete, mon);
|
||||
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||
|
||||
|
||||
//check result of this operation
|
||||
String[] contents = {"client", "miners", "model", "server", "util", "Activator.java"};
|
||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||
checkFolderContents(parentForDirectoryToDelete, contents, typesToCheck);
|
||||
|
||||
|
||||
//And check this directory is not there any more.
|
||||
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||
assertNull(directoryToDelete);
|
||||
|
||||
|
||||
//Now, delete some files and folder inside the a virtual folder.
|
||||
parentForFileToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, "model");
|
||||
deleteFileName = "DE.java";
|
||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||
assertNotNull(fileToToDelete);
|
||||
|
||||
|
||||
fss.delete(fileToToDelete, mon);
|
||||
|
||||
|
||||
//check the result
|
||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||
|
||||
|
||||
assertNull(fileToToDelete);
|
||||
}
|
||||
|
||||
|
@ -826,20 +832,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
public void testCopyBatchToTarArchiveFile() throws Exception {
|
||||
//-test-author-:XuanChen
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
createSourceTarFiles();
|
||||
createSourceFolders();
|
||||
|
||||
|
||||
String tarTargetFileName = tarSourceFileName1;
|
||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||
assertNotNull(targetTarFile);
|
||||
|
||||
|
||||
//Now, copy the source folder.
|
||||
String sourceFolderName = folderToCopyName3;
|
||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir,sourceFolderName);
|
||||
assertNotNull(sourceFolder);
|
||||
|
||||
|
||||
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
||||
IRemoteFile[] sourceFiles = new IRemoteFile[3];
|
||||
//Also add some of its children into the batch.
|
||||
|
@ -850,29 +857,29 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
String childToCopyName3 = "epdcdump01.hex12a";
|
||||
sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3);
|
||||
fss.copyBatch(sourceFiles, targetTarFile, mon);
|
||||
|
||||
|
||||
//Checking the first copied folder
|
||||
Object theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName1);
|
||||
|
||||
|
||||
assertNotNull(theCopiedChild);
|
||||
|
||||
|
||||
//Also make sure the copied child has the right contents.
|
||||
String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"};
|
||||
|
||||
|
||||
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE};
|
||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1);
|
||||
|
||||
|
||||
//Checking the second copied folder
|
||||
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName2);
|
||||
|
||||
|
||||
assertNotNull(theCopiedChild);
|
||||
|
||||
|
||||
//Also make sure the copied child has the right contents.
|
||||
String[] childrenToCheck2 = {"features"};
|
||||
|
||||
|
||||
int[] typesToCheck2 = {TYPE_FOLDER};
|
||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2);
|
||||
|
||||
|
||||
//Checking the third copied file
|
||||
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName3);
|
||||
assertNotNull(theCopiedChild);
|
||||
|
@ -883,40 +890,41 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
|
||||
|
||||
public void testOpenFileFromTarArchive() throws Exception {
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
|
||||
//create the source for testing first
|
||||
createTarSourceForOpen();
|
||||
|
||||
|
||||
String tarTargetFileName = tarSourceForOpenTest;
|
||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||
assertNotNull(targetTarFile);
|
||||
|
||||
|
||||
//Now get the contents of the virtual file we want to download:
|
||||
String fileContentToVerifyName1 = "MANIFEST.MF";
|
||||
|
||||
|
||||
//Get its parent first.
|
||||
IRemoteFile itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName1);
|
||||
assertNotNull(itsParentFolder);
|
||||
|
||||
|
||||
//Then get this file:
|
||||
IRemoteFile thisVirtualFile = (IRemoteFile)getChildFromFolder(itsParentFolder, fileContentToVerifyName1);
|
||||
assertNotNull(thisVirtualFile);
|
||||
|
||||
|
||||
//Now, we want to download the content of this file
|
||||
//We could just construct a dummy localpath for it.
|
||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||
IFileStore temp = createDir(tempPath, true);
|
||||
String localPath = tempPath + File.separator + fileContentToVerifyName1;
|
||||
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
||||
|
||||
|
||||
//now, verify the content of the local file
|
||||
IFileStore localFile = temp.getChild(fileContentToVerifyName1);
|
||||
//Check the content of the download file:
|
||||
boolean sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||
assertTrue(sameContent);
|
||||
|
||||
|
||||
|
||||
|
||||
//now, we got the contents of another virtual file we want to download:
|
||||
String fileContentToVerifyName2 = "Activator.java";
|
||||
itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName2);
|
||||
|
@ -931,14 +939,14 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
|||
assertNotNull(thisVirtualFile);
|
||||
localPath = tempPath + File.separator + fileContentToVerifyName2;
|
||||
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
||||
|
||||
|
||||
//now, verify the content of the local file
|
||||
localFile = temp.getChild(fileContentToVerifyName2);
|
||||
//Check the content of the download file:
|
||||
sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||
assertTrue(sameContent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -36,12 +36,13 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
|||
*/
|
||||
public FileServiceArchiveTestDStoreWindows(String name) {
|
||||
super(name);
|
||||
setTargetName("windows");
|
||||
}
|
||||
|
||||
public static junit.framework.Test suite() {
|
||||
|
||||
|
||||
TestSuite suite = new TestSuite("FileServiceArchiveTestDStoreWindows");
|
||||
|
||||
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToArchiveFile")); //$NON-NLS-1$
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToVirtualFileLevelOne")); //$NON-NLS-1$
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToVirtualFileLevelTwo")); //$NON-NLS-1$
|
||||
|
@ -64,17 +65,17 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
|||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testMoveVirtualFileLevelTwo")); //$NON-NLS-1$
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFile")); //$NON-NLS-1$
|
||||
//suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFileBigZip")); //$NON-NLS-1$
|
||||
|
||||
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote"));
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
||||
protected void setupFileSubSystem() {
|
||||
|
||||
|
||||
IHost dstoreHost = getWindowsHost();
|
||||
assertTrue(dstoreHost != null);
|
||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
|
||||
for (int i=0; i<ss.length; i++) {
|
||||
if (ss[i] instanceof IFileServiceSubSystem) {
|
||||
|
@ -82,24 +83,24 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
|||
fs = fss.getFileService();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IHost localHost = getLocalSystemConnection();
|
||||
sr = SystemStartHere.getSystemRegistry();
|
||||
sr = SystemStartHere.getSystemRegistry();
|
||||
ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
||||
for (int i=0; i<ss.length; i++) {
|
||||
if (ss[i] instanceof IFileServiceSubSystem) {
|
||||
localFss = (IFileServiceSubSystem)ss[i];
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
try
|
||||
{
|
||||
IConnectorService connectionService = fss.getConnectorService();
|
||||
|
||||
|
||||
//If you want to connect to a running server, uncomment the following statements
|
||||
/*
|
||||
IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties();
|
||||
|
||||
|
||||
if (properties instanceof IRemoteServerLauncher)
|
||||
{
|
||||
IRemoteServerLauncher sl = (IRemoteServerLauncher)properties;
|
||||
|
@ -111,12 +112,12 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
|||
|
||||
connectionService.acquireCredentials(false);
|
||||
connectionService.connect(mon);
|
||||
|
||||
|
||||
} catch(Exception e) {
|
||||
assertTrue("Exception creating temp dir " + e.getStackTrace().toString(), false); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.ALERT_SSL, fPreference_ALERT_SSL);
|
||||
|
|
|
@ -63,11 +63,14 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
|||
*/
|
||||
public FileServiceBaseTest(String name) {
|
||||
super(name);
|
||||
setTargetName("local");
|
||||
}
|
||||
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
setupFileSubSystem();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
//Create a temparory directory in My Home
|
||||
try
|
||||
{
|
||||
|
@ -85,11 +88,13 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
|||
}
|
||||
|
||||
public void tearDown() throws Exception {
|
||||
try {
|
||||
fss.delete(tempDir, mon);
|
||||
} catch(SystemMessageException msg) {
|
||||
//ensure that super.tearDown() can run
|
||||
System.err.println("Exception on tearDown: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||
if (fss != null) {
|
||||
try {
|
||||
fss.delete(tempDir, mon);
|
||||
} catch (SystemMessageException msg) {
|
||||
// ensure that super.tearDown() can run
|
||||
System.err.println("Exception on tearDown: " + msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
super.tearDown();
|
||||
}
|
||||
|
@ -397,6 +402,8 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
|||
protected void setupFileSubSystem()
|
||||
{
|
||||
IHost localHost = getLocalSystemConnection();
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||
ISubSystem[] ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
||||
for (int i=0; i<ss.length; i++) {
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.eclipse.rse.services.files.IHostFile;
|
|||
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
|
||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
||||
|
||||
public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||
|
@ -64,6 +63,11 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
public FileServiceTest(String name, String propertiesFileName) {
|
||||
super(name);
|
||||
fPropertiesFileName = propertiesFileName;
|
||||
if (propertiesFileName != null) {
|
||||
int idx = propertiesFileName.indexOf("Connection.properties");
|
||||
String targetName = propertiesFileName.substring(0, idx);
|
||||
setTargetName(targetName);
|
||||
}
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
|
@ -128,6 +132,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testGetRootProperties() throws Exception {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled()) return;
|
||||
IHostFile[] roots = fs.getRoots(new NullProgressMonitor());
|
||||
assertNotNull(roots);
|
||||
assertTrue(roots.length > 0);
|
||||
|
@ -138,6 +143,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
String rootName = roots[i].getName();
|
||||
assertNotNull(rootName);
|
||||
System.out.println(rootName);
|
||||
// DStore: NPE, bug 240710
|
||||
IHostFile newHf = fs.getFile(null, rootName, new NullProgressMonitor());
|
||||
assertTrue(newHf.isRoot());
|
||||
assertTrue(newHf.exists());
|
||||
|
@ -151,7 +157,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testCaseSensitive() {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCaseSensitive")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled()) return;
|
||||
|
||||
if (isWindows()) {
|
||||
assertFalse(fs.isCaseSensitive());
|
||||
|
@ -166,7 +172,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testCreateFile() throws SystemMessageException {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled()) return;
|
||||
|
||||
String testName = getTestFileName();
|
||||
IHostFile hf = fs.createFile(tempDirPath, testName, mon); //dstore-linux: bug 235492
|
||||
|
@ -187,7 +193,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
|||
|
||||
public void testCreateCaseSensitive() throws SystemMessageException {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateCaseSensitive")) return; //$NON-NLS-1$
|
||||
if (isTestDisabled()) return;
|
||||
|
||||
String testName = getTestFileName();
|
||||
String testName2 = testName.toUpperCase();
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||
* Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.tests.subsystems.files;
|
||||
|
@ -74,6 +75,11 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
public RSEFileStoreTest(String name, String propertiesFileName) {
|
||||
super(name);
|
||||
fPropertiesFileName = propertiesFileName;
|
||||
if (propertiesFileName != null) {
|
||||
int idx = propertiesFileName.indexOf("Connection.properties");
|
||||
String targetName = propertiesFileName.substring(0, idx);
|
||||
setTargetName(targetName);
|
||||
}
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
|
@ -178,6 +184,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testRecursiveGetParent() {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore store = fTestStore;
|
||||
String homePath = store.toURI().getPath();
|
||||
assertTrue("exists: " + store, store.fetchInfo().exists());
|
||||
|
@ -193,6 +201,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testAppendOutputStream() throws Exception {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore f = createFile("foo");
|
||||
fOS = f.openOutputStream(EFS.APPEND, getDefaultProgressMonitor());
|
||||
fOS.write("bar".getBytes());
|
||||
|
@ -211,6 +221,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testPutInfo() throws Exception {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileInfo testInfo = fTestStore.fetchInfo();
|
||||
assertTrue("1.1", testInfo.exists());
|
||||
assertTrue("1.2", testInfo.isDirectory());
|
||||
|
@ -250,6 +262,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testDeleteSpecialCases() throws Exception {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
String testFileName = "noPerm.txt"; //$NON-NLS-1$
|
||||
boolean exceptionThrown = false;
|
||||
|
||||
|
@ -350,6 +364,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testModifyNonExisting() throws Exception {
|
||||
// -test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore store = fTestStore.getChild("nonExisting.txt");
|
||||
IFileInfo info;
|
||||
boolean exceptionThrown = false;
|
||||
|
@ -435,6 +451,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
|
||||
public void testModifyReadOnly() throws Exception {
|
||||
//-test-author-:MartinOberhuber
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore store = createFile("readOnly.txt");
|
||||
IFileInfo info = store.fetchInfo();
|
||||
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
|
||||
|
@ -494,6 +512,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
public void testMakeDeleteTree() throws Exception {
|
||||
// -test-author-:MartinOberhuber
|
||||
// Create folder
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore treeStore = fTestStore.getChild("treeTest");
|
||||
treeStore.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
||||
|
||||
|
@ -597,6 +617,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
|||
}
|
||||
|
||||
public void test255files() throws Exception {
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
IFileStore f = fTestStore.getChild("f");
|
||||
f.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
||||
for (int i = 0; i < 255; i++) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
|
@ -24,23 +24,25 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
|||
* Test various aspects of mnemonic generation and assignment.
|
||||
*/
|
||||
public class MnemonicsTest 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 testDefaultGeneration() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
Mnemonics mn = new Mnemonics();
|
||||
mn.clear("abcde");
|
||||
String result = mn.setUniqueMnemonic("A...");
|
||||
|
@ -48,9 +50,11 @@ public class MnemonicsTest extends RSECoreTestCase {
|
|||
result = mn.setUniqueMnemonic("F...");
|
||||
assertEquals("&F...", result);
|
||||
}
|
||||
|
||||
|
||||
public void testAppendPolicies() {
|
||||
//-test-author-:DavidDykstal
|
||||
if (isTestDisabled())
|
||||
return;
|
||||
setLocalePattern(".*"); // match all locales
|
||||
Mnemonics mn = new Mnemonics();
|
||||
mn.clear("abcde");
|
||||
|
@ -61,9 +65,9 @@ public class MnemonicsTest extends RSECoreTestCase {
|
|||
result = mn.setUniqueMnemonic("H...");
|
||||
assertEquals("&H...", result);
|
||||
}
|
||||
|
||||
|
||||
private void setLocalePattern(String pattern) {
|
||||
RSEUIPlugin.getDefault().getPluginPreferences().setValue(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, pattern);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue