Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2013-12-11 14:26:25 -0500
committerFrank Becker2013-12-12 15:48:18 -0500
commit9d440ad5ac6c6220d68bb5c057a67828d402cbe1 (patch)
treeb1865793b9354f794a0bbb131ec35c7fe5017b94 /org.eclipse.mylyn.bugzilla.tests/src
parent947cc7a1ba512a936de135b93386f4bb08ef2bac (diff)
downloadorg.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/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaTestSupportUtil.java23
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

Back to the top