diff options
author | Frank Becker | 2013-12-11 19:26:25 +0000 |
---|---|---|
committer | Frank Becker | 2013-12-12 20:48:18 +0000 |
commit | 9d440ad5ac6c6220d68bb5c057a67828d402cbe1 (patch) | |
tree | b1865793b9354f794a0bbb131ec35c7fe5017b94 /org.eclipse.mylyn.bugzilla.tests | |
parent | 947cc7a1ba512a936de135b93386f4bb08ef2bac (diff) | |
download | org.eclipse.mylyn.tasks-9d440ad5ac6c6220d68bb5c057a67828d402cbe1.tar.gz org.eclipse.mylyn.tasks-9d440ad5ac6c6220d68bb5c057a67828d402cbe1.tar.xz org.eclipse.mylyn.tasks-9d440ad5ac6c6220d68bb5c057a67828d402cbe1.zip |
414360: add BugzillaTestSupportUtil.isInvalidLogon()
Change-Id: I28b1d891c7d4349cd48a2fab70d80bf1e3bb3588
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414360
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
5 files changed, 28 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java index ebe30b209..e1ef531d7 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; +import org.eclipse.mylyn.bugzilla.tests.support.BugzillaTestSupportUtil; import org.eclipse.mylyn.commons.net.AuthenticationCredentials; import org.eclipse.mylyn.commons.net.AuthenticationType; import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel; @@ -501,7 +502,7 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest { connector.getTaskAttachmentHandler().postContent(repository, task, attachment, attachmentMapper.getComment(), attrAttachment, new NullProgressMonitor()); } catch (CoreException e) { - assertTrue(e.getMessage().contains("invalid username or password")); + assertTrue(BugzillaTestSupportUtil.isInvalidLogon(e)); assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); return; } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java index e0cce0ac2..9d1b36208 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java @@ -28,6 +28,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; +import org.eclipse.mylyn.bugzilla.tests.support.BugzillaTestSupportUtil; import org.eclipse.mylyn.commons.net.AuthenticationCredentials; import org.eclipse.mylyn.commons.net.AuthenticationType; import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel; @@ -957,8 +958,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest { AttachmentUtil.postContext(connector, repository, task, "test", attribute, new NullProgressMonitor()); } catch (CoreException e) { assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState()); - assertTrue(e.getStatus().getMessage().indexOf("invalid username or password") != -1 - || e.getStatus().getMessage().indexOf("invalid login or password") != -1); + assertTrue(BugzillaTestSupportUtil.isInvalidLogon(e)); return; } finally { repository.setCredentials(AuthenticationType.REPOSITORY, oldCreds, false); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java index 1f9dd3f78..9c8259492 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java @@ -27,6 +27,7 @@ import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.mylyn.bugzilla.tests.AbstractBugzillaTest; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaHarness; +import org.eclipse.mylyn.bugzilla.tests.support.BugzillaTestSupportUtil; import org.eclipse.mylyn.commons.net.AuthenticationType; import org.eclipse.mylyn.commons.net.WebLocation; import org.eclipse.mylyn.internal.bugzilla.core.AbstractBugzillaOperation; @@ -444,7 +445,6 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { public void testXmlRpcInstalled() throws Exception { int uID = -1; IProgressMonitor monitor = new NullProgressMonitor(); - BugzillaFixture a = BugzillaFixture.current(); if (!BugzillaFixture.current().isXmlRpcEnabled()) { try { uID = bugzillaClient.login(monitor); diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java index 1f9144779..164898e2f 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java @@ -305,5 +305,4 @@ public class BugzillaFixture extends TestFixture { public BugzillaHarness createHarness() { return new BugzillaHarness(this); } - } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaTestSupportUtil.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaTestSupportUtil.java new file mode 100644 index 000000000..8ecc3d012 --- /dev/null +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaTestSupportUtil.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2013 Frank Becker and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Frank Beckers - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.bugzilla.tests.support; + +import org.eclipse.core.runtime.CoreException; + +public abstract class BugzillaTestSupportUtil { + + public static boolean isInvalidLogon(CoreException e) { + return e.getMessage().indexOf("invalid username or password") != -1 + || e.getMessage().indexOf("invalid login or password") != -1; + } + +}
\ No newline at end of file |