Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Green2013-11-01 16:11:12 +0000
committerSteffen Pingel2013-11-08 12:12:29 +0000
commit692f3d53eb4ce18ea8280008b83f9960f5b29251 (patch)
tree45485d73bc43741750997dee1a697aef8d3281fc /org.eclipse.mylyn.tasks.tests
parentce086e61ebf3d576ef6521c7505f0b7c2355d9e4 (diff)
downloadorg.eclipse.mylyn.tasks-692f3d53eb4ce18ea8280008b83f9960f5b29251.tar.gz
org.eclipse.mylyn.tasks-692f3d53eb4ce18ea8280008b83f9960f5b29251.tar.xz
org.eclipse.mylyn.tasks-692f3d53eb4ce18ea8280008b83f9960f5b29251.zip
420877: enhance AbstractRepositorySettingsPage to support repositories
that take no credentials Change-Id: Ifd82eeb43025d4684a068bfc8b60fc81ca2888f6 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420877
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
index efaba798c..28f949669 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/RepositorySettingsPageTest.java
@@ -236,6 +236,39 @@ public class RepositorySettingsPageTest extends TestCase {
assertSame(page.getConnector(), connector);
}
+ public void testNeedsRepositoryCredentialsDefaultsToTrue() {
+ TaskRepository repository = new TaskRepository(MockRepositoryConnector.CONNECTOR_KIND, "http://localhost/");
+ MockRepositorySettingsPage page = new MockRepositorySettingsPage(repository);
+ assertTrue(page.needsRepositoryCredentials());
+ }
+
+ public void testNeedsRepositoryCredentialsCanBeSetToFalse() {
+ TaskRepository repository = new TaskRepository(MockRepositoryConnector.CONNECTOR_KIND, "http://localhost/");
+ MockRepositorySettingsPage page = new MockRepositorySettingsPage(repository);
+ page.setNeedsRepositoryCredentials(false);
+ assertFalse(page.needsRepositoryCredentials());
+ }
+
+ public void testNeedsRepositoryCredentialsPageCompletesWithoutCredentials() {
+ TaskRepository repository = new TaskRepository(MockRepositoryConnector.CONNECTOR_KIND, "http://localhost/");
+ MockRepositorySettingsPage page = new MockRepositorySettingsPage(repository);
+ page.setNeedsRepositoryCredentials(false);
+
+ try {
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ page.createControl(shell);
+ page.setUrl("http://example.com");
+ assertNull(page.getRepositoryUserNameEditor());
+ assertNull(page.getRepositoryPasswordEditor());
+ assertTrue(page.isPageComplete());
+ assertNull(page.getMessage());
+ assertNotNull(page.createTaskRepository());
+ } finally {
+ page.dispose();
+ }
+
+ }
+
private class MockRepositorySettingsPage extends AbstractRepositorySettingsPage {
public MockRepositorySettingsPage(TaskRepository taskRepository) {
@@ -287,6 +320,15 @@ public class RepositorySettingsPageTest extends TestCase {
public String getConnectorKind() {
return MockRepositoryConnector.CONNECTOR_KIND;
}
+
+ public StringFieldEditor getRepositoryUserNameEditor() {
+ return repositoryUserNameEditor;
+ }
+
+ public StringFieldEditor getRepositoryPasswordEditor() {
+ return repositoryPasswordEditor;
+ }
+
}
}

Back to the top