mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
Some methods added for creating connection in DStore.
This commit is contained in:
parent
805de3df45
commit
3e92eefdd1
2 changed files with 37 additions and 2 deletions
|
@ -84,4 +84,38 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase {
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lookup and return the local system type connection. This connection
|
||||||
|
* should be usually available on all systems.
|
||||||
|
*
|
||||||
|
* @return The local system type connection or <code>null</code> if the lookup fails.
|
||||||
|
*/
|
||||||
|
protected IHost getRemoteSystemConnection(String systemTypeID, String systemAddress, String systemName, String userID, String password) {
|
||||||
|
|
||||||
|
Exception exception = null;
|
||||||
|
String cause = null;
|
||||||
|
// Pre-create the local system connection properties
|
||||||
|
Properties properties = new Properties();
|
||||||
|
properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, systemTypeID);
|
||||||
|
properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, systemAddress); //$NON-NLS-1$
|
||||||
|
properties.setProperty(IRSEConnectionProperties.ATTR_NAME, systemName); //$NON-NLS-1$
|
||||||
|
properties.setProperty(IRSEConnectionProperties.ATTR_USERID, userID); //$NON-NLS-1$
|
||||||
|
properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, password); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IRSEConnectionProperties remoteSystemConnectionProperties;
|
||||||
|
remoteSystemConnectionProperties = getConnectionManager().loadConnectionProperties(properties, false);
|
||||||
|
|
||||||
|
IHost connection = null;
|
||||||
|
try {
|
||||||
|
connection = getConnectionManager().findOrCreateConnection(remoteSystemConnectionProperties);
|
||||||
|
} catch (Exception e) {
|
||||||
|
exception = e;
|
||||||
|
cause = exception.getLocalizedMessage();
|
||||||
|
}
|
||||||
|
assertNull("Failed to find and create remote system connection! Possible cause: " + cause, exception); //$NON-NLS-1$
|
||||||
|
assertNotNull("Failed to find and create remote system connection! Cause unknown!", connection); //$NON-NLS-1$
|
||||||
|
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -199,7 +199,7 @@ public class RSEConnectionManager implements IRSEConnectionManager {
|
||||||
|
|
||||||
// First lookup and create the profile
|
// First lookup and create the profile
|
||||||
String profileName = properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME);
|
String profileName = properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME);
|
||||||
Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid system profile name!", "unknown", profileName); //$NON-NLS-1$ //$NON-NLS-2$
|
//Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid system profile name!", "unknown", profileName); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ISystemProfile profile = profileName == null ? systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile() : systemRegistry.getSystemProfile(profileName);
|
ISystemProfile profile = profileName == null ? systemRegistry.getSystemProfileManager().getDefaultPrivateSystemProfile() : systemRegistry.getSystemProfile(profileName);
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
try {
|
try {
|
||||||
|
@ -210,6 +210,7 @@ public class RSEConnectionManager implements IRSEConnectionManager {
|
||||||
}
|
}
|
||||||
Assert.assertNull("FAILED(findOrCreateConnection): Failed to create system profile '" + profileName + "'! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$
|
Assert.assertNull("FAILED(findOrCreateConnection): Failed to create system profile '" + profileName + "'! Possible cause: " + cause, exception); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
profileName = profile.getName();
|
||||||
Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create system profile '" + profileName + "'!", profile); //$NON-NLS-1$ //$NON-NLS-2$
|
Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create system profile '" + profileName + "'!", profile); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
String name = properties.getProperty(IRSEConnectionProperties.ATTR_NAME);
|
String name = properties.getProperty(IRSEConnectionProperties.ATTR_NAME);
|
||||||
|
@ -239,7 +240,7 @@ public class RSEConnectionManager implements IRSEConnectionManager {
|
||||||
|
|
||||||
if (userId != null && password != null) {
|
if (userId != null && password != null) {
|
||||||
SystemSignonInformation info = new SystemSignonInformation(address, userId, password, systemType);
|
SystemSignonInformation info = new SystemSignonInformation(address, userId, password, systemType);
|
||||||
PasswordPersistenceManager.getInstance().add(info, true);
|
PasswordPersistenceManager.getInstance().add(info, true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create connection IHost object!", connection); //$NON-NLS-1$
|
Assert.assertNotNull("FAILED(findOrCreateConnection): Failed to find and/or create connection IHost object!", connection); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue