Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-04-16 21:06:47 +0000
committerfbecker2010-04-16 21:06:47 +0000
commitc9ea0b81a3deed810d8f5a543352a5c2394fed34 (patch)
tree0f47f896852fd4d04be5d3f1ecc246a0a13e43e4 /org.eclipse.mylyn.bugzilla.tests
parent0a6512881e6d8e5146cee44221a88d75981db767 (diff)
downloadorg.eclipse.mylyn.tasks-c9ea0b81a3deed810d8f5a543352a5c2394fed34.tar.gz
org.eclipse.mylyn.tasks-c9ea0b81a3deed810d8f5a543352a5c2394fed34.tar.xz
org.eclipse.mylyn.tasks-c9ea0b81a3deed810d8f5a543352a5c2394fed34.zip
RESOLVED - bug 309408: anonymous access to Eclipse.org broken
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309408
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
index 0661c256c..063c768be 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaClientTest.java
@@ -21,12 +21,15 @@ import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
+import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
+import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
@@ -97,6 +100,56 @@ public class BugzillaClientTest extends TestCase {
}
}
+ public void testValidateAnonymous() throws Exception {
+ TaskRepository repository = BugzillaFixture.current().repository();
+ AuthenticationCredentials anonymousCreds = new AuthenticationCredentials("", "");
+ repository.setCredentials(AuthenticationType.REPOSITORY, anonymousCreds, false);
+ TaskRepositoryLocation location = new TaskRepositoryLocation(repository);
+
+ client = new BugzillaClient(location, repository, BugzillaFixture.current().connector());
+ client.validate(new NullProgressMonitor());
+ }
+
+ public void testValidateAnonymousPlusHTTP() throws Exception {
+ TaskRepository repository = BugzillaFixture.current().repository();
+ AuthenticationCredentials anonymousCreds = new AuthenticationCredentials("", "");
+ repository.setCredentials(AuthenticationType.REPOSITORY, anonymousCreds, false);
+ repository.setCredentials(AuthenticationType.HTTP, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"), false);
+ TaskRepositoryLocation location = new TaskRepositoryLocation(repository);
+
+ client = new BugzillaClient(location, repository, BugzillaFixture.current().connector());
+ try {
+ client.validate(new NullProgressMonitor());
+ } catch (Exception e) {
+ assertEquals("Unable to login to " + repository.getUrl()
+ + ".\n\n\n The username or password you entered is not valid.\n\n"
+ + "Please validate credentials via Task Repositories view.", e.getMessage());
+ }
+ }
+
+ public void testValidateUser() throws Exception {
+ TaskRepository repository = BugzillaFixture.current().repository();
+ TaskRepositoryLocation location = new TaskRepositoryLocation(repository);
+
+ client = new BugzillaClient(location, repository, BugzillaFixture.current().connector());
+ client.validate(new NullProgressMonitor());
+ }
+
+ public void testValidateUserPlusHTTP() throws Exception {
+ TaskRepository repository = BugzillaFixture.current().repository();
+ repository.setCredentials(AuthenticationType.HTTP, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"), false);
+ TaskRepositoryLocation location = new TaskRepositoryLocation(repository);
+
+ client = new BugzillaClient(location, repository, BugzillaFixture.current().connector());
+ try {
+ client.validate(new NullProgressMonitor());
+ } catch (Exception e) {
+ assertEquals("Unable to login to " + repository.getUrl()
+ + ".\n\n\n The username or password you entered is not valid.\n\n"
+ + "Please validate credentials via Task Repositories view.", e.getMessage());
+ }
+ }
+
public void testCommentQuery() throws Exception {
BugzillaRepositoryConnector connector = BugzillaFixture.current().connector();
BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, connector);

Back to the top