Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-05-07 20:20:51 +0000
committerfbecker2010-05-07 20:20:51 +0000
commit90e70dc324a5cae7bec2a4ba570accec141dc935 (patch)
treed365fbedb52e421e4be05944186fb47615f719fc /org.eclipse.mylyn.bugzilla.tests/src
parent127e5534f2f86fb9844312d53ab66468a8709f4f (diff)
downloadorg.eclipse.mylyn.tasks-90e70dc324a5cae7bec2a4ba570accec141dc935.tar.gz
org.eclipse.mylyn.tasks-90e70dc324a5cae7bec2a4ba570accec141dc935.tar.xz
org.eclipse.mylyn.tasks-90e70dc324a5cae7bec2a4ba570accec141dc935.zip
ASSIGNED - bug 302654: support for Bugzilla 3.6
https://bugs.eclipse.org/bugs/show_bug.cgi?id=302654
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java34
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java53
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java12
3 files changed, 53 insertions, 46 deletions
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 6de56cd98..463cf7392 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
@@ -38,10 +38,10 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.RepositoryResponse;
-import org.eclipse.mylyn.tasks.core.TaskMapping;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
+import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
+import org.eclipse.mylyn.tasks.core.TaskMapping;
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
@@ -344,8 +344,9 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// }
//
public void testStdWorkflow32() throws Exception {
-// init32();
- doStdWorkflow("3");
+ if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM) {
+ doStdWorkflow("3");
+ }
}
private void doStdWorkflow(String DupBugID) throws Exception {
@@ -776,8 +777,9 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).setValue("" + deadline);
}
- taskData.getRoot().getAttribute(BugzillaAttribute.NEW_COMMENT.getKey()).setValue(
- "New Estimate: " + estimatedTime + "\nNew Remaining: " + remainingTime + "\nAdd: " + addTime);
+ taskData.getRoot()
+ .getAttribute(BugzillaAttribute.NEW_COMMENT.getKey())
+ .setValue("New Estimate: " + estimatedTime + "\nNew Remaining: " + remainingTime + "\nAdd: " + addTime);
Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()));
changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()));
@@ -793,12 +795,12 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
model = createModel(task);
taskData = model.getTaskData();
- assertEquals(estimatedTime, Float.parseFloat(taskData.getRoot().getAttribute(
- BugzillaAttribute.ESTIMATED_TIME.getKey()).getValue()));
- assertEquals(remainingTime, Float.parseFloat(taskData.getRoot().getAttribute(
- BugzillaAttribute.REMAINING_TIME.getKey()).getValue()));
- assertEquals(actualTime + addTime, Float.parseFloat(taskData.getRoot().getAttribute(
- BugzillaAttribute.ACTUAL_TIME.getKey()).getValue()));
+ assertEquals(estimatedTime,
+ Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()).getValue()));
+ assertEquals(remainingTime,
+ Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()).getValue()));
+ assertEquals(actualTime + addTime,
+ Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.ACTUAL_TIME.getKey()).getValue()));
if (enableDeadline) {
assertEquals(deadline, taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).getValue());
}
@@ -892,10 +894,10 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
event.setTaskRepository(repository);
event.setFullSynchronization(true);
connector.preSynchronization(event, null);
- assertTrue("Expected " + task4.getTaskId() + ", got: " + event.getStaleTasks(), event.getStaleTasks().contains(
- task4));
- assertTrue("Expected " + task5.getTaskId() + ", got: " + event.getStaleTasks(), event.getStaleTasks().contains(
- task5));
+ assertTrue("Expected " + task4.getTaskId() + ", got: " + event.getStaleTasks(),
+ event.getStaleTasks().contains(task4));
+ assertTrue("Expected " + task5.getTaskId() + ", got: " + event.getStaleTasks(),
+ event.getStaleTasks().contains(task5));
TasksUiInternal.synchronizeTasks(connector, tasks, true, null);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java
index 36727f3d8..6f61155b7 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java
@@ -20,7 +20,6 @@ import org.apache.xmlrpc.XmlRpcException;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.WebLocation;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
/**
@@ -42,44 +41,40 @@ public class BugzillaXMLRPCTest extends TestCase {
@SuppressWarnings("unused")
public void testxmlrpc() throws Exception {
- int uID = bugzillaClient.login();
- String x0 = bugzillaClient.getVersion();
- HashMap<?, ?> x1 = bugzillaClient.getTime();
- Date x2 = bugzillaClient.getDBTime();
- Date x3 = bugzillaClient.getWebTime();
- Object[] xx0 = bugzillaClient.getUserInfoFromIDs(new Integer[] { 1, 2 });
- Object[] xx1 = bugzillaClient.getUserInfoFromNames(new String[] { "tests@mylyn.eclipse.org" });
- Object[] xx2 = bugzillaClient.getUserInfoWithMatch(new String[] { "est" });
- Object[] xx3 = bugzillaClient.getAllFields();
- Object[] xx4 = bugzillaClient.getFieldsWithNames(new String[] { "qa_contact" });
- Object[] xx5 = bugzillaClient.getFieldsWithIDs(new Integer[] { 12, 18 });
- Object[] xx6 = bugzillaClient.getSelectableProducts();
- Object[] xx7 = bugzillaClient.getEnterableProducts();
- Object[] xx8 = bugzillaClient.getAccessibleProducts();
- Object[] xx9 = bugzillaClient.getProducts(new Integer[] { 1, 3 });
- int i = 9;
- i++;
+ if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_NO_XMLRPC) {
+ int uID = bugzillaClient.login();
+ String x0 = bugzillaClient.getVersion();
+ HashMap<?, ?> x1 = bugzillaClient.getTime();
+ Date x2 = bugzillaClient.getDBTime();
+ Date x3 = bugzillaClient.getWebTime();
+ Object[] xx0 = bugzillaClient.getUserInfoFromIDs(new Integer[] { 1, 2 });
+ Object[] xx1 = bugzillaClient.getUserInfoFromNames(new String[] { "tests@mylyn.eclipse.org" });
+ Object[] xx2 = bugzillaClient.getUserInfoWithMatch(new String[] { "est" });
+ Object[] xx3 = bugzillaClient.getAllFields();
+ Object[] xx4 = bugzillaClient.getFieldsWithNames(new String[] { "qa_contact" });
+ Object[] xx5 = bugzillaClient.getFieldsWithIDs(new Integer[] { 12, 18 });
+ Object[] xx6 = bugzillaClient.getSelectableProducts();
+ Object[] xx7 = bugzillaClient.getEnterableProducts();
+ Object[] xx8 = bugzillaClient.getAccessibleProducts();
+ Object[] xx9 = bugzillaClient.getProducts(new Integer[] { 1, 3 });
+ }
}
@SuppressWarnings("unused")
public void testxmlrpcInstalled() throws Exception {
- int uID = bugzillaClient.login();
- assertEquals(2, uID);
- BugzillaFixture.current().getBugzillaVersion();
- if (BugzillaFixture.current().getBugzillaVersion().compareTo(BugzillaVersion.BUGZILLA_3_6) == 0) {
- uID = -1;
- WebLocation webLocation = new WebLocation(BugzillaFixture.current().getRepositoryUrl()
- + "noxmlrpc/xmlrpc.cgi");
- webLocation.setCredentials(AuthenticationType.REPOSITORY, "tests@mylyn.eclipse.org", "mylyntest");
- BugzillaXmlRpcClient bugzillaClientNoXMLRPC = new BugzillaXmlRpcClient(webLocation);
- bugzillaClientNoXMLRPC.setContentTypeCheckingEnabled(true);
+ int uID = -1;
+ BugzillaFixture a = BugzillaFixture.current();
+ if (BugzillaFixture.current() == BugzillaFixture.BUGS_3_6_NO_XMLRPC) {
try {
- uID = bugzillaClientNoXMLRPC.login();
+ uID = bugzillaClient.login();
fail("Never reach this! We should get an XmlRpcException");
} catch (XmlRpcException e) {
assertEquals("The server returned an unexpected content type: 'text/html; charset=UTF-8'",
e.getMessage());
}
+ } else {
+ uID = bugzillaClient.login();
+ assertEquals(2, uID);
}
}
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 62d593e5a..efed936a2 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
@@ -68,6 +68,10 @@ public class BugzillaFixture extends TestFixture {
public static final String TEST_BUGZILLA_36_URL = getServerUrl("bugs36");
+ public static final String TEST_BUGZILLA_36_CUSTOM_URL = getServerUrl("bugs36customWF");
+
+ public static final String TEST_BUGZILLA_36_NO_XMLRPC = getServerUrl("bugs36noxmlrpc");
+
public static final String TEST_BUGZILLA_HEAD_URL = getServerUrl("bugshead");
public static final String TEST_BUGZILLA_LATEST_URL = TEST_BUGZILLA_36_URL;
@@ -97,13 +101,19 @@ public class BugzillaFixture extends TestFixture {
public static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
"3.6", "");
+ public static BugzillaFixture BUGS_3_6_CUSTOM = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_CUSTOM_URL, //
+ "3.6", "CUSTOM-WF");
+
+ public static BugzillaFixture BUGS_3_6_NO_XMLRPC = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_NO_XMLRPC, //
+ "3.6", "NO-XMLRPC");
+
public static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
"3.7", "");
public static BugzillaFixture DEFAULT = BUGS_3_6;
public static final BugzillaFixture[] ALL = new BugzillaFixture[] { BUGS_2_22, BUGS_3_0, BUGS_3_2, BUGS_3_4,
- BUGS_3_6, BUGS_HEAD };
+ BUGS_3_6, BUGS_3_6_CUSTOM, BUGS_3_6_NO_XMLRPC, BUGS_HEAD };
private final String version;

Back to the top