|
Lines 16-21
Link Here
|
| 16 |
import java.util.ArrayList; |
16 |
import java.util.ArrayList; |
| 17 |
import java.util.Collections; |
17 |
import java.util.Collections; |
| 18 |
import java.util.Date; |
18 |
import java.util.Date; |
|
|
19 |
import java.util.HashMap; |
| 19 |
import java.util.List; |
20 |
import java.util.List; |
| 20 |
import java.util.Map; |
21 |
import java.util.Map; |
| 21 |
|
22 |
|
|
Lines 38-43
Link Here
|
| 38 |
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector; |
39 |
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector; |
| 39 |
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryQuery; |
40 |
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryQuery; |
| 40 |
import org.eclipse.mylyn.tasks.tests.connector.MockTask; |
41 |
import org.eclipse.mylyn.tasks.tests.connector.MockTask; |
|
|
42 |
import org.eclipse.mylyn.tasks.ui.MigrateToSecureStorageJob; |
| 41 |
|
43 |
|
| 42 |
/** |
44 |
/** |
| 43 |
* @author Mik Kersten |
45 |
* @author Mik Kersten |
|
Lines 67-72
Link Here
|
| 67 |
|
69 |
|
| 68 |
private final String AUTH_HTTP_USERNAME = AUTH_HTTP + USERNAME; |
70 |
private final String AUTH_HTTP_USERNAME = AUTH_HTTP + USERNAME; |
| 69 |
|
71 |
|
|
|
72 |
private final String AUTH_PROXY = "org.eclipse.mylyn.tasklist.repositories.proxy"; //$NON-NLS-1$ |
| 73 |
|
| 74 |
private final String AUTH_PROXY_PASSWORD = AUTH_PROXY + PASSWORD; |
| 75 |
|
| 76 |
private final String AUTH_PROXY_USERNAME = AUTH_PROXY + USERNAME; |
| 77 |
|
| 70 |
private final String AUTH_SCHEME = "Basic"; //$NON-NLS-1$ |
78 |
private final String AUTH_SCHEME = "Basic"; //$NON-NLS-1$ |
| 71 |
|
79 |
|
| 72 |
private final String AUTH_REALM = ""; //$NON-NLS-1$ |
80 |
private final String AUTH_REALM = ""; //$NON-NLS-1$ |
|
Lines 126-162
Link Here
|
| 126 |
assertEquals("httpPassword", map.get(AUTH_HTTP_PASSWORD)); |
134 |
assertEquals("httpPassword", map.get(AUTH_HTTP_PASSWORD)); |
| 127 |
} |
135 |
} |
| 128 |
|
136 |
|
| 129 |
// FIXME 3.4 re-enable test |
137 |
public void testMigrationToSecureStorage() throws Exception { |
| 130 |
// public void testMigrationToSecureStorage() throws Exception { |
138 |
TaskRepository repository1 = new TaskRepository("bugzilla", "http://repository1/"); |
| 131 |
// TaskRepository repository1 = new TaskRepository("bugzilla", "http://repository1/"); |
139 |
|
| 132 |
// |
140 |
Map<String, String> map = new HashMap<String, String>(); |
| 133 |
// Map<String, String> map = new HashMap<String, String>(); |
141 |
map.put(AUTH_USERNAME, "testuser"); |
| 134 |
// map.put(AUTH_USERNAME, "testuser"); |
142 |
map.put(AUTH_PASSWORD, "testpassword"); |
| 135 |
// map.put(AUTH_PASSWORD, "testpassword"); |
143 |
map.put(AUTH_HTTP_USERNAME, "testhttpuser"); |
| 136 |
// map.put(AUTH_HTTP_USERNAME, "testhttpuser"); |
144 |
map.put(AUTH_HTTP_PASSWORD, "testhttppassword"); |
| 137 |
// map.put(AUTH_HTTP_PASSWORD, "testhttppassword"); |
145 |
map.put(AUTH_PROXY_USERNAME, "testproxyuser"); |
| 138 |
// |
146 |
map.put(AUTH_PROXY_PASSWORD, "testproxypassword"); |
| 139 |
// Platform.addAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME, map); |
147 |
|
| 140 |
// |
148 |
Platform.addAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME, map); |
| 141 |
// map = Platform.getAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME); |
149 |
|
| 142 |
// |
150 |
map = Platform.getAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME); |
| 143 |
// assertEquals("testuser", map.get(AUTH_USERNAME)); |
151 |
|
| 144 |
// assertEquals("testpassword", map.get(AUTH_PASSWORD)); |
152 |
assertEquals("testuser", map.get(AUTH_USERNAME)); |
| 145 |
// assertEquals("testhttpuser", map.get(AUTH_HTTP_USERNAME)); |
153 |
assertEquals("testpassword", map.get(AUTH_PASSWORD)); |
| 146 |
// assertEquals("testhttppassword", map.get(AUTH_HTTP_PASSWORD)); |
154 |
assertEquals("testhttpuser", map.get(AUTH_HTTP_USERNAME)); |
| 147 |
// |
155 |
assertEquals("testhttppassword", map.get(AUTH_HTTP_PASSWORD)); |
| 148 |
// assertTrue(manager.migrateToSecureStorage(repository1)); |
156 |
|
| 149 |
// |
157 |
assertTrue(MigrateToSecureStorageJob.migrateToSecureStorage(repository1)); |
| 150 |
// assertNull(Platform.getAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME)); |
158 |
|
| 151 |
// |
159 |
assertNull(Platform.getAuthorizationInfo(new URL(repository1.getUrl()), AUTH_REALM, AUTH_SCHEME)); |
| 152 |
// ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault() |
160 |
|
| 153 |
// .node(ITasksCoreConstants.ID_PLUGIN); |
161 |
ISecurePreferences securePreferences = SecurePreferencesFactory.getDefault() |
| 154 |
// securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository1.getUrl())); |
162 |
.node(ITasksCoreConstants.ID_PLUGIN); |
| 155 |
// assertEquals("testuser", securePreferences.get(AUTH_USERNAME, null)); |
163 |
securePreferences = securePreferences.node(EncodingUtils.encodeSlashes(repository1.getUrl())); |
| 156 |
// assertEquals("testpassword", securePreferences.get(AUTH_PASSWORD, null)); |
164 |
assertEquals("testuser", repository1.getUserName()); |
| 157 |
// assertEquals("testhttpuser", securePreferences.get(AUTH_HTTP_USERNAME, null)); |
165 |
assertEquals("testpassword", securePreferences.get(AUTH_PASSWORD, null)); |
| 158 |
// assertEquals("testhttppassword", securePreferences.get(AUTH_HTTP_PASSWORD, null)); |
166 |
assertEquals("testhttpuser", securePreferences.get(AUTH_HTTP_USERNAME, null)); |
| 159 |
// } |
167 |
assertEquals("testhttppassword", securePreferences.get(AUTH_HTTP_PASSWORD, null)); |
|
|
168 |
assertEquals("testproxyuser", securePreferences.get(AUTH_PROXY_USERNAME, null)); |
| 169 |
assertEquals("testproxypassword", securePreferences.get(AUTH_PROXY_PASSWORD, null)); |
| 170 |
} |
| 160 |
|
171 |
|
| 161 |
public void testRepositoryWithSlash() throws MalformedURLException { |
172 |
public void testRepositoryWithSlash() throws MalformedURLException { |
| 162 |
|
173 |
|