Lines 6-11
Link Here
|
6 |
* |
6 |
* |
7 |
* Contributors: |
7 |
* Contributors: |
8 |
* David Dykstal (IBM) - [210474] Deny save password function missing |
8 |
* David Dykstal (IBM) - [210474] Deny save password function missing |
|
|
9 |
* David Dykstal (IBM) - [379787] update tests to handle lack of secure storage access |
9 |
********************************************************************************/ |
10 |
********************************************************************************/ |
10 |
|
11 |
|
11 |
package org.eclipse.rse.tests.core.passwords; |
12 |
package org.eclipse.rse.tests.core.passwords; |
Lines 19-28
Link Here
|
19 |
|
20 |
|
20 |
/** |
21 |
/** |
21 |
* Tests for {@link PasswordPersistenceManager}. |
22 |
* Tests for {@link PasswordPersistenceManager}. |
22 |
* Test various aspects of mnemonic generation and assignment. |
|
|
23 |
*/ |
23 |
*/ |
24 |
public class PasswordsTest extends RSECoreTestCase { |
24 |
public class PasswordsTest extends RSECoreTestCase { |
25 |
|
25 |
|
26 |
/* (non-Javadoc) |
26 |
/* (non-Javadoc) |
27 |
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() |
27 |
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp() |
28 |
*/ |
28 |
*/ |
Lines 56-69
Link Here
|
56 |
int result = ppm.add(info, true, true); |
56 |
int result = ppm.add(info, true, true); |
57 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
57 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
58 |
SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); |
58 |
SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); |
59 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
59 |
if (ppm.isSecureStorageAccessAllowed()) { |
60 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
60 |
assertNotNull(returnedInfo); |
|
|
61 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
62 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
63 |
} else { |
64 |
assertNull(returnedInfo); |
65 |
} |
61 |
|
66 |
|
62 |
// remove the password for the system type |
67 |
// remove the password for the system type |
63 |
ppm.remove(systemType, hostAddress, userId); // removes only the entry for the system type |
68 |
ppm.remove(systemType, hostAddress, userId); // removes only the entry for the system type |
64 |
returnedInfo = ppm.find(systemType, hostAddress, userId, true); |
69 |
returnedInfo = ppm.find(systemType, hostAddress, userId, true); |
65 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
70 |
if (ppm.isSecureStorageAccessAllowed()) { |
66 |
assertEquals("system type not what was expected", defaultSystemType, returnedInfo.getSystemType()); |
71 |
assertNotNull(returnedInfo); |
|
|
72 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
73 |
assertEquals("system type not what was expected", defaultSystemType, returnedInfo.getSystemType()); |
74 |
} else { |
75 |
assertNull(returnedInfo); |
76 |
} |
67 |
returnedInfo = ppm.find(systemType, hostAddress, userId, false); |
77 |
returnedInfo = ppm.find(systemType, hostAddress, userId, false); |
68 |
assertNull("signon info was found but should not be", returnedInfo); |
78 |
assertNull("signon info was found but should not be", returnedInfo); |
69 |
|
79 |
|
Lines 78-85
Link Here
|
78 |
result = ppm.add(info, true, false); |
88 |
result = ppm.add(info, true, false); |
79 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
89 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
80 |
returnedInfo = ppm.find(systemType, hostAddress, userId); |
90 |
returnedInfo = ppm.find(systemType, hostAddress, userId); |
81 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
91 |
if (ppm.isSecureStorageAccessAllowed()) { |
82 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
92 |
assertNotNull(returnedInfo); |
|
|
93 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
94 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
95 |
} else { |
96 |
assertNull(returnedInfo); |
97 |
} |
83 |
returnedInfo = ppm.find(defaultSystemType, hostAddress, userId); |
98 |
returnedInfo = ppm.find(defaultSystemType, hostAddress, userId); |
84 |
assertNull("signon info was found but should not be", returnedInfo); |
99 |
assertNull("signon info was found but should not be", returnedInfo); |
85 |
|
100 |
|
Lines 109-116
Link Here
|
109 |
int result = ppm.add(info, true, true); |
124 |
int result = ppm.add(info, true, true); |
110 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
125 |
assertEquals("result of add was not what was expected", PasswordPersistenceManager.RC_OK, result); |
111 |
SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); |
126 |
SystemSignonInformation returnedInfo = ppm.find(systemType, hostAddress, userId); |
112 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
127 |
if (ppm.isSecureStorageAccessAllowed()) { |
113 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
128 |
assertNotNull(returnedInfo); |
|
|
129 |
assertEquals("passwords are not equal", password, returnedInfo.getPassword()); |
130 |
assertEquals("system type not what was expected", systemType, returnedInfo.getSystemType()); |
131 |
} else { |
132 |
assertNull(returnedInfo); |
133 |
} |
114 |
|
134 |
|
115 |
// change the preference for this system type, should erase all the passwords, including the default system type |
135 |
// change the preference for this system type, should erase all the passwords, including the default system type |
116 |
RSEPreferencesManager.setDenyPasswordSave(systemType, hostAddress, true); |
136 |
RSEPreferencesManager.setDenyPasswordSave(systemType, hostAddress, true); |
Lines 176-189
Link Here
|
176 |
PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance(); |
196 |
PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance(); |
177 |
ppm.add(new SystemSignonInformation("LOUDHOST.mycompany.com", "thatguy", "abc", systemType), true, false); |
197 |
ppm.add(new SystemSignonInformation("LOUDHOST.mycompany.com", "thatguy", "abc", systemType), true, false); |
178 |
SystemSignonInformation foundInfo = ppm.find(systemType, "LOUDHOST.mycompany.com", "thatguy"); |
198 |
SystemSignonInformation foundInfo = ppm.find(systemType, "LOUDHOST.mycompany.com", "thatguy"); |
179 |
assertNotNull(foundInfo); |
199 |
if (ppm.isSecureStorageAccessAllowed()) { |
180 |
assertEquals(foundInfo.getPassword(), "abc"); |
200 |
assertNotNull(foundInfo); |
181 |
foundInfo = ppm.find(systemType, "loudhost.mycompany.com", "thatguy"); |
201 |
assertEquals(foundInfo.getPassword(), "abc"); |
182 |
assertNotNull(foundInfo); |
202 |
foundInfo = ppm.find(systemType, "loudhost.mycompany.com", "thatguy"); |
183 |
assertEquals(foundInfo.getPassword(), "abc"); |
203 |
assertNotNull(foundInfo); |
184 |
foundInfo = ppm.find(systemType, "loudhost.MyCompany.com", "thatguy"); |
204 |
assertEquals(foundInfo.getPassword(), "abc"); |
185 |
assertNotNull(foundInfo); |
205 |
foundInfo = ppm.find(systemType, "loudhost.MyCompany.com", "thatguy"); |
186 |
assertEquals(foundInfo.getPassword(), "abc"); |
206 |
assertNotNull(foundInfo); |
|
|
207 |
assertEquals(foundInfo.getPassword(), "abc"); |
208 |
} else { |
209 |
assertNull(foundInfo); |
210 |
} |
187 |
} |
211 |
} |
188 |
|
212 |
|
189 |
public void testBadArgs() { |
213 |
public void testBadArgs() { |