mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 12:35:22 +02:00
[240729] More flexible disabling of testcases
This commit is contained in:
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
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Corporation - initial API and implementation
|
# IBM Corporation - initial API and implementation
|
||||||
# Uwe Stieber (Wind River) - Rework test data location & connection management
|
# 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.testAddAndDeleteFlatNodes=true
|
||||||
TestSubsystemTestCase.testBugzilla170728=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
|
# 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.
|
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
|
@ -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.
|
* Each testcase method should leave the host pool as it was prior to running the method.
|
||||||
*/
|
*/
|
||||||
public class HostMoveTest extends RSEBaseConnectionTestCase {
|
public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
static final int NUMBER_OF_HOSTS = 6; // number of hosts
|
static final int NUMBER_OF_HOSTS = 6; // number of hosts
|
||||||
private IHost hostArray[] = null;
|
private IHost hostArray[] = null;
|
||||||
private ISystemRegistry registry = null;
|
private ISystemRegistry registry = null;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
|
@ -41,7 +41,7 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
registry = RSECorePlugin.getTheSystemRegistry();
|
registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
createHosts();
|
createHosts();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
@ -49,9 +49,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
deleteHosts();
|
deleteHosts();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMoveOneUp() throws Exception {
|
public void testMoveOneUp() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
||||||
IHost[] hosts = new IHost[] {host};
|
IHost[] hosts = new IHost[] {host};
|
||||||
|
@ -62,9 +64,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
registry.moveHosts("TestProfile", hosts, 1);
|
registry.moveHosts("TestProfile", hosts, 1);
|
||||||
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMoveManyUp() throws Exception {
|
public void testMoveManyUp() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost[] hosts = new IHost[] {hostArray[NUMBER_OF_HOSTS - 1], hostArray[NUMBER_OF_HOSTS - 2]};
|
IHost[] hosts = new IHost[] {hostArray[NUMBER_OF_HOSTS - 1], hostArray[NUMBER_OF_HOSTS - 2]};
|
||||||
registry.moveHosts("TestProfile", hosts, -2);
|
registry.moveHosts("TestProfile", hosts, -2);
|
||||||
|
@ -80,6 +84,8 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testMoveFirstUp() throws Exception {
|
public void testMoveFirstUp() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost host = hostArray[0];
|
IHost host = hostArray[0];
|
||||||
assertEquals(0, registry.getHostPosition(host));
|
assertEquals(0, registry.getHostPosition(host));
|
||||||
|
@ -90,6 +96,8 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testMoveOneDown() throws Exception {
|
public void testMoveOneDown() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost host = hostArray[1]; // second in the list
|
IHost host = hostArray[1]; // second in the list
|
||||||
assertEquals(1, registry.getHostPosition(host));
|
assertEquals(1, registry.getHostPosition(host));
|
||||||
|
@ -99,9 +107,11 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
registry.moveHosts("TestProfile", hosts, -1);
|
registry.moveHosts("TestProfile", hosts, -1);
|
||||||
assertEquals(1, registry.getHostPosition(host));
|
assertEquals(1, registry.getHostPosition(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMoveManyDown() throws Exception {
|
public void testMoveManyDown() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost[] hosts = new IHost[] {hostArray[0], hostArray[2], hostArray[4]};
|
IHost[] hosts = new IHost[] {hostArray[0], hostArray[2], hostArray[4]};
|
||||||
assertEquals(0, registry.getHostPosition(hostArray[0]));
|
assertEquals(0, registry.getHostPosition(hostArray[0]));
|
||||||
|
@ -119,8 +129,10 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testMoveLastDown() throws Exception {
|
public void testMoveLastDown() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
IHost host = hostArray[NUMBER_OF_HOSTS - 1];
|
||||||
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
assertEquals(NUMBER_OF_HOSTS - 1, registry.getHostPosition(host));
|
||||||
IHost[] hosts = new IHost[] {host};
|
IHost[] hosts = new IHost[] {host};
|
||||||
registry.moveHosts("TestProfile", hosts, 1); // should not actually move
|
registry.moveHosts("TestProfile", hosts, 1); // should not actually move
|
||||||
|
@ -129,16 +141,18 @@ public class HostMoveTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testNoHost() throws Exception {
|
public void testNoHost() throws Exception {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
checkPrecondition();
|
checkPrecondition();
|
||||||
IHost[] hosts = new IHost[] {};
|
IHost[] hosts = new IHost[] {};
|
||||||
registry.moveHosts("TestProfile", hosts, -1); // should not fail
|
registry.moveHosts("TestProfile", hosts, -1); // should not fail
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test hosts.
|
* Create the test hosts.
|
||||||
*/
|
*/
|
||||||
private void createHosts() throws Exception {
|
private void createHosts() throws Exception {
|
||||||
|
|
||||||
hostArray = new IHost[NUMBER_OF_HOSTS];
|
hostArray = new IHost[NUMBER_OF_HOSTS];
|
||||||
|
|
||||||
/* Common host properties */
|
/* 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_USERID, "userid"); //$NON-NLS-1$
|
||||||
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$
|
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$
|
||||||
IRSEConnectionProperties props = getConnectionManager().loadConnectionProperties(properties, false);
|
IRSEConnectionProperties props = getConnectionManager().loadConnectionProperties(properties, false);
|
||||||
|
|
||||||
for (int i = 0; i < hostArray.length; i++) {
|
for (int i = 0; i < hostArray.length; i++) {
|
||||||
String hostName = getHostName(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);
|
hostArray[i] = getConnectionManager().findOrCreateConnection(props);
|
||||||
assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), hostArray[i]); //$NON-NLS-1$
|
assertNotNull("Failed to create connection " + props.getProperty(IRSEConnectionProperties.ATTR_NAME), hostArray[i]); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteHosts() {
|
private void deleteHosts() {
|
||||||
for (int i = 1; i < hostArray.length; i++) {
|
for (int i = 1; i < hostArray.length; i++) {
|
||||||
registry.deleteHost(hostArray[i]);
|
registry.deleteHost(hostArray[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPrecondition() {
|
private void checkPrecondition() {
|
||||||
for (int i = 0; i < hostArray.length; i++) {
|
for (int i = 0; i < hostArray.length; i++) {
|
||||||
assertEquals("Precondition check failed", i, registry.getHostPosition(hostArray[i]));
|
assertEquals("Precondition check failed", i, registry.getHostPosition(hostArray[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getHostName(int i) {
|
private String getHostName(int i) {
|
||||||
String hostName = "TestHost" + Integer.toString(i);
|
String hostName = "TestHost" + Integer.toString(i);
|
||||||
return hostName;
|
return hostName;
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
* 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) - 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) - [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) - [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;
|
package org.eclipse.rse.tests.core;
|
||||||
|
|
||||||
|
@ -66,10 +67,17 @@ import org.osgi.framework.Bundle;
|
||||||
public class RSECoreTestCase extends TestCase {
|
public class RSECoreTestCase extends TestCase {
|
||||||
// Test properties storage.
|
// Test properties storage.
|
||||||
private final Properties properties = new Properties();
|
private final Properties properties = new Properties();
|
||||||
|
|
||||||
// Internal. Used to remember view zoom state changes.
|
// Internal. Used to remember view zoom state changes.
|
||||||
private final String PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED = "rseSystemsViewZoomStateChanged"; //$NON-NLS-1$
|
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.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -79,7 +87,7 @@ public class RSECoreTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param name The test name.
|
* @param name The test name.
|
||||||
*/
|
*/
|
||||||
public RSECoreTestCase(String name) {
|
public RSECoreTestCase(String name) {
|
||||||
|
@ -90,8 +98,30 @@ public class RSECoreTestCase extends TestCase {
|
||||||
initializeProperties();
|
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 *****
|
// ***** Test properties management and support methods *****
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the core test properties. Override to modify core
|
* Initialize the core test properties. Override to modify core
|
||||||
* test properties or to add additional ones.
|
* 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(IRSECoreTestCaseProperties.PROP_PERFORMANCE_TIMING_INCLUDE_SETUP_TEARDOWN, false);
|
||||||
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
|
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables or disables the specified property.
|
* Enables or disables the specified property.
|
||||||
*
|
*
|
||||||
* @param key The key of the property to enable or disable. Must be not <code>null</code>!
|
* @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.
|
* @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) {
|
protected final void setProperty(String key, boolean enable) {
|
||||||
setProperty(key, enable ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
setProperty(key, enable ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the specified property is equal to the specified value.
|
* 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 key The key of the property to test. Must be not <code>null</code>!
|
||||||
* @param value The value to compare the property with.
|
* @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.
|
* @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;
|
assert key != null;
|
||||||
return (value ? Boolean.TRUE : Boolean.FALSE).equals(Boolean.valueOf(properties.getProperty(key, "false"))); //$NON-NLS-1$
|
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
|
* Sets the specified string value for the specified property. If the specified
|
||||||
* value is <code>null</code>, the specified property will be removed.
|
* 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 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>.
|
* @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
|
* 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
|
* value is <code>null</code>, this method returns <code>true</code> if the specified
|
||||||
* property key does not exist. The comparisation is case insensitive.
|
* 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 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>
|
* @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,
|
* or the specified value is <code>null</code> and the property does not exist,
|
||||||
* <code>false</code> otherwise.
|
* <code>false</code> otherwise.
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +195,7 @@ public class RSECoreTestCase extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configured string value of the specified property.
|
* Returns the configured string value of the specified property.
|
||||||
*
|
*
|
||||||
* @param key The property key. Must be not <code>null</code>.
|
* @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.
|
* @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;
|
assert key != null;
|
||||||
return properties.getProperty(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 *****
|
// ***** 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$
|
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 class RSEBackgroundTestExecutionJob extends Job {
|
||||||
private final TestResult result;
|
private final TestResult result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param result The test result object the test is reporting failures to. Must be not <code>null</code>.
|
* @param result The test result object the test is reporting failures to. Must be not <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public RSEBackgroundTestExecutionJob(TestResult result) {
|
public RSEBackgroundTestExecutionJob(TestResult result) {
|
||||||
|
@ -191,11 +296,11 @@ public class RSECoreTestCase extends TestCase {
|
||||||
setUser(false);
|
setUser(false);
|
||||||
setPriority(Job.INTERACTIVE);
|
setPriority(Job.INTERACTIVE);
|
||||||
setRule(ResourcesPlugin.getWorkspace().getRoot());
|
setRule(ResourcesPlugin.getWorkspace().getRoot());
|
||||||
|
|
||||||
assert result != null;
|
assert result != null;
|
||||||
this.result = result;
|
this.result = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
* @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);
|
result.addListener(TEST_LISTENER);
|
||||||
invokeTestCaseRunImpl(result);
|
invokeTestCaseRunImpl(result);
|
||||||
result.removeListener(TEST_LISTENER);
|
result.removeListener(TEST_LISTENER);
|
||||||
|
|
||||||
monitor.done();
|
monitor.done();
|
||||||
|
|
||||||
setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE);
|
setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.TRUE);
|
||||||
|
|
||||||
// The job never fails. The test result is the real result.
|
// The job never fails. The test result is the real result.
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class RSEBackgroundTestExecutionJobWaiter implements IInterruptCondition {
|
private final static class RSEBackgroundTestExecutionJobWaiter implements IInterruptCondition {
|
||||||
private final Job job;
|
private final Job job;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param job The job to wait for the execution to finish. Must be not <code>null</code>.
|
* @param job The job to wait for the execution to finish. Must be not <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public RSEBackgroundTestExecutionJobWaiter(Job job) {
|
public RSEBackgroundTestExecutionJobWaiter(Job job) {
|
||||||
assert job != null;
|
assert job != null;
|
||||||
this.job = job;
|
this.job = job;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#isTrue()
|
* @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.
|
// Interrupt the wait method if the job signaled that it has finished.
|
||||||
return ((Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue();
|
return ((Boolean)job.getProperty(BACKGROUND_TEST_EXECUTION_FINISHED)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#dispose()
|
* @see org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition#dispose()
|
||||||
*/
|
*/
|
||||||
public void dispose() { /* nothing to dispose here */ }
|
public void dispose() { /* nothing to dispose here */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal accessor method to call the original <code>junit.
|
* Internal accessor method to call the original <code>junit.
|
||||||
* framework.TestCase.run(TestResult) implementation.
|
* framework.TestCase.run(TestResult) implementation.
|
||||||
*
|
*
|
||||||
* @param result The test result object the test is reporting failures to. Must be not <code>null</code>.
|
* @param result The test result object the test is reporting failures to. Must be not <code>null</code>.
|
||||||
*/
|
*/
|
||||||
final void invokeTestCaseRunImpl(TestResult result) {
|
final void invokeTestCaseRunImpl(TestResult result) {
|
||||||
super.run(result);
|
super.run(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see junit.framework.TestCase#run(junit.framework.TestResult)
|
* @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);
|
job.setProperty(BACKGROUND_TEST_EXECUTION_FINISHED, Boolean.FALSE);
|
||||||
// schedule the job to run immediatelly
|
// schedule the job to run immediatelly
|
||||||
job.schedule();
|
job.schedule();
|
||||||
|
|
||||||
// wait till the job finished executing
|
// wait till the job finished executing
|
||||||
RSEWaitAndDispatchUtil.waitAndDispatch(0, new RSEBackgroundTestExecutionJobWaiter(job));
|
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.
|
* 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>!
|
* @param name The name of the starting test. Must be not <code>null</code>!
|
||||||
* @return The start time of the test in milliseconds.
|
* @return The start time of the test in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
@ -334,10 +439,10 @@ public class RSECoreTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the end date and time as well as the delay of the specified test to stdout.
|
* 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 name The name of the finished test. Must be not <code>null</code>!
|
||||||
* @param startTime The start time of the test in milliseconds.
|
* @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$
|
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,
|
* Wait until the SystemProfileManager has finished loading all "autoload" profiles,
|
||||||
* and the RSEUIPlugin InitRSEJob has finished filling it with the default connections.
|
* and the RSEUIPlugin InitRSEJob has finished filling it with the default connections.
|
||||||
|
@ -387,14 +492,14 @@ public class RSECoreTestCase extends TestCase {
|
||||||
waitForRSEWorkspaceInit();
|
waitForRSEWorkspaceInit();
|
||||||
switchMaximizeSystemsView();
|
switchMaximizeSystemsView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flush the event queue in order to ensure that no left-over events influence later test cases.
|
* Flush the event queue in order to ensure that no left-over events influence later test cases.
|
||||||
* <p>
|
* <p>
|
||||||
* Unhandled exceptions in the event loop event are caught as follows:
|
* Unhandled exceptions in the event loop event are caught as follows:
|
||||||
* In case multiple events from the event loop throw exceptions these are printed
|
* 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.
|
* 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.
|
* @throws Exception in case an unhandled event loop exception was found.
|
||||||
*/
|
*/
|
||||||
protected void flushEventQueue() throws Exception {
|
protected void flushEventQueue() throws Exception {
|
||||||
|
@ -448,8 +553,8 @@ public class RSECoreTestCase extends TestCase {
|
||||||
flushEventQueue();
|
flushEventQueue();
|
||||||
super.tearDown();
|
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
|
* 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() {
|
protected void switchMaximizeSystemsView() {
|
||||||
final String perspectiveId = getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE);
|
final String perspectiveId = getProperty(IRSECoreTestCaseProperties.PROP_SWITCH_TO_PERSPECTIVE);
|
||||||
assertNotNull("Invalid null-value for test case perspective id!", perspectiveId); //$NON-NLS-1$
|
assertNotNull("Invalid null-value for test case perspective id!", perspectiveId); //$NON-NLS-1$
|
||||||
|
|
||||||
// all view management must happen in the UI thread!
|
// all view management must happen in the UI thread!
|
||||||
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
// in case the test case is launched within a new workspace, the eclipse intro
|
// 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.
|
// view is hiding everything else. Find the intro page and hide it.
|
||||||
hideView("org.eclipse.ui.internal.introview", perspectiveId); //$NON-NLS-1$
|
hideView("org.eclipse.ui.internal.introview", perspectiveId); //$NON-NLS-1$
|
||||||
|
|
||||||
// toggle the Remote Systems View zoom state.
|
// toggle the Remote Systems View zoom state.
|
||||||
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
|
setProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, false);
|
||||||
IViewPart part = showView(IRSEViews.RSE_REMOTE_SYSTEMS_VIEW_ID, perspectiveId);
|
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
|
// Give the UI a chance to repaint if the view zoom state changed
|
||||||
if (isProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true)) {
|
if (isProperty(PROP_RSE_SYSTEMS_VIEW_ZOOM_STATE_CHANGED, true)) {
|
||||||
System.err.println("Waiting for UI to repaint"); //$NON-NLS-1$
|
System.err.println("Waiting for UI to repaint"); //$NON-NLS-1$
|
||||||
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
RSEWaitAndDispatchUtil.waitAndDispatch(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restore the RSE SystemsView to its previous state, in case the view state
|
* 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() {
|
protected void restoreMaximizeSystemsView() {
|
||||||
// restore the original view zoom state
|
// 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.
|
* 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 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>.
|
* @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.
|
* @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) {
|
public final IViewReference findView(String viewId, String perspectiveId) {
|
||||||
assert viewId != null && perspectiveId != null;
|
assert viewId != null && perspectiveId != null;
|
||||||
if (viewId == null || perspectiveId == null) return null;
|
if (viewId == null || perspectiveId == null) return null;
|
||||||
|
|
||||||
// First of all, we have to lookup the currently active workbench
|
// 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();
|
IWorkbench workbench = PlatformUI.getWorkbench();
|
||||||
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
|
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
|
||||||
// and the corresponding currently active workbench window.
|
// and the corresponding currently active workbench window.
|
||||||
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
|
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
|
||||||
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
|
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
|
||||||
|
|
||||||
// Now we have to switch to the specified perspecitve
|
// Now we have to switch to the specified perspecitve
|
||||||
try {
|
try {
|
||||||
workbench.showPerspective(perspectiveId, window);
|
workbench.showPerspective(perspectiveId, window);
|
||||||
} catch (WorkbenchException e) {
|
} catch (WorkbenchException e) {
|
||||||
SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
|
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
|
// From the active workbench window, we need the active workbench page
|
||||||
IWorkbenchPage page = window.getActivePage();
|
IWorkbenchPage page = window.getActivePage();
|
||||||
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
|
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
|
||||||
|
|
||||||
return page.findViewReference(viewId);
|
return page.findViewReference(viewId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shows and activate the view identified by the specified id.
|
* Shows and activate the view identified by the specified id.
|
||||||
*
|
*
|
||||||
* @param viewId The unique view id. Must be not <code>null</code>.
|
* @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>.
|
* @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.
|
* @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) {
|
public final IViewPart showView(String viewId, String perspectiveId) {
|
||||||
assert viewId != null && perspectiveId != null;
|
assert viewId != null && perspectiveId != null;
|
||||||
if (viewId == null || perspectiveId == null) return null;
|
if (viewId == null || perspectiveId == null) return null;
|
||||||
|
|
||||||
// First of all, we have to lookup the currently active workbench
|
// 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();
|
IWorkbench workbench = PlatformUI.getWorkbench();
|
||||||
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
|
assertNotNull("Failed to query current workbench instance!", workbench); //$NON-NLS-1$
|
||||||
// and the corresponding currently active workbench window.
|
// and the corresponding currently active workbench window.
|
||||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||||
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
|
assertNotNull("Failed to query currently active workbench window!", window); //$NON-NLS-1$
|
||||||
|
|
||||||
// Now we have to switch to the specified perspecitve
|
// Now we have to switch to the specified perspecitve
|
||||||
try {
|
try {
|
||||||
workbench.showPerspective(perspectiveId, window);
|
workbench.showPerspective(perspectiveId, window);
|
||||||
} catch (WorkbenchException e) {
|
} catch (WorkbenchException e) {
|
||||||
SystemBasePlugin.logError("Failed to switch to requested perspective (id = " + perspectiveId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
|
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
|
// From the active workbench window, we need the active workbench page
|
||||||
IWorkbenchPage page = window.getActivePage();
|
IWorkbenchPage page = window.getActivePage();
|
||||||
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
|
assertNotNull("Failed to query currently active workbench page!", page); //$NON-NLS-1$
|
||||||
|
|
||||||
IViewPart part = null;
|
IViewPart part = null;
|
||||||
try {
|
try {
|
||||||
part = page.showView(viewId);
|
part = page.showView(viewId);
|
||||||
} catch (PartInitException e) {
|
} catch (PartInitException e) {
|
||||||
SystemBasePlugin.logError("Failed to show view (id = " + viewId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
|
SystemBasePlugin.logError("Failed to show view (id = " + viewId + ")!", e); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
return part;
|
return part;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the view identified by the specified id.
|
* Hides the view identified by the specified id.
|
||||||
*
|
*
|
||||||
* @param viewId The unique view id. Must be not <code>null</code>.
|
* @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>.
|
* @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) {
|
public final void hideView(String viewId, String perspectiveId) {
|
||||||
assert viewId != null && perspectiveId != null;
|
assert viewId != null && perspectiveId != null;
|
||||||
if (viewId == null || perspectiveId == null) return;
|
if (viewId == null || perspectiveId == null) return;
|
||||||
|
|
||||||
IViewReference viewReference = findView(viewId, perspectiveId);
|
IViewReference viewReference = findView(viewId, perspectiveId);
|
||||||
if (viewReference != null) {
|
if (viewReference != null) {
|
||||||
// at this point we can safely asume that we can access the active page directly
|
// 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 *****
|
// ***** Test data management and support methods *****
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the absolute test data location path calculated out of the known
|
* Returns the absolute test data location path calculated out of the known
|
||||||
* test data location root (<i>org.eclipse.rse.tests plugin location + sub
|
* test data location root (<i>org.eclipse.rse.tests plugin location + sub
|
||||||
|
@ -630,16 +735,16 @@ public class RSECoreTestCase extends TestCase {
|
||||||
* </ul><br>
|
* </ul><br>
|
||||||
* If the calculated test data location does not pass these conditions, the
|
* If the calculated test data location does not pass these conditions, the
|
||||||
* method will return <code>null</code>.
|
* 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 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.
|
* @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.
|
* @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) {
|
protected final IPath getTestDataLocation(String relativePath, boolean appendHostOS) {
|
||||||
assert relativePath != null;
|
assert relativePath != null;
|
||||||
IPath root = null;
|
IPath root = null;
|
||||||
|
|
||||||
if (relativePath != null) {
|
if (relativePath != null) {
|
||||||
Bundle bundle = RSETestsPlugin.getDefault().getBundle();
|
Bundle bundle = RSETestsPlugin.getDefault().getBundle();
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
|
@ -660,14 +765,14 @@ public class RSECoreTestCase extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** Test failures log collector management and support methods *****
|
// ***** Test failures log collector management and support methods *****
|
||||||
|
|
||||||
final TestListener TEST_LISTENER = new RSETestFailureListener();
|
final TestListener TEST_LISTENER = new RSETestFailureListener();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listens to the test executions and collect the test log files
|
* Listens to the test executions and collect the test log files
|
||||||
* through the known list of test log collector delegates in a test
|
* 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) {
|
public void startTest(Test test) {
|
||||||
// nothing to do on start test
|
// nothing to do on start test
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
|
* @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable)
|
||||||
*/
|
*/
|
||||||
|
@ -695,7 +800,7 @@ public class RSECoreTestCase extends TestCase {
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
RSETestsPlugin.getDefault().getLog().log(status);
|
RSETestsPlugin.getDefault().getLog().log(status);
|
||||||
|
|
||||||
// Collect the log files if at least one test log collector is known
|
// Collect the log files if at least one test log collector is known
|
||||||
collectTestLogs(test);
|
collectTestLogs(test);
|
||||||
}
|
}
|
||||||
|
@ -714,7 +819,7 @@ public class RSECoreTestCase extends TestCase {
|
||||||
failure
|
failure
|
||||||
);
|
);
|
||||||
RSETestsPlugin.getDefault().getLog().log(status);
|
RSETestsPlugin.getDefault().getLog().log(status);
|
||||||
|
|
||||||
// Collect the log files if at least one test log collector is known
|
// Collect the log files if at least one test log collector is known
|
||||||
collectTestLogs(test);
|
collectTestLogs(test);
|
||||||
}
|
}
|
||||||
|
@ -727,10 +832,10 @@ public class RSECoreTestCase extends TestCase {
|
||||||
// nothing to do on end test
|
// nothing to do on end test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect the test logs for the failed test.
|
* Collect the test logs for the failed test.
|
||||||
*
|
*
|
||||||
* @param test The failed test. Must be not <code>null</code>.
|
* @param test The failed test. Must be not <code>null</code>.
|
||||||
*/
|
*/
|
||||||
protected final synchronized void collectTestLogs(Test test) {
|
protected final synchronized void collectTestLogs(Test test) {
|
||||||
|
@ -754,11 +859,11 @@ public class RSECoreTestCase extends TestCase {
|
||||||
if (archivePath.toFile().createNewFile()) {
|
if (archivePath.toFile().createNewFile()) {
|
||||||
stream = new ZipOutputStream(new FileOutputStream(archivePath.toFile()));
|
stream = new ZipOutputStream(new FileOutputStream(archivePath.toFile()));
|
||||||
stream.setLevel(9);
|
stream.setLevel(9);
|
||||||
|
|
||||||
// cache the names of the entries added to the ZIP stream.
|
// cache the names of the entries added to the ZIP stream.
|
||||||
// They needs to be unique!
|
// They needs to be unique!
|
||||||
Set nameCache = new HashSet();
|
Set nameCache = new HashSet();
|
||||||
|
|
||||||
// call each test log collector delegate for the absolute file names
|
// call each test log collector delegate for the absolute file names
|
||||||
// and add each of the returned files to the ZIP archive.
|
// and add each of the returned files to the ZIP archive.
|
||||||
for (int i = 0; i < delegates.length; i++) {
|
for (int i = 0; i < delegates.length; i++) {
|
||||||
|
@ -783,7 +888,7 @@ public class RSECoreTestCase extends TestCase {
|
||||||
unifier = location.removeLastSegments(1);
|
unifier = location.removeLastSegments(1);
|
||||||
entryName = unifier.lastSegment() + "_" + entryName; //$NON-NLS-1$
|
entryName = unifier.lastSegment() + "_" + entryName; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the name is still not unique, append a count to it
|
// if the name is still not unique, append a count to it
|
||||||
long count = 0;
|
long count = 0;
|
||||||
// force to make a copy of the current name
|
// force to make a copy of the current name
|
||||||
|
@ -795,11 +900,11 @@ public class RSECoreTestCase extends TestCase {
|
||||||
} else {
|
} else {
|
||||||
nameCache.add(entryName);
|
nameCache.add(entryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipEntry zipEntry = new ZipEntry(entryName);
|
ZipEntry zipEntry = new ZipEntry(entryName);
|
||||||
zipEntry.setTime(file.lastModified());
|
zipEntry.setTime(file.lastModified());
|
||||||
stream.putNextEntry(zipEntry);
|
stream.putNextEntry(zipEntry);
|
||||||
|
|
||||||
// Read the file bytewise and write it bytewise to the ZIP
|
// Read the file bytewise and write it bytewise to the ZIP
|
||||||
BufferedInputStream fileStream = null;
|
BufferedInputStream fileStream = null;
|
||||||
try {
|
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.
|
// 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.
|
// This gives the delegate the chance to remove any possibly created temporary file.
|
||||||
delegate.dispose();
|
delegate.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
/* ignored on purpose */
|
/* ignored on purpose */
|
||||||
} finally {
|
} finally {
|
||||||
// always close the stream if open
|
// always close the stream if open
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation
|
* Uwe Stieber (Wind River) - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||||
* Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods
|
* 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
|
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.tests.core.registries;
|
package org.eclipse.rse.tests.core.registries;
|
||||||
|
@ -23,16 +23,18 @@ import org.eclipse.rse.tests.core.RSECoreTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the subsystem configuration proxy functionality.
|
* Tests the subsystem configuration proxy functionality.
|
||||||
*
|
*
|
||||||
* @author uwe.stieber@windriver.com
|
* @author uwe.stieber@windriver.com
|
||||||
*/
|
*/
|
||||||
public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
|
public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testSubSystemConfigurationProxy() {
|
public void testSubSystemConfigurationProxy() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
|
||||||
assertNotNull("Failed to fetch RSE system registry instance!", systemRegistry); //$NON-NLS-1$
|
assertNotNull("Failed to fetch RSE system registry instance!", systemRegistry); //$NON-NLS-1$
|
||||||
|
|
||||||
// get all subsystem configuration proxies and pick out the ones from our
|
// get all subsystem configuration proxies and pick out the ones from our
|
||||||
// tests plugin.
|
// tests plugin.
|
||||||
ISubSystemConfigurationProxy[] proxies = systemRegistry.getSubSystemConfigurationProxies();
|
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$
|
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$
|
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$
|
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
|
// 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$
|
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$
|
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.getPriority()!", 50000, proxy.getPriority()); //$NON-NLS-1$
|
||||||
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
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!
|
// walk through all known system types. Only "Local" and "Windows" should match!
|
||||||
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
||||||
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
|
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.getPriority()!", 100000, proxy.getPriority()); //$NON-NLS-1$
|
||||||
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
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
|
// walk through all known system types. All system types declared by the tests plugin are expected to match
|
||||||
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
||||||
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
|
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.getPriority()!", 2000, proxy.getPriority()); //$NON-NLS-1$
|
||||||
assertEquals("Unexpected return value for proxy.getCategory()!", "users", proxy.getCategory()); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
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!
|
// walk through all known system types. Only "Unix" and "Linux" should match!
|
||||||
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
IRSESystemType[] systemTypes = RSECorePlugin.getTheCoreRegistry().getSystemTypes();
|
||||||
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
|
assertNotNull("Failed to fetch list of registered system types!", systemTypes); //$NON-NLS-1$
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008 IBM Corporation and others.
|
* Copyright (c) 2008 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David Dykstal (IBM) - initial implementation
|
* David Dykstal (IBM) - initial implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.tests.core.registries;
|
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;
|
import org.eclipse.rse.tests.core.RSECoreTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the subsystem configuration proxy functionality.
|
* Tests the subsystem interfaces.
|
||||||
*
|
|
||||||
* @author uwe.stieber@windriver.com
|
|
||||||
*/
|
*/
|
||||||
public class SubSystemInterfacesTest extends RSECoreTestCase {
|
public class SubSystemInterfacesTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testSubSystemFinding() {
|
public void testSubSystemFinding() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
assertNotNull("system registry not found", registry); //$NON-NLS-1$
|
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.core.runtime.Status;
|
||||||
import org.eclipse.rse.core.IRSEInitListener;
|
import org.eclipse.rse.core.IRSEInitListener;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
|
import org.eclipse.rse.tests.RSETestsPlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be run on a clean workspace.
|
* Should be run on a clean workspace.
|
||||||
*/
|
*/
|
||||||
public class InitializationTest extends TestCase {
|
public class InitializationTest extends TestCase {
|
||||||
|
|
||||||
public InitializationTest(String name) {
|
public InitializationTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
|
@ -39,16 +40,17 @@ public class InitializationTest extends TestCase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testInitialization() {
|
public void testInitialization() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (!RSETestsPlugin.isTestCaseEnabled("InitializationTest.testInitialization"))return; //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
IStatus status = null;
|
IStatus status = null;
|
||||||
status = RSECorePlugin.waitForInitCompletion(RSECorePlugin.INIT_MODEL);
|
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
|
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));
|
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.
|
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation
|
* Uwe Stieber (Wind River) - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
|
||||||
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
* 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.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.rse.core.IRSESystemType;
|
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.IRSECoreTestCaseProperties;
|
||||||
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
|
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil;
|
||||||
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition;
|
import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil.IInterruptCondition;
|
||||||
|
@ -43,8 +42,9 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
|
||||||
*/
|
*/
|
||||||
public void testCoreTestPropertiesHandling() {
|
public void testCoreTestPropertiesHandling() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testCoreTestPropertiesHandling")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// test for our defaults
|
// 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$
|
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$
|
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 boolean isTrue() { return params.size() > 0; }
|
||||||
public void dispose() { params.clear(); }
|
public void dispose() { params.clear(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TestJob extends Job {
|
private static class TestJob extends Job {
|
||||||
final List params;
|
final List params;
|
||||||
public TestJob(List params) {
|
public TestJob(List params) {
|
||||||
|
@ -87,7 +87,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
|
||||||
assert params != null;
|
assert params != null;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -97,24 +97,25 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the <code>RSEWaitAndDispatchUtil</code> wait methods.
|
* Test the <code>RSEWaitAndDispatchUtil</code> wait methods.
|
||||||
*/
|
*/
|
||||||
public void testWaitAndDispatch() {
|
public void testWaitAndDispatch() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testWaitAndDispatch")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// the simple wait and dispatch is time out based
|
// the simple wait and dispatch is time out based
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
RSEWaitAndDispatchUtil.waitAndDispatch(2500);
|
RSEWaitAndDispatchUtil.waitAndDispatch(2500);
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
assertTrue("Failed to wait a given timeout!", (end - start) >= 2500); //$NON-NLS-1$
|
assertTrue("Failed to wait a given timeout!", (end - start) >= 2500); //$NON-NLS-1$
|
||||||
|
|
||||||
// the more complex wait and dispatch method has to stop
|
// the more complex wait and dispatch method has to stop
|
||||||
// on a given condition.
|
// on a given condition.
|
||||||
final List params = new ArrayList();
|
final List params = new ArrayList();
|
||||||
|
|
||||||
// the trick here is to make the condition true only if a
|
// the trick here is to make the condition true only if a
|
||||||
// runnable passed through the display thread. That should
|
// runnable passed through the display thread. That should
|
||||||
// give us the asurance that the display event dispatching
|
// give us the asurance that the display event dispatching
|
||||||
|
@ -125,55 +126,57 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase {
|
||||||
job.setPriority(Job.SHORT);
|
job.setPriority(Job.SHORT);
|
||||||
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
|
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
|
||||||
job.schedule(3000);
|
job.schedule(3000);
|
||||||
|
|
||||||
boolean timeout = RSEWaitAndDispatchUtil.waitAndDispatch(10000, new TestWaiter(params));
|
boolean timeout = RSEWaitAndDispatchUtil.waitAndDispatch(10000, new TestWaiter(params));
|
||||||
assertFalse("Interrupt condition failed to stop wait method!", timeout); //$NON-NLS-1$
|
assertFalse("Interrupt condition failed to stop wait method!", timeout); //$NON-NLS-1$
|
||||||
assertEquals("Interrupt condition failed to dispose!", 0, params.size()); //$NON-NLS-1$
|
assertEquals("Interrupt condition failed to dispose!", 0, params.size()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test accessing the test data location.
|
* Test accessing the test data location.
|
||||||
*/
|
*/
|
||||||
public void testTestDataLocationManagement() {
|
public void testTestDataLocationManagement() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testTestDataLocationManagement")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// get the pure test data location root path.
|
// get the pure test data location root path.
|
||||||
IPath root = getTestDataLocation("", false); //$NON-NLS-1$
|
IPath root = getTestDataLocation("", false); //$NON-NLS-1$
|
||||||
assertNotNull("Failed to query test data location root!", root); //$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() + " 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$
|
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
|
// get a test data location path under the root
|
||||||
String relative = "unittest_" + System.currentTimeMillis(); //$NON-NLS-1$
|
String relative = "unittest_" + System.currentTimeMillis(); //$NON-NLS-1$
|
||||||
// as the directories should not exist yet, a call to getTestDataLocation must return null
|
// as the directories should not exist yet, a call to getTestDataLocation must return null
|
||||||
IPath path = getTestDataLocation(relative, false);
|
IPath path = getTestDataLocation(relative, false);
|
||||||
assertNull("Test data location exist but should not!", path); //$NON-NLS-1$
|
assertNull("Test data location exist but should not!", path); //$NON-NLS-1$
|
||||||
|
|
||||||
// go and create the path now (including the OS)
|
// go and create the path now (including the OS)
|
||||||
String os = Platform.getOS();
|
String os = Platform.getOS();
|
||||||
assertNotNull("Failed to query current execution host operating system string!", os); //$NON-NLS-1$
|
assertNotNull("Failed to query current execution host operating system string!", os); //$NON-NLS-1$
|
||||||
path = root.append(relative + "/" + 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$
|
assertTrue("Failed to create test data location directories. Permission problem?", path.toFile().mkdirs()); //$NON-NLS-1$
|
||||||
|
|
||||||
// Now, the re-query must be successful.
|
// Now, the re-query must be successful.
|
||||||
IPath path2 = getTestDataLocation(relative, false);
|
IPath path2 = getTestDataLocation(relative, false);
|
||||||
assertNotNull("Test data location " + root.append(relative).toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
|
assertNotNull("Test data location " + root.append(relative).toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
path2 = getTestDataLocation(relative, true);
|
path2 = getTestDataLocation(relative, true);
|
||||||
assertNotNull("Test data location " + path.toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
|
assertNotNull("Test data location " + path.toOSString() + " seems not to exist!", path2); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// Delete the created pathes again
|
// 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 " + 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$
|
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.
|
* Test RSE connection manager and related functionality.
|
||||||
*/
|
*/
|
||||||
public void testConnectionManager() {
|
public void testConnectionManager() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("RSEInternalFrameworkTestCase.testConnectionManager")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
// get the pure test data location root path.
|
// get the pure test data location root path.
|
||||||
IPath location = getTestDataLocation("testConnectionManager", false); //$NON-NLS-1$
|
IPath location = getTestDataLocation("testConnectionManager", false); //$NON-NLS-1$
|
||||||
assertNotNull("Cannot locate test data! Missing test data location?", location); //$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$
|
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 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$
|
assertTrue("Required test data file is not readable!", location.toFile().canRead()); //$NON-NLS-1$
|
||||||
|
|
||||||
// load the test connection properties from the data file.
|
// load the test connection properties from the data file.
|
||||||
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, true);
|
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, true);
|
||||||
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
|
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 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 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 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 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$
|
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)
|
// test the loading with partial connection information (with defauls)
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID);
|
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$
|
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$
|
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$
|
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 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 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$
|
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$
|
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 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$
|
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$
|
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 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$
|
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.
|
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation
|
* Uwe Stieber (Wind River) - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -28,21 +28,22 @@ public class RSETestsPluginTestCase extends RSECoreTestCase {
|
||||||
*/
|
*/
|
||||||
public void testPluginResourceBundle() {
|
public void testPluginResourceBundle() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle();
|
ResourceBundle bundle = RSETestsPlugin.getDefault().getResourceBundle();
|
||||||
assertNotNull("No resource bundle associated with RSETestsPlugin!", bundle); //$NON-NLS-1$
|
assertNotNull("No resource bundle associated with RSETestsPlugin!", bundle); //$NON-NLS-1$
|
||||||
|
|
||||||
// our own test id must be true here, otherwise we wouldn't had
|
// our own test id must be true here, otherwise we wouldn't had
|
||||||
// reached this point anyway.
|
// reached this point anyway.
|
||||||
assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testPluginResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$
|
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
|
// 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$
|
assertTrue("Unexpected return value false!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.testNeverAddThisToTheResourceBundle")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// this test id should be never enabled
|
// this test id should be never enabled
|
||||||
assertFalse("Unexpected return value true!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.dontRemove.testNeverEnabledThis")); //$NON-NLS-1$ //$NON-NLS-2$
|
assertFalse("Unexpected return value true!", RSETestsPlugin.isTestCaseEnabled("RSETestsPluginTestCase.dontRemove.testNeverEnabledThis")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
// Test the different getResourceString methods.
|
// Test the different getResourceString methods.
|
||||||
String expected = "testResolveString"; //$NON-NLS-1$
|
String expected = "testResolveString"; //$NON-NLS-1$
|
||||||
assertEquals("Unexpected return value!", expected, RSETestsPlugin.getResourceString("RSETestsPluginTestCase.dontRemove.testResolveString")); //$NON-NLS-1$ //$NON-NLS-2$
|
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
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David Dykstal (IBM) - initial contribution.
|
* David Dykstal (IBM) - initial contribution.
|
||||||
* David Dykstal (IBM) - [189274] provide import and export operations for profiles
|
* David Dykstal (IBM) - [189274] provide import and export operations for profiles
|
||||||
* David Dykstal (IBM) - [232126] add test for filter type persistence
|
* 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;
|
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;
|
import org.eclipse.rse.tests.core.RSECoreTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExportImportTest extends RSECoreTestCase {
|
public class ExportImportTest extends RSECoreTestCase {
|
||||||
|
|
||||||
ISystemProfile sourceProfile = null;
|
ISystemProfile sourceProfile = null;
|
||||||
ISystemRegistry registry = null;
|
ISystemRegistry registry = null;
|
||||||
IRSEPersistenceManager manager = null;
|
IRSEPersistenceManager manager = null;
|
||||||
|
@ -47,7 +48,7 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
public ExportImportTest(String name) {
|
public ExportImportTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
|
@ -82,7 +83,7 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
ISystemFilter sharedFilter = sharedFilterPool.createSystemFilter("sharedFilter", filterStrings);
|
ISystemFilter sharedFilter = sharedFilterPool.createSystemFilter("sharedFilter", filterStrings);
|
||||||
sharedFilter.setType("sharedFilterType");
|
sharedFilter.setType("sharedFilterType");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
@ -95,6 +96,8 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
*/
|
*/
|
||||||
public void testFilterPool1() {
|
public void testFilterPool1() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
// find the provider
|
// find the provider
|
||||||
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
|
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
|
||||||
|
@ -105,7 +108,7 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
RSEEnvelope envelope = new RSEEnvelope();
|
RSEEnvelope envelope = new RSEEnvelope();
|
||||||
envelope.add(fp);
|
envelope.add(fp);
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
IProgressMonitor monitor = new NullProgressMonitor();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
envelope.put(out, persistenceProvider, monitor);
|
envelope.put(out, persistenceProvider, monitor);
|
||||||
// create an empty profile
|
// create an empty profile
|
||||||
ISystemProfile targetProfile = registry.createSystemProfile("profileFilterPool1", true);
|
ISystemProfile targetProfile = registry.createSystemProfile("profileFilterPool1", true);
|
||||||
|
@ -143,6 +146,8 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
*/
|
*/
|
||||||
public void testHost1() {
|
public void testHost1() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
// find the provider
|
// find the provider
|
||||||
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
|
IRSEPersistenceProvider persistenceProvider = manager.getPersistenceProvider("org.eclipse.rse.persistence.PropertyFileProvider");
|
||||||
|
@ -153,7 +158,7 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
RSEEnvelope envelope = new RSEEnvelope();
|
RSEEnvelope envelope = new RSEEnvelope();
|
||||||
envelope.add(host1);
|
envelope.add(host1);
|
||||||
IProgressMonitor monitor = new NullProgressMonitor();
|
IProgressMonitor monitor = new NullProgressMonitor();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
envelope.put(out, persistenceProvider, monitor);
|
envelope.put(out, persistenceProvider, monitor);
|
||||||
// import from the newly created stream
|
// import from the newly created stream
|
||||||
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
|
||||||
|
@ -189,6 +194,8 @@ public class ExportImportTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testPropertySet() {
|
public void testPropertySet() {
|
||||||
//-test-author-:DavidDykstal
|
//-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
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* David Dykstal (IBM) - initial contribution.
|
* David Dykstal (IBM) - initial contribution.
|
||||||
|
* Martin Oberhuber (Wind River) - [240729] More flexible disabling of testcases
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.tests.persistence;
|
package org.eclipse.rse.tests.persistence;
|
||||||
|
@ -13,7 +14,7 @@ package org.eclipse.rse.tests.persistence;
|
||||||
import org.eclipse.rse.tests.core.RSECoreTestCase;
|
import org.eclipse.rse.tests.core.RSECoreTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MigrationTest extends RSECoreTestCase {
|
public class MigrationTest extends RSECoreTestCase {
|
||||||
|
|
||||||
|
@ -23,6 +24,8 @@ public class MigrationTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testProfileMigration() {
|
public void testProfileMigration() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
// create a new profile
|
// create a new profile
|
||||||
// set its persistence manager to PM1
|
// set its persistence manager to PM1
|
||||||
// populate the profile
|
// populate the profile
|
||||||
|
|
|
@ -35,32 +35,34 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link 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
|
* profiles, hosts, filters, and other model objects. You should run this only in a
|
||||||
* clean workspace.
|
* clean workspace.
|
||||||
*/
|
*/
|
||||||
public class PersistenceTest extends RSECoreTestCase {
|
public class PersistenceTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public PersistenceTest(String name) {
|
public PersistenceTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPersistenceManagerStartup() {
|
public void testPersistenceManagerStartup() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IRSEPersistenceManager m = RSECorePlugin.getThePersistenceManager();
|
IRSEPersistenceManager m = RSECorePlugin.getThePersistenceManager();
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
if (m.isRestoreComplete()) break;
|
if (m.isRestoreComplete()) break;
|
||||||
|
@ -72,15 +74,17 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
}
|
}
|
||||||
assertTrue("Restore not complete", m.isRestoreComplete());
|
assertTrue("Restore not complete", m.isRestoreComplete());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProfilePersistence() {
|
public void testProfilePersistence() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
/*
|
/*
|
||||||
* Set up this particular test.
|
* Set up this particular test.
|
||||||
*/
|
*/
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
int n = registry.getSystemProfileManager().getSystemProfiles().length;
|
int n = registry.getSystemProfileManager().getSystemProfiles().length;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new profile in this profile manager. This will be the second
|
* Create a new profile in this profile manager. This will be the second
|
||||||
* profile created. Creating a profile causes a commit.
|
* profile created. Creating a profile causes a commit.
|
||||||
|
@ -94,15 +98,15 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload(); // reload not yet working
|
// reload(); // reload not yet working
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There should be one more profile
|
* There should be one more profile
|
||||||
*/
|
*/
|
||||||
ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles();
|
ISystemProfile[] profiles = registry.getSystemProfileManager().getSystemProfiles();
|
||||||
assertEquals(n, profiles.length);
|
assertEquals(n, profiles.length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* One should be default private profile
|
* One should be default private profile
|
||||||
*/
|
*/
|
||||||
|
@ -112,7 +116,7 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
found = p.isDefaultPrivate();
|
found = p.isDefaultPrivate();
|
||||||
}
|
}
|
||||||
assertTrue("Default private profile not found", found);
|
assertTrue("Default private profile not found", found);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* One should be the test profile
|
* One should be the test profile
|
||||||
*/
|
*/
|
||||||
|
@ -122,7 +126,7 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
found = p.getName().equals("bogus");
|
found = p.getName().equals("bogus");
|
||||||
}
|
}
|
||||||
assertTrue("bogus profile not found", found);
|
assertTrue("bogus profile not found", found);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the test profile and check its properties.
|
* Get the test profile and check its properties.
|
||||||
*/
|
*/
|
||||||
|
@ -133,7 +137,7 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
IPropertySet[] pSets = bogus.getPropertySets();
|
IPropertySet[] pSets = bogus.getPropertySets();
|
||||||
assertNotNull(pSets);
|
assertNotNull(pSets);
|
||||||
assertEquals(0, pSets.length);
|
assertEquals(0, pSets.length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a property set to the profile.
|
* Add a property set to the profile.
|
||||||
*/
|
*/
|
||||||
|
@ -141,20 +145,20 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
bogusProperties.addProperty("bp1", "1");
|
bogusProperties.addProperty("bp1", "1");
|
||||||
bogusProperties.addProperty("bp2", "2");
|
bogusProperties.addProperty("bp2", "2");
|
||||||
bogus.addPropertySet(bogusProperties);
|
bogus.addPropertySet(bogusProperties);
|
||||||
|
|
||||||
// nested property set
|
// nested property set
|
||||||
IPropertySet bogusNestedProperties = new PropertySet("bogus_nested_properties");
|
IPropertySet bogusNestedProperties = new PropertySet("bogus_nested_properties");
|
||||||
bogusNestedProperties.addProperty("bnpa", "a");
|
bogusNestedProperties.addProperty("bnpa", "a");
|
||||||
bogusNestedProperties.addProperty("bnpb", "b");
|
bogusNestedProperties.addProperty("bnpb", "b");
|
||||||
bogusProperties.addPropertySet(bogusNestedProperties);
|
bogusProperties.addPropertySet(bogusNestedProperties);
|
||||||
|
|
||||||
bogus.commit();
|
bogus.commit();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Refresh the profile manager.
|
* Refresh the profile manager.
|
||||||
*/
|
*/
|
||||||
// reload(); // reload not yet working
|
// reload(); // reload not yet working
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if everything is still OK and that the properties are restored.
|
* 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);
|
assertNotNull(bogusProperties);
|
||||||
assertEquals("1", bogusProperties.getProperty("bp1").getValue());
|
assertEquals("1", bogusProperties.getProperty("bp1").getValue());
|
||||||
assertEquals("2", bogusProperties.getProperty("bp2").getValue());
|
assertEquals("2", bogusProperties.getProperty("bp2").getValue());
|
||||||
|
|
||||||
bogusNestedProperties = bogusProperties.getPropertySet("bogus_nested_properties");
|
bogusNestedProperties = bogusProperties.getPropertySet("bogus_nested_properties");
|
||||||
assertNotNull(bogusNestedProperties);
|
assertNotNull(bogusNestedProperties);
|
||||||
assertEquals("a", bogusNestedProperties.getProperty("bnpa").getValue());
|
assertEquals("a", bogusNestedProperties.getProperty("bnpa").getValue());
|
||||||
assertEquals("b", bogusNestedProperties.getProperty("bnpb").getValue());
|
assertEquals("b", bogusNestedProperties.getProperty("bnpb").getValue());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
registry.deleteSystemProfile(bogus);
|
registry.deleteSystemProfile(bogus);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// reload(); // reload not yet working
|
// reload(); // reload not yet working
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testHostPersistence() {
|
public void testHostPersistence() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
/*
|
/*
|
||||||
* Set up this particular test.
|
* Set up this particular test.
|
||||||
*/
|
*/
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new profile in this profile manager. This will be the third
|
* Create a new profile in this profile manager. This will be the third
|
||||||
* profile created. Creating a profile causes a commit.
|
* profile created. Creating a profile causes a commit.
|
||||||
|
@ -203,7 +209,7 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
}
|
}
|
||||||
ISystemProfile profile = registry.getSystemProfile("bogus");
|
ISystemProfile profile = registry.getSystemProfile("bogus");
|
||||||
assertNotNull(profile);
|
assertNotNull(profile);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
IRSESystemType linuxType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LINUX_ID);
|
IRSESystemType linuxType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LINUX_ID);
|
||||||
registry.createHost("bogus", linuxType, "myhost", "myhost.mynet.mycompany.net", null);
|
registry.createHost("bogus", linuxType, "myhost", "myhost.mynet.mycompany.net", null);
|
||||||
|
@ -218,9 +224,9 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
props.addProperty("bp2", "2");
|
props.addProperty("bp2", "2");
|
||||||
host.addPropertySet(props);
|
host.addPropertySet(props);
|
||||||
host.commit();
|
host.commit();
|
||||||
|
|
||||||
// reload(); // reload not yet working
|
// reload(); // reload not yet working
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the test profile and check its properties.
|
* Get the test profile and check its properties.
|
||||||
*/
|
*/
|
||||||
|
@ -232,12 +238,12 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
assertNotNull(props);
|
assertNotNull(props);
|
||||||
assertEquals("1", props.getProperty("bp1").getValue());
|
assertEquals("1", props.getProperty("bp1").getValue());
|
||||||
assertEquals("2", props.getProperty("bp2").getValue());
|
assertEquals("2", props.getProperty("bp2").getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reload() {
|
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.
|
* Jobs that are created for reading and writing the persistent form of the model.
|
||||||
*/
|
*/
|
||||||
IRSEPersistenceManager persistenceManager = RSECorePlugin.getThePersistenceManager();
|
IRSEPersistenceManager persistenceManager = RSECorePlugin.getThePersistenceManager();
|
||||||
|
@ -253,12 +259,12 @@ public class PersistenceTest extends RSECoreTestCase {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* restore the profile manager
|
* restore the profile manager
|
||||||
*/
|
*/
|
||||||
RSEUIPlugin.getDefault().restart();
|
RSEUIPlugin.getDefault().restart();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2006, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
|
@ -28,23 +28,25 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
||||||
* Tests for {@link SystemPreferencesManager}.
|
* Tests for {@link SystemPreferencesManager}.
|
||||||
*/
|
*/
|
||||||
public class PreferencesTest extends RSECoreTestCase {
|
public class PreferencesTest extends RSECoreTestCase {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testActiveProfiles() {
|
public void testActiveProfiles() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
RSEPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
|
RSEPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
|
||||||
RSEPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
|
RSEPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
|
||||||
String[] profiles = RSEPreferencesManager.getActiveProfiles();
|
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("bogus01")); //$NON-NLS-1$
|
||||||
assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus99")); //$NON-NLS-1$
|
assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus99")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUserIds() {
|
public void testUserIds() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
RSEPreferencesManager.setUserId("a.b.c", "bogusUser"); //$NON-NLS-1$ //$NON-NLS-2$
|
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$
|
assertEquals("bogusUser", RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
RSEPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$
|
RSEPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$
|
||||||
assertNull(RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$
|
assertNull(RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaultUserIds() {
|
public void testDefaultUserIds() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry();
|
IRSECoreRegistry registry = RSECorePlugin.getTheCoreRegistry();
|
||||||
//TODO should we test deprecated methods as well? Probably yes...
|
//TODO should we test deprecated methods as well? Probably yes...
|
||||||
IRSESystemType systemTypeDeprecated = registry.getSystemType("Local"); //$NON-NLS-1$
|
IRSESystemType systemTypeDeprecated = registry.getSystemType("Local"); //$NON-NLS-1$
|
||||||
|
@ -80,15 +86,17 @@ public class PreferencesTest extends RSECoreTestCase {
|
||||||
RSEPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$
|
RSEPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$
|
||||||
assertEquals("bogus1", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
|
assertEquals("bogus1", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
|
||||||
IRSESystemType localType = RSECorePlugin.getTheCoreRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID);
|
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$
|
assertEquals("bogus2", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
|
||||||
RSEPreferencesManager.setDefaultUserId(systemType, oldValue);
|
RSEPreferencesManager.setDefaultUserId(systemType, oldValue);
|
||||||
assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType));
|
assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShowLocalConnection() {
|
public void testShowLocalConnection() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
assertTrue(SystemPreferencesManager.getShowLocalConnection());
|
assertTrue(SystemPreferencesManager.getShowLocalConnection());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,36 +23,38 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link 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
|
* profiles, hosts, filters, and other model objects. You should run this only in a
|
||||||
* clean workspace.
|
* clean workspace.
|
||||||
*/
|
*/
|
||||||
public class ProfileTest extends RSECoreTestCase {
|
public class ProfileTest extends RSECoreTestCase {
|
||||||
|
|
||||||
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
|
||||||
ISystemProfileManager manager = registry.getSystemProfileManager();
|
ISystemProfileManager manager = registry.getSystemProfileManager();
|
||||||
ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
|
ISystemProfile defaultProfile = manager.getDefaultPrivateSystemProfile();
|
||||||
|
|
||||||
public ProfileTest(String name) {
|
public ProfileTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaultProfileMarking() {
|
public void testDefaultProfileMarking() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
assertNotNull("default profile is null", defaultProfile);
|
assertNotNull("default profile is null", defaultProfile);
|
||||||
assertTrue("default profile is not active - 1", defaultProfile.isActive());
|
assertTrue("default profile is not active - 1", defaultProfile.isActive());
|
||||||
assertTrue("default profile is not marked as default", defaultProfile.isDefaultPrivate());
|
assertTrue("default profile is not marked as default", defaultProfile.isDefaultPrivate());
|
||||||
|
@ -60,6 +62,8 @@ public class ProfileTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testDefaultProfileActivation() {
|
public void testDefaultProfileActivation() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
registry.setSystemProfileActive(defaultProfile, true);
|
registry.setSystemProfileActive(defaultProfile, true);
|
||||||
assertTrue("default profile is not active - 2", defaultProfile.isActive());
|
assertTrue("default profile is not active - 2", defaultProfile.isActive());
|
||||||
registry.setSystemProfileActive(defaultProfile, false); // this should be ignored
|
registry.setSystemProfileActive(defaultProfile, false); // this should be ignored
|
||||||
|
@ -68,6 +72,8 @@ public class ProfileTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testDefaultProfileRename() {
|
public void testDefaultProfileRename() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
ISystemProfile profile = registry.getSystemProfile("bogus");
|
ISystemProfile profile = registry.getSystemProfile("bogus");
|
||||||
assertNull(profile);
|
assertNull(profile);
|
||||||
|
@ -89,6 +95,8 @@ public class ProfileTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testProfileActivation() {
|
public void testProfileActivation() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
ISystemProfile profile = registry.getSystemProfile("bogus");
|
ISystemProfile profile = registry.getSystemProfile("bogus");
|
||||||
assertNull(profile);
|
assertNull(profile);
|
||||||
|
@ -107,6 +115,8 @@ public class ProfileTest extends RSECoreTestCase {
|
||||||
|
|
||||||
public void testDefaultProfileDeletion() {
|
public void testDefaultProfileDeletion() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
registry.deleteSystemProfile(defaultProfile); // this should be ignored
|
registry.deleteSystemProfile(defaultProfile); // this should be ignored
|
||||||
List profiles = Arrays.asList(manager.getSystemProfiles());
|
List profiles = Arrays.asList(manager.getSystemProfiles());
|
||||||
|
@ -116,9 +126,11 @@ public class ProfileTest extends RSECoreTestCase {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testProfileDeletion() {
|
public void testProfileDeletion() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
ISystemProfile profile = registry.getSystemProfile("bogus");
|
ISystemProfile profile = registry.getSystemProfile("bogus");
|
||||||
assertNull(profile);
|
assertNull(profile);
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: Kevin Doyle.
|
* component that contains this file: Kevin Doyle.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
|
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
|
||||||
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
||||||
|
@ -46,50 +46,53 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
||||||
|
|
||||||
private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
|
private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
|
||||||
IRemoteFileSubSystem fss = null;
|
IRemoteFileSubSystem fss = null;
|
||||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||||
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
|
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
|
||||||
for (int i=0; i<ss.length; i++) {
|
for (int i=0; i<ss.length; i++) {
|
||||||
if (ss[i] instanceof FileServiceSubSystem) {
|
if (ss[i] instanceof FileServiceSubSystem) {
|
||||||
fss = (IRemoteFileSubSystem)ss[i];
|
fss = (IRemoteFileSubSystem)ss[i];
|
||||||
return fss;
|
return fss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateFileFTP() throws Exception {
|
public void testCreateFileFTP() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
|
host = getFTPHost();
|
||||||
host = getFTPHost();
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
createFileAndAssertProperties();
|
createFileAndAssertProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateFileLinux() throws Exception {
|
public void testCreateFileLinux() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
|
|
||||||
// Lookup and create the connection now if necessary
|
|
||||||
host = getLinuxHost();
|
host = getLinuxHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
createFileAndAssertProperties();
|
createFileAndAssertProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateFileSSH() throws Exception {
|
public void testCreateFileSSH() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
|
host = getSSHHost();
|
||||||
host = getSSHHost();
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
createFileAndAssertProperties();
|
createFileAndAssertProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateFileWindows() throws Exception {
|
public void testCreateFileWindows() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
|
host = getWindowsHost();
|
||||||
host = getWindowsHost();
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
createFileAndAssertProperties();
|
createFileAndAssertProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createFileAndAssertProperties() throws Exception {
|
public void createFileAndAssertProperties() throws Exception {
|
||||||
String SYSTEM_TYPE = host.getSystemType().getLabel();
|
String SYSTEM_TYPE = host.getSystemType().getLabel();
|
||||||
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
||||||
|
|
||||||
// Need to create a temporary directory for the new file to be created in.
|
// 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.
|
// this is to ensure we don't overwrite any previous files.
|
||||||
inputFss.connect(new NullProgressMonitor(), false);
|
inputFss.connect(new NullProgressMonitor(), false);
|
||||||
|
@ -98,7 +101,7 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
||||||
String homeFolderName = homeDirectory.getAbsolutePath();
|
String homeFolderName = homeDirectory.getAbsolutePath();
|
||||||
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
||||||
tempDirectory = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
tempDirectory = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
||||||
|
|
||||||
tempDirPath = tempDirectory.getAbsolutePath();
|
tempDirPath = tempDirectory.getAbsolutePath();
|
||||||
IHostFile hostfile = inputFss.getFileService().createFile(tempDirPath, fileName, new NullProgressMonitor());
|
IHostFile hostfile = inputFss.getFileService().createFile(tempDirPath, fileName, new NullProgressMonitor());
|
||||||
assertTrue(SYSTEM_TYPE + ": hostfile doesn't exist.", hostfile.exists());
|
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());
|
assertEquals(SYSTEM_TYPE + ": file size's do not match.", 0, hostfile.getSize());
|
||||||
long modDate = hostfile.getModifiedDate();
|
long modDate = hostfile.getModifiedDate();
|
||||||
assertTrue(SYSTEM_TYPE + ": modification date is not greater than 0.", modDate > 0);
|
assertTrue(SYSTEM_TYPE + ": modification date is not greater than 0.", modDate > 0);
|
||||||
|
|
||||||
// perform cleanup, so EFS uses the right file service next time
|
// perform cleanup, so EFS uses the right file service next time
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() throws Exception {
|
public void cleanup() throws Exception {
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
if (tempDirectory != null) {
|
if (tempDirectory != null) {
|
||||||
|
@ -127,10 +130,10 @@ public class CreateFileTestCase extends FileServiceBaseTest {
|
||||||
host = null;
|
host = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
cleanup();
|
cleanup();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2008 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Uwe Stieber (Wind River) - initial API and implementation.
|
* Uwe Stieber (Wind River) - initial API and implementation.
|
||||||
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
* Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
|
||||||
* David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect()
|
* 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.IFileService;
|
||||||
import org.eclipse.rse.services.files.IHostFile;
|
import org.eclipse.rse.services.files.IHostFile;
|
||||||
import org.eclipse.rse.subsystems.files.ftp.FTPFileSubSystemConfiguration;
|
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.RSEWaitAndDispatchUtil;
|
||||||
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
|
import org.eclipse.rse.tests.core.connection.IRSEConnectionProperties;
|
||||||
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
||||||
|
@ -42,7 +41,7 @@ import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||||
private ISubSystem subSystem;
|
private ISubSystem subSystem;
|
||||||
private IHost connection;
|
private IHost connection;
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +55,7 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
subSystem = null;
|
subSystem = null;
|
||||||
connection = null;
|
connection = null;
|
||||||
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,11 +64,12 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||||
*/
|
*/
|
||||||
public void testFTPReadAccessToRemoteHost() {
|
public void testFTPReadAccessToRemoteHost() {
|
||||||
//-test-author-:UweStieber
|
//-test-author-:UweStieber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FTPFileSubsystemTestCase.testFTPReadAccessToRemoteHost")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry systemRegistry = RSECorePlugin.getTheSystemRegistry();
|
||||||
assertNotNull("Failed to get RSE system registry instance!", systemRegistry); //$NON-NLS-1$
|
assertNotNull("Failed to get RSE system registry instance!", systemRegistry); //$NON-NLS-1$
|
||||||
|
|
||||||
// Calculate the location of the test connection properties
|
// Calculate the location of the test connection properties
|
||||||
IPath location = getTestDataLocation("testFTPReadAccessToRemoteHost", false); //$NON-NLS-1$
|
IPath location = getTestDataLocation("testFTPReadAccessToRemoteHost", false); //$NON-NLS-1$
|
||||||
assertNotNull("Cannot locate test data! Missing test data location?", location); //$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$
|
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 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$
|
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
|
// Load the properties from the calculated location without backing up defaults
|
||||||
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
|
IRSEConnectionProperties properties = getConnectionManager().loadConnectionProperties(location, false);
|
||||||
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
|
assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$
|
||||||
|
|
||||||
// Lookup and create the connection now if necessary
|
// Lookup and create the connection now if necessary
|
||||||
connection = getConnectionManager().findOrCreateConnection(properties);
|
connection = getConnectionManager().findOrCreateConnection(properties);
|
||||||
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$
|
assertNotNull("Failed to create connection " + properties.getProperty(IRSEConnectionProperties.ATTR_NAME), connection); //$NON-NLS-1$
|
||||||
// expand the connection in the UI
|
// expand the connection in the UI
|
||||||
RSEUIPlugin.getTheSystemRegistryUI().expandHost(connection);
|
RSEUIPlugin.getTheSystemRegistryUI().expandHost(connection);
|
||||||
|
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
String cause = null;
|
String cause = null;
|
||||||
|
|
||||||
subSystem = null;
|
subSystem = null;
|
||||||
try {
|
try {
|
||||||
subSystem = getConnectionManager().getFileSubSystem(connection, "ftp.files"); //$NON-NLS-1$
|
subSystem = getConnectionManager().getFileSubSystem(connection, "ftp.files"); //$NON-NLS-1$
|
||||||
|
@ -103,12 +103,12 @@ public class FTPFileSubsystemTestCase extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
ISubSystemConfiguration configuration = subSystem.getSubSystemConfiguration();
|
ISubSystemConfiguration configuration = subSystem.getSubSystemConfiguration();
|
||||||
assertNotNull("Failed to get ftp.files subsystem configuration instance!", configuration); //$NON-NLS-1$
|
assertNotNull("Failed to get ftp.files subsystem configuration instance!", configuration); //$NON-NLS-1$
|
||||||
|
|
||||||
// The ftp.files subsystem supports filtering, therefor ISubSystem.getChildren() is expected
|
// The ftp.files subsystem supports filtering, therefor ISubSystem.getChildren() is expected
|
||||||
// to return a non null value.
|
// to return a non null value.
|
||||||
assertTrue("Unexpected return value false for ftp.files subsystem configuration supportFilters()!", configuration.supportsFilters()); //$NON-NLS-1$
|
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$
|
assertNotNull("Unexpected return value null for ftp.files subsystem getChildren()!", subSystem.getChildren()); //$NON-NLS-1$
|
||||||
|
|
||||||
// get access to the services
|
// get access to the services
|
||||||
assertTrue("ftp.files subsystem configuration instance is not of expected type FileServiceSubSystemConfiguration!", configuration instanceof FTPFileSubSystemConfiguration); //$NON-NLS-1$
|
assertTrue("ftp.files subsystem configuration instance is not of expected type FileServiceSubSystemConfiguration!", configuration instanceof FTPFileSubSystemConfiguration); //$NON-NLS-1$
|
||||||
FTPFileSubSystemConfiguration ftpConfiguration = (FTPFileSubSystemConfiguration)configuration;
|
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$
|
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$
|
assertTrue("IFileService instance is not of expected type FTPService!", service instanceof FTPService); //$NON-NLS-1$
|
||||||
final FTPService ftpService = (FTPService)service;
|
final FTPService ftpService = (FTPService)service;
|
||||||
|
|
||||||
// configure the service to use passive ftp
|
// configure the service to use passive ftp
|
||||||
IPropertySet set = new PropertySet("testFTPReadAccessToRemoteHost"); //$NON-NLS-1$
|
IPropertySet set = new PropertySet("testFTPReadAccessToRemoteHost"); //$NON-NLS-1$
|
||||||
set.addProperty("passive", "true"); //$NON-NLS-1$ //$NON-NLS-2$
|
set.addProperty("passive", "true"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ftpService.setPropertySet(set);
|
ftpService.setPropertySet(set);
|
||||||
|
|
||||||
// we expect that the subsystem is not connected yet
|
// we expect that the subsystem is not connected yet
|
||||||
assertFalse("ftp.files subsystem is unexpectedly connected!", subSystem.isConnected()); //$NON-NLS-1$
|
assertFalse("ftp.files subsystem is unexpectedly connected!", subSystem.isConnected()); //$NON-NLS-1$
|
||||||
try {
|
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
|
// 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.
|
// or exceeded the max number of connection or ... or ... or ... Just do not fail in this case.
|
||||||
if (!subSystem.isConnected() || !ftpService.isConnected()) return;
|
if (!subSystem.isConnected() || !ftpService.isConnected()) return;
|
||||||
|
|
||||||
// expand the subsystem
|
// expand the subsystem
|
||||||
RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(subSystem);
|
RSEUIPlugin.getTheSystemRegistryUI().expandSubSystem(subSystem);
|
||||||
|
|
||||||
// now we have the service reference and can start reading things from the server
|
// now we have the service reference and can start reading things from the server
|
||||||
IHostFile[] roots = ftpService.getRoots(new NullProgressMonitor());
|
IHostFile[] roots = ftpService.getRoots(new NullProgressMonitor());
|
||||||
assertNotNull("Failed to get root nodes from ftp.files service!", roots); //$NON-NLS-1$
|
assertNotNull("Failed to get root nodes from ftp.files service!", roots); //$NON-NLS-1$
|
||||||
|
|
||||||
FTPClient ftpClient = ftpService.getFTPClient();
|
FTPClient ftpClient = ftpService.getFTPClient();
|
||||||
assertNotNull("Failed to get FTPClient instance!", ftpClient); //$NON-NLS-1$
|
assertNotNull("Failed to get FTPClient instance!", ftpClient); //$NON-NLS-1$
|
||||||
|
|
||||||
exception = null;
|
exception = null;
|
||||||
cause = null;
|
cause = null;
|
||||||
|
|
||||||
FTPFile[] files = null;
|
FTPFile[] files = null;
|
||||||
try {
|
try {
|
||||||
files = ftpClient.listFiles();
|
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$
|
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$
|
assertNotNull("Unexpected return value null for FTPClient.listFiles()!", files); //$NON-NLS-1$
|
||||||
|
|
||||||
if (ftpService.isConnected()) ftpService.disconnect();
|
if (ftpService.isConnected()) ftpService.disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: Kevin Doyle
|
* component that contains this file: Kevin Doyle
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
|
* Martin Oberhuber (Wind River) - [cleanup] Avoid using SystemStartHere in production code
|
||||||
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
* Martin Oberhuber (Wind River) - organize, enable and tag test cases
|
||||||
|
@ -49,82 +49,102 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
||||||
|
|
||||||
private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
|
private IRemoteFileSubSystem getRemoteFileSubSystem(IHost host) {
|
||||||
IRemoteFileSubSystem fss = null;
|
IRemoteFileSubSystem fss = null;
|
||||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||||
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
|
ISubSystem[] ss = sr.getServiceSubSystems(host, IFileService.class);
|
||||||
for (int i=0; i<ss.length; i++) {
|
for (int i=0; i<ss.length; i++) {
|
||||||
if (ss[i] instanceof FileServiceSubSystem) {
|
if (ss[i] instanceof FileServiceSubSystem) {
|
||||||
fss = (IRemoteFileSubSystem)ss[i];
|
fss = (IRemoteFileSubSystem)ss[i];
|
||||||
return fss;
|
return fss;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreAppendOutputStreamLocal() throws Exception {
|
public void testRSEFileStoreAppendOutputStreamLocal() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getLocalSystemConnection();
|
host = getLocalSystemConnection();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.APPEND);
|
outputStreamFileWriting(EFS.APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreAppendOutputStreamFTP() throws Exception {
|
public void testRSEFileStoreAppendOutputStreamFTP() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getFTPHost();
|
host = getFTPHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.APPEND);
|
outputStreamFileWriting(EFS.APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreAppendOutputStreamLinux() throws Exception {
|
public void testRSEFileStoreAppendOutputStreamLinux() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getLinuxHost();
|
host = getLinuxHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.APPEND);
|
outputStreamFileWriting(EFS.APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreAppendOutputStreamWindows() throws Exception {
|
public void testRSEFileStoreAppendOutputStreamWindows() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getWindowsHost();
|
host = getWindowsHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.APPEND);
|
outputStreamFileWriting(EFS.APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreAppendOutputStreamSSH() throws Exception {
|
public void testRSEFileStoreAppendOutputStreamSSH() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getSSHHost();
|
host = getSSHHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.APPEND);
|
outputStreamFileWriting(EFS.APPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreOverwriteOutputStreamLocal() throws Exception {
|
public void testRSEFileStoreOverwriteOutputStreamLocal() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getLocalSystemConnection();
|
host = getLocalSystemConnection();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.NONE);
|
outputStreamFileWriting(EFS.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreOverwriteOutputStreamFTP() throws Exception {
|
public void testRSEFileStoreOverwriteOutputStreamFTP() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getFTPHost();
|
host = getFTPHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.NONE);
|
outputStreamFileWriting(EFS.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreOverwriteOutputStreamLinux() throws Exception {
|
public void testRSEFileStoreOverwriteOutputStreamLinux() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getLinuxHost();
|
host = getLinuxHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.NONE);
|
outputStreamFileWriting(EFS.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreOverwriteOutputStreamWindows() throws Exception {
|
public void testRSEFileStoreOverwriteOutputStreamWindows() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getWindowsHost();
|
host = getWindowsHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.NONE);
|
outputStreamFileWriting(EFS.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRSEFileStoreOverwriteOutputStreamSSH() throws Exception {
|
public void testRSEFileStoreOverwriteOutputStreamSSH() throws Exception {
|
||||||
//-test-author-:KevinDoyle
|
//-test-author-:KevinDoyle
|
||||||
host = getSSHHost();
|
host = getSSHHost();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
outputStreamFileWriting(EFS.NONE);
|
outputStreamFileWriting(EFS.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void outputStreamFileWriting(int options) throws Exception {
|
public void outputStreamFileWriting(int options) throws Exception {
|
||||||
// RSE URI: rse://SYSTEM_ADDRESS/PATH_TO_FIlE
|
// RSE URI: rse://SYSTEM_ADDRESS/PATH_TO_FIlE
|
||||||
OutputStream outputStream = null;
|
OutputStream outputStream = null;
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
|
|
||||||
// Create temporary folder
|
// Create temporary folder
|
||||||
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
FileServiceSubSystem inputFss = (FileServiceSubSystem) getRemoteFileSubSystem(host);
|
||||||
inputFss.connect(new NullProgressMonitor(), false);
|
inputFss.connect(new NullProgressMonitor(), false);
|
||||||
|
@ -134,37 +154,37 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
||||||
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
String testFolderName = FileServiceHelper.getRandomLocation(inputFss, homeFolderName, baseFolderName, new NullProgressMonitor());
|
||||||
IRemoteFile targetDir = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
IRemoteFile targetDir = createFileOrFolder(inputFss, homeFolderName, testFolderName, true);
|
||||||
tempDirectory = targetDir;
|
tempDirectory = targetDir;
|
||||||
|
|
||||||
String path = targetDir.getAbsolutePath();
|
String path = targetDir.getAbsolutePath();
|
||||||
|
|
||||||
String systemType = host.getSystemType().getLabel();
|
String systemType = host.getSystemType().getLabel();
|
||||||
if (host.getSystemType().isWindows()) {
|
if (host.getSystemType().isWindows()) {
|
||||||
path = path.replace('\\', '/');
|
path = path.replace('\\', '/');
|
||||||
}
|
}
|
||||||
path = fixPathForURI(path);
|
path = fixPathForURI(path);
|
||||||
URI uri = new URI("rse", host.getHostName(), path, null);
|
URI uri = new URI("rse", host.getHostName(), path, null);
|
||||||
|
|
||||||
IFileStore parentFS = RSEFileStore.getInstance(uri);
|
IFileStore parentFS = RSEFileStore.getInstance(uri);
|
||||||
createDir(parentFS, true);
|
createDir(parentFS, true);
|
||||||
|
|
||||||
IFileStore childFS = parentFS.getChild("append.txt");
|
IFileStore childFS = parentFS.getChild("append.txt");
|
||||||
|
|
||||||
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
||||||
|
|
||||||
String contents = getRandomString();
|
String contents = getRandomString();
|
||||||
byte[] readBytes = new byte[contents.length()];
|
byte[] readBytes = new byte[contents.length()];
|
||||||
outputStream.write(contents.getBytes());
|
outputStream.write(contents.getBytes());
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
||||||
inputStream.read(readBytes);
|
inputStream.read(readBytes);
|
||||||
|
|
||||||
String input = new String(readBytes);
|
String input = new String(readBytes);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
assertTrue(systemType + ": Contents incorrect writing to an empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input));
|
assertTrue(systemType + ": Contents incorrect writing to an empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input));
|
||||||
|
|
||||||
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
outputStream = childFS.openOutputStream(options, new NullProgressMonitor());
|
||||||
|
|
||||||
String write = " " + getRandomString();
|
String write = " " + getRandomString();
|
||||||
if ((options & EFS.APPEND) != 0) {
|
if ((options & EFS.APPEND) != 0) {
|
||||||
contents += write;
|
contents += write;
|
||||||
|
@ -173,23 +193,23 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
||||||
}
|
}
|
||||||
outputStream.write(write.getBytes());
|
outputStream.write(write.getBytes());
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
readBytes = new byte[contents.length()];
|
readBytes = new byte[contents.length()];
|
||||||
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
inputStream = childFS.openInputStream(EFS.NONE, new NullProgressMonitor());
|
||||||
inputStream.read(readBytes);
|
inputStream.read(readBytes);
|
||||||
|
|
||||||
input = new String(readBytes);
|
input = new String(readBytes);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
assertTrue(systemType + ": Contents incorrect writing to a non-empty file. Expected Contents: " + contents + " Actual Contents: " + input, contents.equals(input));
|
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, so IFileStore uses the correct connection next time.
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapt a local file system path such that it can be used as
|
* Adapt a local file system path such that it can be used as
|
||||||
* path in an URI. Converts path delimiters do '/' default
|
* path in an URI. Converts path delimiters do '/' default
|
||||||
* delimiter, and adds a slash in front if necessary.
|
* delimiter, and adds a slash in front if necessary.
|
||||||
*
|
*
|
||||||
* Copied from RSEFileSystemContributor as it's private
|
* Copied from RSEFileSystemContributor as it's private
|
||||||
* @param path the path to adapt
|
* @param path the path to adapt
|
||||||
* @return adapted path
|
* @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>
|
//</adapted from org.eclipse.core.filesystem.URIUtil.toURI() Copyright(c) 2005, 2006 IBM>
|
||||||
return pathBuf.toString();
|
return pathBuf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanup() throws Exception {
|
public void cleanup() throws Exception {
|
||||||
if (host != null) {
|
if (host != null) {
|
||||||
if (tempDirectory != null) {
|
if (tempDirectory != null) {
|
||||||
|
@ -225,7 +245,7 @@ public class FileOutputStreamTestCase extends FileServiceBaseTest {
|
||||||
host = null;
|
host = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
cleanup();
|
cleanup();
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest
|
* Johnson Ma (Wind River) - [195402] Extracted from FileServiceArchiveTest
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.rse.tests.subsystems.files;
|
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.core.subsystems.ISystemDragDropAdapter;
|
||||||
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
import org.eclipse.rse.files.ui.resources.UniversalFileTransferUtility;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
|
||||||
|
|
||||||
public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
protected String folderToCopyName1 = "RemoteSystemsConnections";
|
protected String folderToCopyName1 = "RemoteSystemsConnections";
|
||||||
protected String folderToCopyName2 = "6YLT5Xa";
|
protected String folderToCopyName2 = "6YLT5Xa";
|
||||||
protected String folderToCopyName3 = "folderToCopy";
|
protected String folderToCopyName3 = "folderToCopy";
|
||||||
|
|
||||||
protected String tarSourceFileName1;
|
protected String tarSourceFileName1;
|
||||||
protected String tarSourceFileName2;
|
protected String tarSourceFileName2;
|
||||||
|
|
||||||
protected String tarSourceFolderName1 = "META-INF";
|
protected String tarSourceFolderName1 = "META-INF";
|
||||||
protected String tarSourceFolderName2 = "org";
|
protected String tarSourceFolderName2 = "org";
|
||||||
|
|
||||||
protected String tarSourceForOpenTest;
|
protected String tarSourceForOpenTest;
|
||||||
protected String tarSourceForOpenFolderName1 = "META-INF";
|
protected String tarSourceForOpenFolderName1 = "META-INF";
|
||||||
protected String tarSourceForOpenFolderName2 = "org";
|
protected String tarSourceForOpenFolderName2 = "org";
|
||||||
|
|
||||||
protected String testName;
|
protected String testName;
|
||||||
|
|
||||||
protected String fileContentString1 = "this is just some dummy content \n to a remote file \n to test an open operation";
|
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) {
|
public FileServiceArchiveBaseTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IWorkspace getWorkspace() {
|
public static IWorkspace getWorkspace() {
|
||||||
return ResourcesPlugin.getWorkspace();
|
return ResourcesPlugin.getWorkspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSourceFolders() throws Exception
|
public void createSourceFolders() throws Exception
|
||||||
{
|
{
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
IFileStore temp = createDir(tempPath, true);
|
IFileStore temp = createDir(tempPath, true);
|
||||||
String content = getRandomString();
|
String content = getRandomString();
|
||||||
|
|
||||||
// create the source folder used for copy or move
|
// create the source folder used for copy or move
|
||||||
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
||||||
createDir(folderToCopy, true);
|
createDir(folderToCopy, true);
|
||||||
|
@ -81,7 +80,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12aaaa, content);
|
createFile(epdcdump01_hex12aaaa, content);
|
||||||
|
|
||||||
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
||||||
createDir(aaaab, true);
|
createDir(aaaab, true);
|
||||||
IFileStore features = aaaab.getChild("features");
|
IFileStore features = aaaab.getChild("features");
|
||||||
|
@ -94,15 +93,15 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12a, content);
|
createFile(epdcdump01_hex12a, content);
|
||||||
|
|
||||||
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12a1, content);
|
createFile(epdcdump01_hex12a1, content);
|
||||||
|
|
||||||
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(RSE_SDK_2_0RC1_zip, content);
|
createFile(RSE_SDK_2_0RC1_zip, content);
|
||||||
|
|
||||||
//now, copy folderToCopy into the folder in the remote system
|
//now, copy folderToCopy into the folder in the remote system
|
||||||
IRemoteFile sourceFolderToCopy3 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
IRemoteFile sourceFolderToCopy3 = localFss.getRemoteFileObject(tempPath + '\\' + folderToCopyName3, mon);
|
||||||
ISystemDragDropAdapter srcAdapter3 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy3).getAdapter(ISystemDragDropAdapter.class);
|
ISystemDragDropAdapter srcAdapter3 = (ISystemDragDropAdapter) ((IAdaptable) sourceFolderToCopy3).getAdapter(ISystemDragDropAdapter.class);
|
||||||
|
@ -110,20 +109,20 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fromSet3.addResource(sourceFolderToCopy3);
|
fromSet3.addResource(sourceFolderToCopy3);
|
||||||
ISystemResourceSet tempObjects3 = srcAdapter3.doDrag(fromSet3, mon);
|
ISystemResourceSet tempObjects3 = srcAdapter3.doDrag(fromSet3, mon);
|
||||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true);
|
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects3, tempDir, mon, true);
|
||||||
|
|
||||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||||
fss.resolveFilterString(tempDir, null, mon);
|
fss.resolveFilterString(tempDir, null, mon);
|
||||||
|
|
||||||
//Then, delete the temp folder in the junit workspace.
|
//Then, delete the temp folder in the junit workspace.
|
||||||
temp.delete(EFS.NONE, mon);
|
temp.delete(EFS.NONE, mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
|
||||||
|
protected void createSuperTransferFolder(IFileStore temp) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
String content = getRandomString();
|
String content = getRandomString();
|
||||||
|
|
||||||
// create the source folder used for copy or move
|
// create the source folder used for copy or move
|
||||||
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
IFileStore folderToCopy = temp.getChild(folderToCopyName3);
|
||||||
createDir(folderToCopy, true);
|
createDir(folderToCopy, true);
|
||||||
|
@ -142,7 +141,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
IFileStore epdcdump01_hex12aaaa = aaaaaaaa.getChild("epdcdump01.hex12aaaa");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12aaaa, content);
|
createFile(epdcdump01_hex12aaaa, content);
|
||||||
|
|
||||||
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
IFileStore aaaab = folderToCopy.getChild("aaaab");
|
||||||
createDir(aaaab, true);
|
createDir(aaaab, true);
|
||||||
IFileStore features = aaaab.getChild("features");
|
IFileStore features = aaaab.getChild("features");
|
||||||
|
@ -155,25 +154,25 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
IFileStore epdcdump01_hex12a = aaaab.getChild("epdcdump01.hex12a");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12a, content);
|
createFile(epdcdump01_hex12a, content);
|
||||||
|
|
||||||
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
IFileStore epdcdump01_hex12a1 = folderToCopy.getChild("epdcdump01.hex12a");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(epdcdump01_hex12a1, content);
|
createFile(epdcdump01_hex12a1, content);
|
||||||
|
|
||||||
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
IFileStore RSE_SDK_2_0RC1_zip = folderToCopy.getChild("RSE-SDK-2.0RC1.zip");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(RSE_SDK_2_0RC1_zip, content);
|
createFile(RSE_SDK_2_0RC1_zip, content);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createTarSourceForOpen() throws Exception
|
public void createTarSourceForOpen() throws Exception
|
||||||
{
|
{
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
IFileStore temp = createDir(tempPath, true);
|
IFileStore temp = createDir(tempPath, true);
|
||||||
String content = getRandomString();
|
String content = getRandomString();
|
||||||
|
|
||||||
//Now, we need to construct a "source.tar" archive file
|
//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"
|
//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.
|
//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");
|
IFileStore MANIFEST_MF = META_INF.getChild("MANIFEST.MF");
|
||||||
content = fileContentString1;
|
content = fileContentString1;
|
||||||
createFile(MANIFEST_MF, content);
|
createFile(MANIFEST_MF, content);
|
||||||
|
|
||||||
//create folder "org"
|
//create folder "org"
|
||||||
IFileStore org = temp.getChild("org");
|
IFileStore org = temp.getChild("org");
|
||||||
createDir(org, true);
|
createDir(org, true);
|
||||||
|
@ -197,7 +196,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
createDir(core, true);
|
createDir(core, true);
|
||||||
IFileStore internal = dstore.getChild("internal");
|
IFileStore internal = dstore.getChild("internal");
|
||||||
createDir(internal, true);
|
createDir(internal, true);
|
||||||
|
|
||||||
//now create directory inside "core":
|
//now create directory inside "core":
|
||||||
IFileStore client = core.getChild("client");
|
IFileStore client = core.getChild("client");
|
||||||
createDir(client, true);
|
createDir(client, true);
|
||||||
|
@ -214,7 +213,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Activator_java = core.getChild("Activator.java");
|
IFileStore Activator_java = core.getChild("Activator.java");
|
||||||
content = fileContentString1;
|
content = fileContentString1;
|
||||||
createFile(Activator_java, content);
|
createFile(Activator_java, content);
|
||||||
|
|
||||||
//now, some contents on client folder
|
//now, some contents on client folder
|
||||||
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -222,12 +221,12 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
||||||
content = fileContentString1;
|
content = fileContentString1;
|
||||||
createFile(ConnectionStatus_java, content);
|
createFile(ConnectionStatus_java, content);
|
||||||
|
|
||||||
//now, some contents in java folder
|
//now, some contents in java folder
|
||||||
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
||||||
|
|
||||||
//now, some contents in miners folder
|
//now, some contents in miners folder
|
||||||
IFileStore Miner_java = miners.getChild("Miner.java");
|
IFileStore Miner_java = miners.getChild("Miner.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -235,7 +234,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(MinerThread_java, content);
|
createFile(MinerThread_java, content);
|
||||||
|
|
||||||
//now, some contents in model folder
|
//now, some contents in model folder
|
||||||
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -246,21 +245,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Handler_java = model.getChild("Handler.java");
|
IFileStore Handler_java = model.getChild("Handler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Handler_java, content);
|
createFile(Handler_java, content);
|
||||||
|
|
||||||
//now, some contents in server folder
|
//now, some contents in server folder
|
||||||
IFileStore Server_java = server.getChild("Server.java");
|
IFileStore Server_java = server.getChild("Server.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Server_java, content);
|
createFile(Server_java, content);
|
||||||
|
|
||||||
//now, some contents in util folder
|
//now, some contents in util folder
|
||||||
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
||||||
content = fileContentString1;
|
content = fileContentString1;
|
||||||
createFile(StringCompare_java, content);
|
createFile(StringCompare_java, content);
|
||||||
|
|
||||||
//now, create the contents in "internal" folder
|
//now, create the contents in "internal" folder
|
||||||
IFileStore core1 = internal.getChild("core");
|
IFileStore core1 = internal.getChild("core");
|
||||||
createDir(core1, true);
|
createDir(core1, true);
|
||||||
|
|
||||||
//then create some folder in this "core" folder
|
//then create some folder in this "core" folder
|
||||||
IFileStore client1 = core1.getChild("client");
|
IFileStore client1 = core1.getChild("client");
|
||||||
createDir(client1, true);
|
createDir(client1, true);
|
||||||
|
@ -270,7 +269,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
createDir(server1, true);
|
createDir(server1, true);
|
||||||
IFileStore util1 = core1.getChild("util");
|
IFileStore util1 = core1.getChild("util");
|
||||||
createDir(util1, true);
|
createDir(util1, true);
|
||||||
|
|
||||||
//now, some contents on client folder
|
//now, some contents on client folder
|
||||||
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -278,8 +277,8 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(ConnectionStatus_java1, content);
|
createFile(ConnectionStatus_java1, content);
|
||||||
|
|
||||||
|
|
||||||
//now, some contents in model folder
|
//now, some contents in model folder
|
||||||
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -290,17 +289,17 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Handler_java1, content);
|
createFile(Handler_java1, content);
|
||||||
|
|
||||||
//now, some contents in server folder
|
//now, some contents in server folder
|
||||||
IFileStore Server_java1 = server1.getChild("Server.java");
|
IFileStore Server_java1 = server1.getChild("Server.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Server_java1, content);
|
createFile(Server_java1, content);
|
||||||
|
|
||||||
//now, some contents in util folder
|
//now, some contents in util folder
|
||||||
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(StringCompare_java1, content);
|
createFile(StringCompare_java1, content);
|
||||||
|
|
||||||
//now, copy META_INF into the folder in the remote system
|
//now, copy META_INF into the folder in the remote system
|
||||||
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName1, mon);
|
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName1, mon);
|
||||||
assertNotNull(META_INF_folder);
|
assertNotNull(META_INF_folder);
|
||||||
|
@ -309,7 +308,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fromSet.addResource(META_INF_folder);
|
fromSet.addResource(META_INF_folder);
|
||||||
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
||||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
||||||
|
|
||||||
//now, copy org into the folder in the remote system
|
//now, copy org into the folder in the remote system
|
||||||
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName2, mon);
|
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceForOpenFolderName2, mon);
|
||||||
assertNotNull(org_folder);
|
assertNotNull(org_folder);
|
||||||
|
@ -318,31 +317,31 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fromSet2.addResource(org_folder);
|
fromSet2.addResource(org_folder);
|
||||||
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
||||||
|
|
||||||
//now, create tar file in the host
|
//now, create tar file in the host
|
||||||
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceForOpenTest, false);
|
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceForOpenTest, false);
|
||||||
assertNotNull(tarSource);
|
assertNotNull(tarSource);
|
||||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName1);
|
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName1);
|
||||||
assertNotNull(tarSourceFolder1);
|
assertNotNull(tarSourceFolder1);
|
||||||
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName2);
|
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceForOpenFolderName2);
|
||||||
fss.copy(tarSourceFolder1, tarSource, tarSourceForOpenFolderName1, mon);
|
fss.copy(tarSourceFolder1, tarSource, tarSourceForOpenFolderName1, mon);
|
||||||
fss.copy(tarSourceFolder2, tarSource, tarSourceForOpenFolderName2, mon);
|
fss.copy(tarSourceFolder2, tarSource, tarSourceForOpenFolderName2, mon);
|
||||||
|
|
||||||
//Then, we need to retrieve children of the tempDir to cache their information.
|
//Then, we need to retrieve children of the tempDir to cache their information.
|
||||||
fss.resolveFilterString(tempDir, null, mon);
|
fss.resolveFilterString(tempDir, null, mon);
|
||||||
|
|
||||||
//Then, delete the temp folder in the junit workspace.
|
//Then, delete the temp folder in the junit workspace.
|
||||||
temp.delete(EFS.NONE, mon);
|
temp.delete(EFS.NONE, mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void createSourceTarFiles() throws Exception
|
public void createSourceTarFiles() throws Exception
|
||||||
{
|
{
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
IFileStore temp = createDir(tempPath, true);
|
IFileStore temp = createDir(tempPath, true);
|
||||||
String content = getRandomString();
|
String content = getRandomString();
|
||||||
|
|
||||||
//Now, we need to construct a "source.tar" archive file
|
//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"
|
//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.
|
//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);
|
createDir(core, true);
|
||||||
IFileStore internal = dstore.getChild("internal");
|
IFileStore internal = dstore.getChild("internal");
|
||||||
createDir(internal, true);
|
createDir(internal, true);
|
||||||
|
|
||||||
//now create directory inside "core":
|
//now create directory inside "core":
|
||||||
IFileStore client = core.getChild("client");
|
IFileStore client = core.getChild("client");
|
||||||
createDir(client, true);
|
createDir(client, true);
|
||||||
|
@ -382,7 +381,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Activator_java = core.getChild("Activator.java");
|
IFileStore Activator_java = core.getChild("Activator.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Activator_java, content);
|
createFile(Activator_java, content);
|
||||||
|
|
||||||
//now, some contents on client folder
|
//now, some contents on client folder
|
||||||
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
IFileStore ClientConnection_java = client.getChild("ClientConnection.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -390,12 +389,12 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
IFileStore ConnectionStatus_java = client.getChild("ConnectionStatus.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(ConnectionStatus_java, content);
|
createFile(ConnectionStatus_java, content);
|
||||||
|
|
||||||
//now, some contents in java folder
|
//now, some contents in java folder
|
||||||
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
IFileStore ClassByteStreamHandler$ReceiveClassInstanceThread_java = java.getChild("ClassByteStreamHandler$ReceiveClassInstanceThread.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
createFile(ClassByteStreamHandler$ReceiveClassInstanceThread_java, content);
|
||||||
|
|
||||||
//now, some contents in miners folder
|
//now, some contents in miners folder
|
||||||
IFileStore Miner_java = miners.getChild("Miner.java");
|
IFileStore Miner_java = miners.getChild("Miner.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -403,7 +402,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
IFileStore MinerThread_java = miners.getChild("MinerThread.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(MinerThread_java, content);
|
createFile(MinerThread_java, content);
|
||||||
|
|
||||||
//now, some contents in model folder
|
//now, some contents in model folder
|
||||||
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
IFileStore ByteStreamHandler_java = model.getChild("ByteStreamHandler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -414,21 +413,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Handler_java = model.getChild("Handler.java");
|
IFileStore Handler_java = model.getChild("Handler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Handler_java, content);
|
createFile(Handler_java, content);
|
||||||
|
|
||||||
//now, some contents in server folder
|
//now, some contents in server folder
|
||||||
IFileStore Server_java = server.getChild("Server.java");
|
IFileStore Server_java = server.getChild("Server.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Server_java, content);
|
createFile(Server_java, content);
|
||||||
|
|
||||||
//now, some contents in util folder
|
//now, some contents in util folder
|
||||||
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
IFileStore StringCompare_java = util.getChild("StringCompare.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(StringCompare_java, content);
|
createFile(StringCompare_java, content);
|
||||||
|
|
||||||
//now, create the contents in "internal" folder
|
//now, create the contents in "internal" folder
|
||||||
IFileStore core1 = internal.getChild("core");
|
IFileStore core1 = internal.getChild("core");
|
||||||
createDir(core1, true);
|
createDir(core1, true);
|
||||||
|
|
||||||
//then create some folder in this "core" folder
|
//then create some folder in this "core" folder
|
||||||
IFileStore client1 = core1.getChild("client");
|
IFileStore client1 = core1.getChild("client");
|
||||||
createDir(client1, true);
|
createDir(client1, true);
|
||||||
|
@ -438,7 +437,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
createDir(server1, true);
|
createDir(server1, true);
|
||||||
IFileStore util1 = core1.getChild("util");
|
IFileStore util1 = core1.getChild("util");
|
||||||
createDir(util1, true);
|
createDir(util1, true);
|
||||||
|
|
||||||
//now, some contents on client folder
|
//now, some contents on client folder
|
||||||
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
IFileStore ClientConnection_java1 = client1.getChild("ClientConnection.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -446,8 +445,8 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
IFileStore ConnectionStatus_java1 = client1.getChild("ConnectionStatus.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(ConnectionStatus_java1, content);
|
createFile(ConnectionStatus_java1, content);
|
||||||
|
|
||||||
|
|
||||||
//now, some contents in model folder
|
//now, some contents in model folder
|
||||||
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
IFileStore ByteStreamHandler_java1 = model1.getChild("ByteStreamHandler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
|
@ -458,17 +457,17 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
IFileStore Handler_java1 = model1.getChild("Handler.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Handler_java1, content);
|
createFile(Handler_java1, content);
|
||||||
|
|
||||||
//now, some contents in server folder
|
//now, some contents in server folder
|
||||||
IFileStore Server_java1 = server1.getChild("Server.java");
|
IFileStore Server_java1 = server1.getChild("Server.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(Server_java1, content);
|
createFile(Server_java1, content);
|
||||||
|
|
||||||
//now, some contents in util folder
|
//now, some contents in util folder
|
||||||
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
IFileStore StringCompare_java1 = util1.getChild("StringCompare.java");
|
||||||
content = getRandomString();
|
content = getRandomString();
|
||||||
createFile(StringCompare_java1, content);
|
createFile(StringCompare_java1, content);
|
||||||
|
|
||||||
//now, copy META_INF into the folder in the remote system
|
//now, copy META_INF into the folder in the remote system
|
||||||
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName1, mon);
|
IRemoteFile META_INF_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName1, mon);
|
||||||
assertNotNull(META_INF_folder);
|
assertNotNull(META_INF_folder);
|
||||||
|
@ -477,7 +476,7 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fromSet.addResource(META_INF_folder);
|
fromSet.addResource(META_INF_folder);
|
||||||
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
ISystemResourceSet tempObjects1 = srcAdapter1.doDrag(fromSet, mon);
|
||||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects1, tempDir, mon, true);
|
||||||
|
|
||||||
//now, copy org into the folder in the remote system
|
//now, copy org into the folder in the remote system
|
||||||
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName2, mon);
|
IRemoteFile org_folder = localFss.getRemoteFileObject(tempPath + '\\' + tarSourceFolderName2, mon);
|
||||||
assertNotNull(org_folder);
|
assertNotNull(org_folder);
|
||||||
|
@ -486,21 +485,22 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fromSet2.addResource(org_folder);
|
fromSet2.addResource(org_folder);
|
||||||
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
ISystemResourceSet tempObjects2 = srcAdapter2.doDrag(fromSet2, mon);
|
||||||
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)tempObjects2, tempDir, mon, true);
|
||||||
|
|
||||||
//now, create tar file in the host
|
//now, create tar file in the host
|
||||||
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceFileName1, false);
|
IRemoteFile tarSource = createFileOrFolder(tempDir.getAbsolutePath(), tarSourceFileName1, false);
|
||||||
assertNotNull(tarSource);
|
assertNotNull(tarSource);
|
||||||
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName1);
|
IRemoteFile tarSourceFolder1 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName1);
|
||||||
assertNotNull(tarSourceFolder1);
|
assertNotNull(tarSourceFolder1);
|
||||||
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName2);
|
IRemoteFile tarSourceFolder2 = (IRemoteFile)getChildFromFolder(tempDir, tarSourceFolderName2);
|
||||||
fss.copy(tarSourceFolder1, tarSource, tarSourceFolderName1, mon);
|
fss.copy(tarSourceFolder1, tarSource, tarSourceFolderName1, mon);
|
||||||
fss.copy(tarSourceFolder2, tarSource, tarSourceFolderName2, mon);
|
fss.copy(tarSourceFolder2, tarSource, tarSourceFolderName2, mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCreateTarFile() throws Exception {
|
public void testCreateTarFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//Create the zip file first.
|
//Create the zip file first.
|
||||||
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
||||||
assertNotNull(newArchiveFile);
|
assertNotNull(newArchiveFile);
|
||||||
|
@ -509,73 +509,74 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
assertTrue(newArchiveFile.canWrite());
|
assertTrue(newArchiveFile.canWrite());
|
||||||
assertEquals(newArchiveFile.getName(), testName);
|
assertEquals(newArchiveFile.getName(), testName);
|
||||||
assertEquals(newArchiveFile.getParentPath(), tempDirPath);
|
assertEquals(newArchiveFile.getParentPath(), tempDirPath);
|
||||||
|
|
||||||
//fss.resolveFilterString(filterString, monitor)
|
//fss.resolveFilterString(filterString, monitor)
|
||||||
|
|
||||||
//Now, we want to create a text file inside.
|
//Now, we want to create a text file inside.
|
||||||
String childName = "aaa.txt";
|
String childName = "aaa.txt";
|
||||||
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||||
assertNotNull(file1);
|
assertNotNull(file1);
|
||||||
|
|
||||||
childName = "bbb.txt";
|
childName = "bbb.txt";
|
||||||
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||||
assertNotNull(file2);
|
assertNotNull(file2);
|
||||||
|
|
||||||
//Create a folder
|
//Create a folder
|
||||||
childName = "folder1";
|
childName = "folder1";
|
||||||
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
||||||
assertNotNull(folder1);
|
assertNotNull(folder1);
|
||||||
|
|
||||||
//Now, check the contents
|
//Now, check the contents
|
||||||
String[] namesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
String[] namesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
||||||
int[] typesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
int[] typesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||||
checkFolderContents(newArchiveFile, namesToCheck, typesToCheck);
|
checkFolderContents(newArchiveFile, namesToCheck, typesToCheck);
|
||||||
|
|
||||||
//Now, create some files inside the folder.
|
//Now, create some files inside the folder.
|
||||||
String secondLevelChildName = "ccc.exe";
|
String secondLevelChildName = "ccc.exe";
|
||||||
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||||
assertNotNull(levelTwoChild1);
|
assertNotNull(levelTwoChild1);
|
||||||
|
|
||||||
secondLevelChildName = "ddd.bat";
|
secondLevelChildName = "ddd.bat";
|
||||||
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||||
assertNotNull(levelTwoChild2);
|
assertNotNull(levelTwoChild2);
|
||||||
|
|
||||||
secondLevelChildName = "another Folder"; //folder with space
|
secondLevelChildName = "another Folder"; //folder with space
|
||||||
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
||||||
assertNotNull(levelTwoChild3);
|
assertNotNull(levelTwoChild3);
|
||||||
|
|
||||||
//Now, check the contents
|
//Now, check the contents
|
||||||
String[] namesToCheck1 = {"ccc.exe", "ddd.bat", "another Folder"};
|
String[] namesToCheck1 = {"ccc.exe", "ddd.bat", "another Folder"};
|
||||||
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||||
checkFolderContents(folder1, namesToCheck1, typesToCheck1);
|
checkFolderContents(folder1, namesToCheck1, typesToCheck1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testCopyToTarArchiveFile() throws Exception {
|
public void testCopyToTarArchiveFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
createSourceFolders();
|
createSourceFolders();
|
||||||
|
|
||||||
String tarTargetFileName = tarSourceFileName1;
|
String tarTargetFileName = tarSourceFileName1;
|
||||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||||
assertNotNull(targetTarFile);
|
assertNotNull(targetTarFile);
|
||||||
|
|
||||||
String sourceFolderName = folderToCopyName3;
|
String sourceFolderName = folderToCopyName3;
|
||||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
||||||
assertNotNull(sourceFolder);
|
assertNotNull(sourceFolder);
|
||||||
|
|
||||||
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
||||||
fss.copy(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
fss.copy(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
||||||
|
|
||||||
Object theCopiedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
Object theCopiedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
||||||
|
|
||||||
assertNotNull(theCopiedChild);
|
assertNotNull(theCopiedChild);
|
||||||
|
|
||||||
//Also make sure the copied child has the right contents.
|
//Also make sure the copied child has the right contents.
|
||||||
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||||
|
|
||||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck);
|
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck, typesToCheck);
|
||||||
}
|
}
|
||||||
|
@ -584,29 +585,30 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testCopyTarVirtualFile() throws Exception {
|
public void testCopyTarVirtualFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
|
|
||||||
String sourceFileName = tarSourceFileName1;
|
String sourceFileName = tarSourceFileName1;
|
||||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||||
assertNotNull(sourceTarFile);
|
assertNotNull(sourceTarFile);
|
||||||
|
|
||||||
//then, create a folder inside the tempDir
|
//then, create a folder inside the tempDir
|
||||||
String folderName = "folder1";
|
String folderName = "folder1";
|
||||||
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
||||||
assertNotNull(folder1);
|
assertNotNull(folder1);
|
||||||
|
|
||||||
//Get one of its fourth level children, and copy the folder to there.
|
//Get one of its fourth level children, and copy the folder to there.
|
||||||
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||||
assertNotNull(firstLevelChild);
|
assertNotNull(firstLevelChild);
|
||||||
|
|
||||||
fss.copy(firstLevelChild, folder1, tarSourceFolderName1, mon);
|
fss.copy(firstLevelChild, folder1, tarSourceFolderName1, mon);
|
||||||
|
|
||||||
Object copiedVirtualFolder = getChildFromFolder(folder1, tarSourceFolderName1);
|
Object copiedVirtualFolder = getChildFromFolder(folder1, tarSourceFolderName1);
|
||||||
assertNotNull(copiedVirtualFolder);
|
assertNotNull(copiedVirtualFolder);
|
||||||
|
|
||||||
String[] contents = {"MANIFEST.MF"};
|
String[] contents = {"MANIFEST.MF"};
|
||||||
int[] typesToCheck = {TYPE_FILE};
|
int[] typesToCheck = {TYPE_FILE};
|
||||||
checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
checkFolderContents((IRemoteFile)copiedVirtualFolder, contents, typesToCheck);
|
||||||
|
@ -615,32 +617,33 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testMoveToTarArchiveFile() throws Exception {
|
public void testMoveToTarArchiveFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
createSourceFolders();
|
createSourceFolders();
|
||||||
|
|
||||||
String tarTargetFileName = tarSourceFileName1;
|
String tarTargetFileName = tarSourceFileName1;
|
||||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||||
assertNotNull(targetTarFile);
|
assertNotNull(targetTarFile);
|
||||||
|
|
||||||
String sourceFolderName = folderToCopyName3;
|
String sourceFolderName = folderToCopyName3;
|
||||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir, sourceFolderName);
|
||||||
assertNotNull(sourceFolder);
|
assertNotNull(sourceFolder);
|
||||||
|
|
||||||
fss.move(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
fss.move(sourceFolder, targetTarFile, sourceFolder.getName(), mon);
|
||||||
|
|
||||||
Object theMovedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
Object theMovedChild = getChildFromFolder(targetTarFile, sourceFolderName);
|
||||||
|
|
||||||
assertNotNull(theMovedChild);
|
assertNotNull(theMovedChild);
|
||||||
|
|
||||||
//Also make sure the copied child has the right contents.
|
//Also make sure the copied child has the right contents.
|
||||||
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
String[] childrenToCheck = {"aaaaaaaa", "aaaab", "epdcdump01.hex12a", "RSE-SDK-2.0RC1.zip"};
|
||||||
|
|
||||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE, TYPE_FILE};
|
||||||
checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck);
|
checkFolderContents((IRemoteFile)theMovedChild, childrenToCheck, typesToCheck);
|
||||||
|
|
||||||
//make sure the original folder is gone.
|
//make sure the original folder is gone.
|
||||||
Object originalSource = getChildFromFolder(tempDir, sourceFolderName);
|
Object originalSource = getChildFromFolder(tempDir, sourceFolderName);
|
||||||
assertNull(originalSource);
|
assertNull(originalSource);
|
||||||
|
@ -650,35 +653,36 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testMoveTarVirtualFile() throws Exception {
|
public void testMoveTarVirtualFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
|
|
||||||
String sourceFileName = tarSourceFileName1;
|
String sourceFileName = tarSourceFileName1;
|
||||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||||
assertNotNull(sourceTarFile);
|
assertNotNull(sourceTarFile);
|
||||||
|
|
||||||
//then, create a folder inside the tempDir
|
//then, create a folder inside the tempDir
|
||||||
//then, create a folder inside the tempDir
|
//then, create a folder inside the tempDir
|
||||||
String folderName = "folder1";
|
String folderName = "folder1";
|
||||||
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
IRemoteFile folder1 = createFileOrFolder(tempDirPath, folderName, true);
|
||||||
assertNotNull(folder1);
|
assertNotNull(folder1);
|
||||||
|
|
||||||
//Now, copy one of the folder from the zip file into folder1
|
//Now, copy one of the folder from the zip file into folder1
|
||||||
String movedFolderName = tarSourceFolderName1;
|
String movedFolderName = tarSourceFolderName1;
|
||||||
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
IRemoteFile firstLevelChild = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||||
assertNotNull(firstLevelChild);
|
assertNotNull(firstLevelChild);
|
||||||
fss.move(firstLevelChild, folder1, movedFolderName, mon);
|
fss.move(firstLevelChild, folder1, movedFolderName, mon);
|
||||||
|
|
||||||
Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName);
|
Object movedVirtualFolder = getChildFromFolder(folder1, movedFolderName);
|
||||||
|
|
||||||
assertNotNull(movedVirtualFolder);
|
assertNotNull(movedVirtualFolder);
|
||||||
|
|
||||||
String[] contents = {"MANIFEST.MF"};
|
String[] contents = {"MANIFEST.MF"};
|
||||||
int[] typesToCheck = {TYPE_FILE};
|
int[] typesToCheck = {TYPE_FILE};
|
||||||
checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck);
|
checkFolderContents((IRemoteFile)movedVirtualFolder, contents, typesToCheck);
|
||||||
|
|
||||||
//Now, make sure the moved virtual folder is gone from its original zip file
|
//Now, make sure the moved virtual folder is gone from its original zip file
|
||||||
IRemoteFile tmp = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
IRemoteFile tmp = (IRemoteFile)getChildFromFolder(sourceTarFile, tarSourceFolderName1);
|
||||||
assertNull(tmp);
|
assertNull(tmp);
|
||||||
|
@ -687,59 +691,60 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testRenameTarVirtualFile() throws Exception {
|
public void testRenameTarVirtualFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//Create the zip file first.
|
//Create the zip file first.
|
||||||
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
IRemoteFile newArchiveFile = createFileOrFolder(tempDirPath, testName, false);
|
||||||
|
|
||||||
//Now, we want to create a text file inside.
|
//Now, we want to create a text file inside.
|
||||||
String childName = "aaa.txt";
|
String childName = "aaa.txt";
|
||||||
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
IRemoteFile file1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||||
assertNotNull(file1);
|
assertNotNull(file1);
|
||||||
|
|
||||||
childName = "bbb.txt";
|
childName = "bbb.txt";
|
||||||
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
IRemoteFile file2 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, false);
|
||||||
assertNotNull(file2);
|
assertNotNull(file2);
|
||||||
|
|
||||||
//Create a folder
|
//Create a folder
|
||||||
childName = "folder1";
|
childName = "folder1";
|
||||||
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
IRemoteFile folder1 = createFileOrFolder(newArchiveFile.getAbsolutePath(), childName, true);
|
||||||
assertNotNull(folder1);
|
assertNotNull(folder1);
|
||||||
|
|
||||||
//Now, check the contents
|
//Now, check the contents
|
||||||
String[] levelOneNamesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
String[] levelOneNamesToCheck = {"aaa.txt", "bbb.txt", "folder1"};
|
||||||
int[] levalOneTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
int[] levalOneTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||||
checkFolderContents(newArchiveFile, levelOneNamesToCheck, levalOneTypesToCheck);
|
checkFolderContents(newArchiveFile, levelOneNamesToCheck, levalOneTypesToCheck);
|
||||||
|
|
||||||
//Now, create some files inside the folder.
|
//Now, create some files inside the folder.
|
||||||
String secondLevelChildName = "ccc.exe";
|
String secondLevelChildName = "ccc.exe";
|
||||||
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
IRemoteFile levelTwoChild1 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||||
assertNotNull(levelTwoChild1);
|
assertNotNull(levelTwoChild1);
|
||||||
|
|
||||||
secondLevelChildName = "ddd.bat";
|
secondLevelChildName = "ddd.bat";
|
||||||
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
IRemoteFile levelTwoChild2 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, false);
|
||||||
assertNotNull(levelTwoChild2);
|
assertNotNull(levelTwoChild2);
|
||||||
|
|
||||||
secondLevelChildName = "another Folder"; //folder with space
|
secondLevelChildName = "another Folder"; //folder with space
|
||||||
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
IRemoteFile levelTwoChild3 = createFileOrFolder(folder1.getAbsolutePath(), secondLevelChildName, true);
|
||||||
assertNotNull(levelTwoChild3);
|
assertNotNull(levelTwoChild3);
|
||||||
|
|
||||||
//Now, check the contents
|
//Now, check the contents
|
||||||
String[] levelTwoNamesToCheck = {"ccc.exe", "ddd.bat", "another Folder"};
|
String[] levelTwoNamesToCheck = {"ccc.exe", "ddd.bat", "another Folder"};
|
||||||
int[] levalTwoTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
int[] levalTwoTypesToCheck = {TYPE_FILE, TYPE_FILE, TYPE_FOLDER};
|
||||||
checkFolderContents(folder1, levelTwoNamesToCheck, levalTwoTypesToCheck);
|
checkFolderContents(folder1, levelTwoNamesToCheck, levalTwoTypesToCheck);
|
||||||
|
|
||||||
//Now rename one of the text file in the first level:
|
//Now rename one of the text file in the first level:
|
||||||
IRemoteFile childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "aaa.txt");
|
IRemoteFile childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "aaa.txt");
|
||||||
fss.rename(childToRename, "aaa1.txt", mon);
|
fss.rename(childToRename, "aaa1.txt", mon);
|
||||||
//Now rename one of the folder in the first level
|
//Now rename one of the folder in the first level
|
||||||
childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder1");
|
childToRename = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder1");
|
||||||
fss.rename(childToRename, "folder2", mon);
|
fss.rename(childToRename, "folder2", mon);
|
||||||
|
|
||||||
//Check the result of rename
|
//Check the result of rename
|
||||||
String[] newLevelOneNamesToCheck = {"aaa1.txt", "bbb.txt", "folder2"};
|
String[] newLevelOneNamesToCheck = {"aaa1.txt", "bbb.txt", "folder2"};
|
||||||
checkFolderContents(newArchiveFile, newLevelOneNamesToCheck, levalOneTypesToCheck);
|
checkFolderContents(newArchiveFile, newLevelOneNamesToCheck, levalOneTypesToCheck);
|
||||||
|
|
||||||
//Now rename one of the text file in the second level:
|
//Now rename one of the text file in the second level:
|
||||||
IRemoteFile thisFolder = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder2");
|
IRemoteFile thisFolder = (IRemoteFile)getChildFromFolder(newArchiveFile, "folder2");
|
||||||
childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "ddd.bat");
|
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
|
//Now rename one of the folder in the second level
|
||||||
childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "another Folder");
|
childToRename = (IRemoteFile)getChildFromFolder(thisFolder, "another Folder");
|
||||||
fss.rename(childToRename, "some folder$", mon);
|
fss.rename(childToRename, "some folder$", mon);
|
||||||
|
|
||||||
//Check the result of rename
|
//Check the result of rename
|
||||||
String[] newLevelTwoNamesToCheck = {"ccc.exe", "ddd1.bat", "some folder$"};
|
String[] newLevelTwoNamesToCheck = {"ccc.exe", "ddd1.bat", "some folder$"};
|
||||||
checkFolderContents(thisFolder, newLevelTwoNamesToCheck, levalTwoTypesToCheck);
|
checkFolderContents(thisFolder, newLevelTwoNamesToCheck, levalTwoTypesToCheck);
|
||||||
|
@ -755,15 +760,16 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testDeleteTarVirtualFile() throws Exception {
|
public void testDeleteTarVirtualFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
|
|
||||||
String sourceFileName = tarSourceFileName1;
|
String sourceFileName = tarSourceFileName1;
|
||||||
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
IRemoteFile sourceTarFile = (IRemoteFile)getChildFromFolder(tempDir, sourceFileName);
|
||||||
assertNotNull(sourceTarFile);
|
assertNotNull(sourceTarFile);
|
||||||
|
|
||||||
//delete a file from level 2
|
//delete a file from level 2
|
||||||
String parentForFileToDeleteName ="META-INF";
|
String parentForFileToDeleteName ="META-INF";
|
||||||
IRemoteFile parentForFileToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForFileToDeleteName);
|
IRemoteFile parentForFileToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForFileToDeleteName);
|
||||||
|
@ -775,50 +781,50 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
fss.delete(fileToToDelete, mon);
|
fss.delete(fileToToDelete, mon);
|
||||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||||
assertNull(fileToToDelete);
|
assertNull(fileToToDelete);
|
||||||
|
|
||||||
//then, get directory "java" under org/eclipse/dstore/core
|
//then, get directory "java" under org/eclipse/dstore/core
|
||||||
String parentForDirectoryToDeleteName ="org";
|
String parentForDirectoryToDeleteName ="org";
|
||||||
IRemoteFile parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForDirectoryToDeleteName);
|
IRemoteFile parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(sourceTarFile, parentForDirectoryToDeleteName);
|
||||||
assertNotNull(parentForDirectoryToDelete);
|
assertNotNull(parentForDirectoryToDelete);
|
||||||
|
|
||||||
parentForDirectoryToDeleteName ="eclipse";
|
parentForDirectoryToDeleteName ="eclipse";
|
||||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||||
assertNotNull(parentForDirectoryToDelete);
|
assertNotNull(parentForDirectoryToDelete);
|
||||||
|
|
||||||
parentForDirectoryToDeleteName ="dstore";
|
parentForDirectoryToDeleteName ="dstore";
|
||||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||||
assertNotNull(parentForDirectoryToDelete);
|
assertNotNull(parentForDirectoryToDelete);
|
||||||
|
|
||||||
parentForDirectoryToDeleteName ="core";
|
parentForDirectoryToDeleteName ="core";
|
||||||
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
parentForDirectoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, parentForDirectoryToDeleteName);
|
||||||
assertNotNull(parentForDirectoryToDelete);
|
assertNotNull(parentForDirectoryToDelete);
|
||||||
|
|
||||||
String directoryToDeleteName = "java";
|
String directoryToDeleteName = "java";
|
||||||
IRemoteFile directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
IRemoteFile directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||||
//Now, delete this directory
|
//Now, delete this directory
|
||||||
fss.delete(directoryToDelete, mon);
|
fss.delete(directoryToDelete, mon);
|
||||||
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||||
|
|
||||||
//check result of this operation
|
//check result of this operation
|
||||||
String[] contents = {"client", "miners", "model", "server", "util", "Activator.java"};
|
String[] contents = {"client", "miners", "model", "server", "util", "Activator.java"};
|
||||||
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
int[] typesToCheck = {TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FOLDER, TYPE_FILE};
|
||||||
checkFolderContents(parentForDirectoryToDelete, contents, typesToCheck);
|
checkFolderContents(parentForDirectoryToDelete, contents, typesToCheck);
|
||||||
|
|
||||||
//And check this directory is not there any more.
|
//And check this directory is not there any more.
|
||||||
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
directoryToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, directoryToDeleteName);
|
||||||
assertNull(directoryToDelete);
|
assertNull(directoryToDelete);
|
||||||
|
|
||||||
//Now, delete some files and folder inside the a virtual folder.
|
//Now, delete some files and folder inside the a virtual folder.
|
||||||
parentForFileToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, "model");
|
parentForFileToDelete = (IRemoteFile)getChildFromFolder(parentForDirectoryToDelete, "model");
|
||||||
deleteFileName = "DE.java";
|
deleteFileName = "DE.java";
|
||||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||||
assertNotNull(fileToToDelete);
|
assertNotNull(fileToToDelete);
|
||||||
|
|
||||||
fss.delete(fileToToDelete, mon);
|
fss.delete(fileToToDelete, mon);
|
||||||
|
|
||||||
//check the result
|
//check the result
|
||||||
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
fileToToDelete = (IRemoteFile)getChildFromFolder(parentForFileToDelete, deleteFileName);
|
||||||
|
|
||||||
assertNull(fileToToDelete);
|
assertNull(fileToToDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,20 +832,21 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testCopyBatchToTarArchiveFile() throws Exception {
|
public void testCopyBatchToTarArchiveFile() throws Exception {
|
||||||
//-test-author-:XuanChen
|
//-test-author-:XuanChen
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
createSourceTarFiles();
|
createSourceTarFiles();
|
||||||
createSourceFolders();
|
createSourceFolders();
|
||||||
|
|
||||||
String tarTargetFileName = tarSourceFileName1;
|
String tarTargetFileName = tarSourceFileName1;
|
||||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||||
assertNotNull(targetTarFile);
|
assertNotNull(targetTarFile);
|
||||||
|
|
||||||
//Now, copy the source folder.
|
//Now, copy the source folder.
|
||||||
String sourceFolderName = folderToCopyName3;
|
String sourceFolderName = folderToCopyName3;
|
||||||
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir,sourceFolderName);
|
IRemoteFile sourceFolder = (IRemoteFile)getChildFromFolder(tempDir,sourceFolderName);
|
||||||
assertNotNull(sourceFolder);
|
assertNotNull(sourceFolder);
|
||||||
|
|
||||||
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
//Now, copy one of the folder from the sourceFolder into copiedTargetZipFile
|
||||||
IRemoteFile[] sourceFiles = new IRemoteFile[3];
|
IRemoteFile[] sourceFiles = new IRemoteFile[3];
|
||||||
//Also add some of its children into the batch.
|
//Also add some of its children into the batch.
|
||||||
|
@ -850,29 +857,29 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
String childToCopyName3 = "epdcdump01.hex12a";
|
String childToCopyName3 = "epdcdump01.hex12a";
|
||||||
sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3);
|
sourceFiles[2] = (IRemoteFile)getChildFromFolder(sourceFolder, childToCopyName3);
|
||||||
fss.copyBatch(sourceFiles, targetTarFile, mon);
|
fss.copyBatch(sourceFiles, targetTarFile, mon);
|
||||||
|
|
||||||
//Checking the first copied folder
|
//Checking the first copied folder
|
||||||
Object theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName1);
|
Object theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName1);
|
||||||
|
|
||||||
assertNotNull(theCopiedChild);
|
assertNotNull(theCopiedChild);
|
||||||
|
|
||||||
//Also make sure the copied child has the right contents.
|
//Also make sure the copied child has the right contents.
|
||||||
String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"};
|
String[] childrenToCheck1 = {"adsf", "eclipse-SDK-3.3M6-win32.zip", "epdcdump01.hex12", "epdcdump01.hex12aaaa"};
|
||||||
|
|
||||||
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE};
|
int[] typesToCheck1 = {TYPE_FILE, TYPE_FILE, TYPE_FILE, TYPE_FILE};
|
||||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1);
|
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck1, typesToCheck1);
|
||||||
|
|
||||||
//Checking the second copied folder
|
//Checking the second copied folder
|
||||||
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName2);
|
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName2);
|
||||||
|
|
||||||
assertNotNull(theCopiedChild);
|
assertNotNull(theCopiedChild);
|
||||||
|
|
||||||
//Also make sure the copied child has the right contents.
|
//Also make sure the copied child has the right contents.
|
||||||
String[] childrenToCheck2 = {"features"};
|
String[] childrenToCheck2 = {"features"};
|
||||||
|
|
||||||
int[] typesToCheck2 = {TYPE_FOLDER};
|
int[] typesToCheck2 = {TYPE_FOLDER};
|
||||||
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2);
|
checkFolderContents((IRemoteFile)theCopiedChild, childrenToCheck2, typesToCheck2);
|
||||||
|
|
||||||
//Checking the third copied file
|
//Checking the third copied file
|
||||||
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName3);
|
theCopiedChild = getChildFromFolder(targetTarFile, childToCopyName3);
|
||||||
assertNotNull(theCopiedChild);
|
assertNotNull(theCopiedChild);
|
||||||
|
@ -883,40 +890,41 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
|
|
||||||
public void testOpenFileFromTarArchive() throws Exception {
|
public void testOpenFileFromTarArchive() throws Exception {
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
|
|
||||||
//create the source for testing first
|
//create the source for testing first
|
||||||
createTarSourceForOpen();
|
createTarSourceForOpen();
|
||||||
|
|
||||||
String tarTargetFileName = tarSourceForOpenTest;
|
String tarTargetFileName = tarSourceForOpenTest;
|
||||||
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
IRemoteFile targetTarFile = (IRemoteFile)getChildFromFolder(tempDir, tarTargetFileName);
|
||||||
assertNotNull(targetTarFile);
|
assertNotNull(targetTarFile);
|
||||||
|
|
||||||
//Now get the contents of the virtual file we want to download:
|
//Now get the contents of the virtual file we want to download:
|
||||||
String fileContentToVerifyName1 = "MANIFEST.MF";
|
String fileContentToVerifyName1 = "MANIFEST.MF";
|
||||||
|
|
||||||
//Get its parent first.
|
//Get its parent first.
|
||||||
IRemoteFile itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName1);
|
IRemoteFile itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName1);
|
||||||
assertNotNull(itsParentFolder);
|
assertNotNull(itsParentFolder);
|
||||||
|
|
||||||
//Then get this file:
|
//Then get this file:
|
||||||
IRemoteFile thisVirtualFile = (IRemoteFile)getChildFromFolder(itsParentFolder, fileContentToVerifyName1);
|
IRemoteFile thisVirtualFile = (IRemoteFile)getChildFromFolder(itsParentFolder, fileContentToVerifyName1);
|
||||||
assertNotNull(thisVirtualFile);
|
assertNotNull(thisVirtualFile);
|
||||||
|
|
||||||
//Now, we want to download the content of this file
|
//Now, we want to download the content of this file
|
||||||
//We could just construct a dummy localpath for it.
|
//We could just construct a dummy localpath for it.
|
||||||
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
String tempPath = getWorkspace().getRoot().getLocation().append("temp").toString();
|
||||||
IFileStore temp = createDir(tempPath, true);
|
IFileStore temp = createDir(tempPath, true);
|
||||||
String localPath = tempPath + File.separator + fileContentToVerifyName1;
|
String localPath = tempPath + File.separator + fileContentToVerifyName1;
|
||||||
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
||||||
|
|
||||||
//now, verify the content of the local file
|
//now, verify the content of the local file
|
||||||
IFileStore localFile = temp.getChild(fileContentToVerifyName1);
|
IFileStore localFile = temp.getChild(fileContentToVerifyName1);
|
||||||
//Check the content of the download file:
|
//Check the content of the download file:
|
||||||
boolean sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
boolean sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||||
assertTrue(sameContent);
|
assertTrue(sameContent);
|
||||||
|
|
||||||
|
|
||||||
//now, we got the contents of another virtual file we want to download:
|
//now, we got the contents of another virtual file we want to download:
|
||||||
String fileContentToVerifyName2 = "Activator.java";
|
String fileContentToVerifyName2 = "Activator.java";
|
||||||
itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName2);
|
itsParentFolder = (IRemoteFile)getChildFromFolder(tempDir,tarSourceForOpenFolderName2);
|
||||||
|
@ -931,14 +939,14 @@ public abstract class FileServiceArchiveBaseTest extends FileServiceBaseTest {
|
||||||
assertNotNull(thisVirtualFile);
|
assertNotNull(thisVirtualFile);
|
||||||
localPath = tempPath + File.separator + fileContentToVerifyName2;
|
localPath = tempPath + File.separator + fileContentToVerifyName2;
|
||||||
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
fss.download(thisVirtualFile, localPath, thisVirtualFile.getEncoding(), mon);
|
||||||
|
|
||||||
//now, verify the content of the local file
|
//now, verify the content of the local file
|
||||||
localFile = temp.getChild(fileContentToVerifyName2);
|
localFile = temp.getChild(fileContentToVerifyName2);
|
||||||
//Check the content of the download file:
|
//Check the content of the download file:
|
||||||
sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
sameContent = compareContent(getContents(fileContentString1), localFile.openInputStream(EFS.NONE, null));
|
||||||
assertTrue(sameContent);
|
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) {
|
public FileServiceArchiveTestDStoreWindows(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
setTargetName("windows");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static junit.framework.Test suite() {
|
public static junit.framework.Test suite() {
|
||||||
|
|
||||||
TestSuite suite = new TestSuite("FileServiceArchiveTestDStoreWindows");
|
TestSuite suite = new TestSuite("FileServiceArchiveTestDStoreWindows");
|
||||||
|
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToArchiveFile")); //$NON-NLS-1$
|
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, "testCopyBatchToVirtualFileLevelOne")); //$NON-NLS-1$
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testCopyBatchToVirtualFileLevelTwo")); //$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, "testMoveVirtualFileLevelTwo")); //$NON-NLS-1$
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testRenameVirtualFile")); //$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, "testRenameVirtualFileBigZip")); //$NON-NLS-1$
|
||||||
|
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote"));
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStoreWindows.class, "testSuperTransferLocalToRemote"));
|
||||||
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
suite.addTest(TestSuite.createTest(FileServiceArchiveTestDStore.class, "testSuperTransferDStoreToLocal"));
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setupFileSubSystem() {
|
protected void setupFileSubSystem() {
|
||||||
|
|
||||||
IHost dstoreHost = getWindowsHost();
|
IHost dstoreHost = getWindowsHost();
|
||||||
assertTrue(dstoreHost != null);
|
assertTrue(dstoreHost != null);
|
||||||
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
ISystemRegistry sr = SystemStartHere.getSystemRegistry();
|
||||||
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
|
ISubSystem[] ss = sr.getServiceSubSystems(dstoreHost, IFileService.class);
|
||||||
for (int i=0; i<ss.length; i++) {
|
for (int i=0; i<ss.length; i++) {
|
||||||
if (ss[i] instanceof IFileServiceSubSystem) {
|
if (ss[i] instanceof IFileServiceSubSystem) {
|
||||||
|
@ -82,24 +83,24 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
||||||
fs = fss.getFileService();
|
fs = fss.getFileService();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IHost localHost = getLocalSystemConnection();
|
IHost localHost = getLocalSystemConnection();
|
||||||
sr = SystemStartHere.getSystemRegistry();
|
sr = SystemStartHere.getSystemRegistry();
|
||||||
ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
||||||
for (int i=0; i<ss.length; i++) {
|
for (int i=0; i<ss.length; i++) {
|
||||||
if (ss[i] instanceof IFileServiceSubSystem) {
|
if (ss[i] instanceof IFileServiceSubSystem) {
|
||||||
localFss = (IFileServiceSubSystem)ss[i];
|
localFss = (IFileServiceSubSystem)ss[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IConnectorService connectionService = fss.getConnectorService();
|
IConnectorService connectionService = fss.getConnectorService();
|
||||||
|
|
||||||
//If you want to connect to a running server, uncomment the following statements
|
//If you want to connect to a running server, uncomment the following statements
|
||||||
/*
|
/*
|
||||||
IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties();
|
IServerLauncherProperties properties = connectionService.getRemoteServerLauncherProperties();
|
||||||
|
|
||||||
if (properties instanceof IRemoteServerLauncher)
|
if (properties instanceof IRemoteServerLauncher)
|
||||||
{
|
{
|
||||||
IRemoteServerLauncher sl = (IRemoteServerLauncher)properties;
|
IRemoteServerLauncher sl = (IRemoteServerLauncher)properties;
|
||||||
|
@ -111,12 +112,12 @@ public class FileServiceArchiveTestDStoreWindows extends FileServiceArchiveTest
|
||||||
|
|
||||||
connectionService.acquireCredentials(false);
|
connectionService.acquireCredentials(false);
|
||||||
connectionService.connect(mon);
|
connectionService.connect(mon);
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
assertTrue("Exception creating temp dir " + e.getStackTrace().toString(), false); //$NON-NLS-1$
|
assertTrue("Exception creating temp dir " + e.getStackTrace().toString(), false); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||||
store.setValue(ISystemPreferencesConstants.ALERT_SSL, fPreference_ALERT_SSL);
|
store.setValue(ISystemPreferencesConstants.ALERT_SSL, fPreference_ALERT_SSL);
|
||||||
|
|
|
@ -63,11 +63,14 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
||||||
*/
|
*/
|
||||||
public FileServiceBaseTest(String name) {
|
public FileServiceBaseTest(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
setTargetName("local");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
setupFileSubSystem();
|
setupFileSubSystem();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
//Create a temparory directory in My Home
|
//Create a temparory directory in My Home
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -85,11 +88,13 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
try {
|
if (fss != null) {
|
||||||
fss.delete(tempDir, mon);
|
try {
|
||||||
} catch(SystemMessageException msg) {
|
fss.delete(tempDir, mon);
|
||||||
//ensure that super.tearDown() can run
|
} catch (SystemMessageException msg) {
|
||||||
System.err.println("Exception on tearDown: "+msg.getLocalizedMessage()); //$NON-NLS-1$
|
// ensure that super.tearDown() can run
|
||||||
|
System.err.println("Exception on tearDown: " + msg.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
@ -397,6 +402,8 @@ public class FileServiceBaseTest extends RSEBaseConnectionTestCase {
|
||||||
protected void setupFileSubSystem()
|
protected void setupFileSubSystem()
|
||||||
{
|
{
|
||||||
IHost localHost = getLocalSystemConnection();
|
IHost localHost = getLocalSystemConnection();
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
|
||||||
ISubSystem[] ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
ISubSystem[] ss = sr.getServiceSubSystems(localHost, IFileService.class);
|
||||||
for (int i=0; i<ss.length; i++) {
|
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.model.RemoteFileUtility;
|
||||||
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.rse.tests.RSETestsPlugin;
|
|
||||||
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
import org.eclipse.rse.tests.core.connection.RSEBaseConnectionTestCase;
|
||||||
|
|
||||||
public class FileServiceTest extends RSEBaseConnectionTestCase {
|
public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
|
@ -64,6 +63,11 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
public FileServiceTest(String name, String propertiesFileName) {
|
public FileServiceTest(String name, String propertiesFileName) {
|
||||||
super(name);
|
super(name);
|
||||||
fPropertiesFileName = propertiesFileName;
|
fPropertiesFileName = propertiesFileName;
|
||||||
|
if (propertiesFileName != null) {
|
||||||
|
int idx = propertiesFileName.indexOf("Connection.properties");
|
||||||
|
String targetName = propertiesFileName.substring(0, idx);
|
||||||
|
setTargetName(targetName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
|
@ -128,6 +132,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testGetRootProperties() throws Exception {
|
public void testGetRootProperties() throws Exception {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled()) return;
|
||||||
IHostFile[] roots = fs.getRoots(new NullProgressMonitor());
|
IHostFile[] roots = fs.getRoots(new NullProgressMonitor());
|
||||||
assertNotNull(roots);
|
assertNotNull(roots);
|
||||||
assertTrue(roots.length > 0);
|
assertTrue(roots.length > 0);
|
||||||
|
@ -138,6 +143,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
String rootName = roots[i].getName();
|
String rootName = roots[i].getName();
|
||||||
assertNotNull(rootName);
|
assertNotNull(rootName);
|
||||||
System.out.println(rootName);
|
System.out.println(rootName);
|
||||||
|
// DStore: NPE, bug 240710
|
||||||
IHostFile newHf = fs.getFile(null, rootName, new NullProgressMonitor());
|
IHostFile newHf = fs.getFile(null, rootName, new NullProgressMonitor());
|
||||||
assertTrue(newHf.isRoot());
|
assertTrue(newHf.isRoot());
|
||||||
assertTrue(newHf.exists());
|
assertTrue(newHf.exists());
|
||||||
|
@ -151,7 +157,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testCaseSensitive() {
|
public void testCaseSensitive() {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCaseSensitive")) return; //$NON-NLS-1$
|
if (isTestDisabled()) return;
|
||||||
|
|
||||||
if (isWindows()) {
|
if (isWindows()) {
|
||||||
assertFalse(fs.isCaseSensitive());
|
assertFalse(fs.isCaseSensitive());
|
||||||
|
@ -166,7 +172,7 @@ public class FileServiceTest extends RSEBaseConnectionTestCase {
|
||||||
|
|
||||||
public void testCreateFile() throws SystemMessageException {
|
public void testCreateFile() throws SystemMessageException {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateFile")) return; //$NON-NLS-1$
|
if (isTestDisabled()) return;
|
||||||
|
|
||||||
String testName = getTestFileName();
|
String testName = getTestFileName();
|
||||||
IHostFile hf = fs.createFile(tempDirPath, testName, mon); //dstore-linux: bug 235492
|
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 {
|
public void testCreateCaseSensitive() throws SystemMessageException {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
if (!RSETestsPlugin.isTestCaseEnabled("FileServiceTest.testCreateCaseSensitive")) return; //$NON-NLS-1$
|
if (isTestDisabled()) return;
|
||||||
|
|
||||||
String testName = getTestFileName();
|
String testName = getTestFileName();
|
||||||
String testName2 = testName.toUpperCase();
|
String testName2 = testName.toUpperCase();
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - initial API and implementation
|
* 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;
|
package org.eclipse.rse.tests.subsystems.files;
|
||||||
|
@ -74,6 +75,11 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
public RSEFileStoreTest(String name, String propertiesFileName) {
|
public RSEFileStoreTest(String name, String propertiesFileName) {
|
||||||
super(name);
|
super(name);
|
||||||
fPropertiesFileName = propertiesFileName;
|
fPropertiesFileName = propertiesFileName;
|
||||||
|
if (propertiesFileName != null) {
|
||||||
|
int idx = propertiesFileName.indexOf("Connection.properties");
|
||||||
|
String targetName = propertiesFileName.substring(0, idx);
|
||||||
|
setTargetName(targetName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Test suite() {
|
public static Test suite() {
|
||||||
|
@ -178,6 +184,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testRecursiveGetParent() {
|
public void testRecursiveGetParent() {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore store = fTestStore;
|
IFileStore store = fTestStore;
|
||||||
String homePath = store.toURI().getPath();
|
String homePath = store.toURI().getPath();
|
||||||
assertTrue("exists: " + store, store.fetchInfo().exists());
|
assertTrue("exists: " + store, store.fetchInfo().exists());
|
||||||
|
@ -193,6 +201,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testAppendOutputStream() throws Exception {
|
public void testAppendOutputStream() throws Exception {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore f = createFile("foo");
|
IFileStore f = createFile("foo");
|
||||||
fOS = f.openOutputStream(EFS.APPEND, getDefaultProgressMonitor());
|
fOS = f.openOutputStream(EFS.APPEND, getDefaultProgressMonitor());
|
||||||
fOS.write("bar".getBytes());
|
fOS.write("bar".getBytes());
|
||||||
|
@ -211,6 +221,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testPutInfo() throws Exception {
|
public void testPutInfo() throws Exception {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileInfo testInfo = fTestStore.fetchInfo();
|
IFileInfo testInfo = fTestStore.fetchInfo();
|
||||||
assertTrue("1.1", testInfo.exists());
|
assertTrue("1.1", testInfo.exists());
|
||||||
assertTrue("1.2", testInfo.isDirectory());
|
assertTrue("1.2", testInfo.isDirectory());
|
||||||
|
@ -250,6 +262,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testDeleteSpecialCases() throws Exception {
|
public void testDeleteSpecialCases() throws Exception {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
String testFileName = "noPerm.txt"; //$NON-NLS-1$
|
String testFileName = "noPerm.txt"; //$NON-NLS-1$
|
||||||
boolean exceptionThrown = false;
|
boolean exceptionThrown = false;
|
||||||
|
|
||||||
|
@ -350,6 +364,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testModifyNonExisting() throws Exception {
|
public void testModifyNonExisting() throws Exception {
|
||||||
// -test-author-:MartinOberhuber
|
// -test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore store = fTestStore.getChild("nonExisting.txt");
|
IFileStore store = fTestStore.getChild("nonExisting.txt");
|
||||||
IFileInfo info;
|
IFileInfo info;
|
||||||
boolean exceptionThrown = false;
|
boolean exceptionThrown = false;
|
||||||
|
@ -435,6 +451,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
|
|
||||||
public void testModifyReadOnly() throws Exception {
|
public void testModifyReadOnly() throws Exception {
|
||||||
//-test-author-:MartinOberhuber
|
//-test-author-:MartinOberhuber
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore store = createFile("readOnly.txt");
|
IFileStore store = createFile("readOnly.txt");
|
||||||
IFileInfo info = store.fetchInfo();
|
IFileInfo info = store.fetchInfo();
|
||||||
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
|
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
|
||||||
|
@ -494,6 +512,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
public void testMakeDeleteTree() throws Exception {
|
public void testMakeDeleteTree() throws Exception {
|
||||||
// -test-author-:MartinOberhuber
|
// -test-author-:MartinOberhuber
|
||||||
// Create folder
|
// Create folder
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore treeStore = fTestStore.getChild("treeTest");
|
IFileStore treeStore = fTestStore.getChild("treeTest");
|
||||||
treeStore.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
treeStore.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
||||||
|
|
||||||
|
@ -597,6 +617,8 @@ public class RSEFileStoreTest extends FileServiceBaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test255files() throws Exception {
|
public void test255files() throws Exception {
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
IFileStore f = fTestStore.getChild("f");
|
IFileStore f = fTestStore.getChild("f");
|
||||||
f.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
f.mkdir(EFS.SHALLOW, getDefaultProgressMonitor());
|
||||||
for (int i = 0; i < 255; i++) {
|
for (int i = 0; i < 255; i++) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
|
@ -24,23 +24,25 @@ import org.eclipse.rse.ui.SystemPreferencesManager;
|
||||||
* Test various aspects of mnemonic generation and assignment.
|
* Test various aspects of mnemonic generation and assignment.
|
||||||
*/
|
*/
|
||||||
public class MnemonicsTest extends RSECoreTestCase {
|
public class MnemonicsTest extends RSECoreTestCase {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||||
*/
|
*/
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||||
*/
|
*/
|
||||||
protected void tearDown() throws Exception {
|
protected void tearDown() throws Exception {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDefaultGeneration() {
|
public void testDefaultGeneration() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
Mnemonics mn = new Mnemonics();
|
Mnemonics mn = new Mnemonics();
|
||||||
mn.clear("abcde");
|
mn.clear("abcde");
|
||||||
String result = mn.setUniqueMnemonic("A...");
|
String result = mn.setUniqueMnemonic("A...");
|
||||||
|
@ -48,9 +50,11 @@ public class MnemonicsTest extends RSECoreTestCase {
|
||||||
result = mn.setUniqueMnemonic("F...");
|
result = mn.setUniqueMnemonic("F...");
|
||||||
assertEquals("&F...", result);
|
assertEquals("&F...", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAppendPolicies() {
|
public void testAppendPolicies() {
|
||||||
//-test-author-:DavidDykstal
|
//-test-author-:DavidDykstal
|
||||||
|
if (isTestDisabled())
|
||||||
|
return;
|
||||||
setLocalePattern(".*"); // match all locales
|
setLocalePattern(".*"); // match all locales
|
||||||
Mnemonics mn = new Mnemonics();
|
Mnemonics mn = new Mnemonics();
|
||||||
mn.clear("abcde");
|
mn.clear("abcde");
|
||||||
|
@ -61,9 +65,9 @@ public class MnemonicsTest extends RSECoreTestCase {
|
||||||
result = mn.setUniqueMnemonic("H...");
|
result = mn.setUniqueMnemonic("H...");
|
||||||
assertEquals("&H...", result);
|
assertEquals("&H...", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setLocalePattern(String pattern) {
|
private void setLocalePattern(String pattern) {
|
||||||
RSEUIPlugin.getDefault().getPluginPreferences().setValue(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, pattern);
|
RSEUIPlugin.getDefault().getPluginPreferences().setValue(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue