Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java26
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties1
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp7
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp3
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb1
-rw-r--r--org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java92
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaHarness.java219
12 files changed, 361 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 9f22dae62..7a2513e65 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -228,6 +228,8 @@ public interface IBugzillaConstants {
public static final String ERROR_MSG_INVALID_BUG_ID = Messages.IBugzillaConstants_invalid_bug_id_requested_bug_id_does_not_exist;
+ public static final String ERROR_MSG_NOT_FOUND_BUG_ID = Messages.IBugzillaConstants_Bug_id_not_found;
+
public static final String ERROR_MSG_NO_DATA_RETRIEVED = Messages.IBugzillaConstants_NO_DATA_RETRIEVED_FOR_TASK;
public static final String INVALID_CREDENTIALS = Messages.IBugzillaConstants_invalid_repository_credentials;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
index 766f9dd51..0d4a71cfe 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
@@ -275,6 +275,8 @@ public class Messages extends NLS {
public static String BugzillaTaskDataHandler_Submitting_task;
+ public static String IBugzillaConstants_Bug_id_not_found;
+
public static String BugzillaTaskDataHandler_updating_attachment;
public static String IBugzillaConstants_Bugzilla_login_information_or_repository_version_incorrect;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
index 0a5f0d6f9..0dfa28921 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/MultiBugReportFactory.java
@@ -57,8 +57,10 @@ public class MultiBugReportFactory extends AbstractReportFactory {
if (bugMap.size() == 1 && contentHandler.errorOccurred()) {
String errorResponse = contentHandler.getErrorMessage().toLowerCase(Locale.ENGLISH);
- if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTFOUND)
- || errorResponse.equals(IBugzillaConstants.XML_ERROR_INVALIDBUGID)) {
+ if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTFOUND)) {
+ throw new CoreException(new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
+ RepositoryStatus.ERROR_REPOSITORY, "", IBugzillaConstants.ERROR_MSG_NOT_FOUND_BUG_ID)); //$NON-NLS-1$
+ } else if (errorResponse.equals(IBugzillaConstants.XML_ERROR_INVALIDBUGID)) {
throw new CoreException(new BugzillaStatus(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY, "", IBugzillaConstants.ERROR_MSG_INVALID_BUG_ID)); //$NON-NLS-1$
} else if (errorResponse.equals(IBugzillaConstants.XML_ERROR_NOTPERMITTED)) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
index 6403a8524..2fa4a3ed9 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
@@ -88,6 +88,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
private final SimpleDateFormat simpleFormatter_deltaTS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //$NON-NLS-1$
+ private String bugIDValue;
+
public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector,
Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields,
BugzillaRepositoryConnector connector) {
@@ -150,6 +152,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
taskComment = null;
longDescs = new ArrayList<TaskComment>();
token = null;
+ bugIDValue = null;
break;
case LONG_DESC:
String is_private = attributes.getValue("isprivate"); //$NON-NLS-1$
@@ -309,6 +312,7 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
switch (tag) {
case BUG_ID: {
+ bugIDValue = parsedText.trim();
repositoryTaskData = taskDataMap.get(parsedText.trim());
if (repositoryTaskData == null) {
errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
@@ -545,8 +549,30 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION, false);
break;
case ALIAS:
+ if (repositoryTaskData == null) {
+ repositoryTaskData = taskDataMap.get(parsedText.trim());
+ if (repositoryTaskData == null) {
+ errorMessage = parsedText + Messages.SaxMultiBugReportContentHandler_id_not_found;
+ bugParseErrorOccurred = true;
+ break;
+ } else {
+ errorMessage = null;
+ bugParseErrorOccurred = false;
+ }
+ }
BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
IBugzillaConstants.BUGZILLA_PARAM_USEBUGALIASES, false);
+ TaskAttribute attr = repositoryTaskData.getRoot().getMappedAttribute(BugzillaAttribute.BUG_ID.getKey());
+ if (attr == null) {
+ attr = BugzillaTaskDataHandler.createAttribute(repositoryTaskData, BugzillaAttribute.BUG_ID);
+ }
+ attr.setValue(bugIDValue);
+
+ if (exporter != null) {
+ createAttrribute(exporter, BugzillaAttribute.EXPORTER_NAME);
+ } else {
+ createAttrribute("", BugzillaAttribute.EXPORTER_NAME); //$NON-NLS-1$
+ }
break;
case SEE_ALSO:
BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
index 2039c2821..31c9fafb7 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
@@ -141,6 +141,7 @@ BugzillaTaskDataHandler_Receiving_tasks=Receiving tasks
BugzillaTaskDataHandler_Submitting_task=Submitting task
BugzillaTaskDataHandler_updating_attachment=Updating Attachment
+IBugzillaConstants_Bug_id_not_found=Bug id not found. The requested bug id does not exist.
IBugzillaConstants_Bugzilla_login_information_or_repository_version_incorrect=Bugzilla login information or repository version incorrect
IBugzillaConstants_invalid_bug_id_requested_bug_id_does_not_exist=Invalid bug id. The requested bug id does not exist.
IBugzillaConstants_invalid_repository_credentials=Invalid repository credentials.
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
index 1cc29f3b2..55ad949e0 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp
@@ -62,6 +62,13 @@ define bugzilla::defaultsites($base = $bugzilla::bugzillaBase, $userOwner = $bug
envdefault => true,
}
+ bugzilla::site { "bugzilla-4.2.5-bugaliases":
+ major => "4",
+ minor => "2",
+ branchTag => "bugzilla-4.2.5",
+ usebugaliases => true,
+ }
+
bugzilla::site { "bugzilla-4.4":
major => "4",
minor => "4",
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
index 980895962..a97c3d06f 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/site.pp
@@ -31,6 +31,7 @@ define bugzilla::site (
$envdefault = false,
$clearDB = $bugzilla::clearDB,
$desciptorfile = " ",
+ $usebugaliases = false,
) {
include "bugzilla"
@@ -44,6 +45,8 @@ define bugzilla::site (
$envinfo1 = "Custom Workflow"
} elsif $custom_wf_and_status {
$envinfo1 = "Custom Workflow and Status"
+ } elsif $usebugaliases {
+ $envinfo1 = "Use Bugaliases"
} else {
$envinfo1 = ""
}
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
index 2022724ca..bc75ee3d5 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/answers.erb
@@ -16,4 +16,5 @@ $answer{'mail_delivery_method'} = 'None';
$answer{'insidergroup'} = 'bz_canusewhineatothers';
<% if @custom_wf_and_status %>$answer{'duplicate_or_move_bug_status'} = 'CLOSED';<% end %>
+<% if @usebugaliases %>$answer{'usebugaliases'} = '1';<% end %>
$answer{'NO_PAUSE'} = 1
diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
index af588c874..920c5a55d 100644
--- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
+++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/templates/service.json.erb
@@ -7,7 +7,8 @@
<% if @envdefault %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"default": "1"<% end %>
<% if @custom_wf %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"custom_wf": "<%= custom_wf %>"<% end %>
<% if @custom_wf_and_status %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"custom_wf_and_status": "<%= custom_wf_and_status %>"<% end %>
-<% if !@xmlrpc_enabled %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"xmlrpc_enabled": "<%= xmlrpc_enabled %>"<% end %>
+<% if !@xmlrpc_enabled %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"xmlrpc_enabled": "<%= xmlrpc_enabled %>"<% end %>
<% if @desciptorfile > " " %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"desciptorfile": "<%= desciptorfile %>"<% end %>
+<% if @usebugaliases %><% if propertyanz.to_i > 0 %> ,<% else %> <% end %><% propertyanz = propertyanz.to_i -%><% propertyanz += 1 -%>"usebugaliases": "<%= usebugaliases %>"<% end %>
}
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java
index 08349ee69..52e02d8bf 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java
@@ -36,7 +36,11 @@ import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
public class BugzillaCustomRepositoryTest extends AbstractBugzillaTest {
public void testWorkflow() throws Exception {
- doCustomWorkflow("3");
+ String taskId = harness.taskCfBugIdExists();
+ if (taskId == null) {
+ taskId = harness.createCfBugIdTask();
+ }
+ doCustomWorkflow(taskId);
}
private void doCustomWorkflow(String DupBugID) throws Exception {
@@ -281,6 +285,6 @@ public class BugzillaCustomRepositoryTest extends AbstractBugzillaTest {
assertEquals("CLOSED", statusAttribute.getValue());
resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION);
assertEquals("FIXED", resolution.getValue());
-
}
+
}
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 91c986c73..24af59b67 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
@@ -18,11 +18,14 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
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.commons.net.AuthenticationCredentials;
@@ -57,6 +60,7 @@ import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.core.data.TaskDataCollector;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.mylyn.tasks.core.data.TaskOperation;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -73,11 +77,89 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
connector.getTaskData(repository, "99999", new NullProgressMonitor());
fail("Invalid id error should have resulted");
} catch (CoreException e) {
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_4) > 0) {
+ assertTrue(e.getStatus().getMessage().contains(IBugzillaConstants.ERROR_MSG_INVALID_BUG_ID));
+ } else {
+ assertTrue(e.getStatus().getMessage().contains(IBugzillaConstants.ERROR_MSG_NOT_FOUND_BUG_ID));
+ }
+ }
+
+ }
+
+ public void testAliasRetrievalFailure() throws CoreException {
+ try {
+ connector.getTaskData(repository, "Hugo", new NullProgressMonitor());
+ fail("Invalid id error should have resulted");
+ } catch (CoreException e) {
assertTrue(e.getStatus().getMessage().contains(IBugzillaConstants.ERROR_MSG_INVALID_BUG_ID));
}
}
+ public void testAliasRetrieval() throws Exception {
+ String taskId = harness.taskAliasExists();
+ if (taskId == null) {
+ taskId = harness.createAliasTask();
+ }
+ String usebugaliases = BugzillaFixture.current().getProperty("usebugaliases");
+ boolean bugAliases = Boolean.parseBoolean(usebugaliases);
+ try {
+ TaskData td = connector.getTaskData(repository, "Fritz", new NullProgressMonitor());
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_4) >= 0
+ || bugAliases) {
+ assertNotNull(td);
+ } else {
+ fail("testAliasRetrieval: never reach this! CoreException expected");
+ }
+ } catch (CoreException e) {
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_4) < 0
+ && !bugAliases) {
+ assertTrue(e.getStatus().getMessage().contains(IBugzillaConstants.ERROR_MSG_INVALID_BUG_ID));
+ } else {
+ fail("testAliasRetrieval: never reach this! no CoreException expected");
+ }
+ }
+ }
+
+ public void testAliasMultiRetrieval() throws Exception {
+ String taskId = harness.taskAliasExists();
+ if (taskId == null) {
+ taskId = harness.createAliasTask();
+ }
+ taskId = harness.taskAlias2Exists();
+ if (taskId == null) {
+ taskId = harness.createAliasTask2();
+ }
+ Set<String> taskIds = new HashSet<String>();
+ taskIds.add("Hugo");
+ taskIds.add("Fritz");
+ taskIds.add(taskId);
+ final Map<String, TaskData> results = new HashMap<String, TaskData>();
+ final Map<String, IStatus> failed = new HashMap<String, IStatus>();
+ TaskDataCollector collector = new TaskDataCollector() {
+ @Override
+ public void accept(TaskData taskData) {
+ results.put(taskData.getTaskId(), taskData);
+ }
+
+ @Override
+ public void failed(String taskId, IStatus status) {
+ failed.put(taskId, status);
+ }
+
+ };
+ connector.getTaskDataHandler().getMultiTaskData(repository, taskIds, collector, new NullProgressMonitor());
+ String usebugaliases = BugzillaFixture.current().getProperty("usebugaliases");
+ if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_4) >= 0
+ || Boolean.parseBoolean(usebugaliases)) {
+ assertEquals(2, results.size());
+ assertEquals(1, failed.size());
+ } else {
+ assertEquals(1, results.size());
+ assertEquals(2, failed.size());
+ }
+ }
+
public void testMultiRetrievalFailure() throws Exception {
TaskData taskData1 = BugzillaFixture.current().createTask(PrivilegeLevel.USER, null, null);
@@ -348,13 +430,17 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
// }
//
public void testStdWorkflow() throws Exception {
+ String taskId = harness.taskCfBugIdExists();
+ if (taskId == null) {
+ taskId = harness.createCfBugIdTask();
+ }
if (BugzillaFixture.current().getBugzillaVersion().compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
if (!BugzillaFixture.current().isCustomWorkflow() && !BugzillaFixture.current().isCustomWorkflowAndStatus()) {
- doStdWorkflow32("3");
+ doStdWorkflow32(taskId);
}
} else {
- doStdWorkflow40_1("3");
- doStdWorkflow40_2("3");
+ doStdWorkflow40_1(taskId);
+ doStdWorkflow40_2(taskId);
}
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaHarness.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaHarness.java
index 815b4f0eb..e5efca926 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaHarness.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaHarness.java
@@ -257,7 +257,11 @@ public class BugzillaHarness {
cf_largetextbox.setValue("large text box");
cf_multiselect.setValue("Blue");
cf_datetime.setValue("2012-01-01 00:00:00");
- cf_bugid.setValue("3");
+ String cf_bugidValue = taskCfBugIdExists();
+ if (cf_bugidValue == null) {
+ cf_bugidValue = createCfBugIdTask();
+ }
+ cf_bugid.setValue(cf_bugidValue);
model.attributeChanged(cf_freetext);
model.attributeChanged(cf_dropdown);
@@ -713,4 +717,217 @@ public class BugzillaHarness {
return taskId;
}
+ public String taskAliasExists() {
+ String taskID = null;
+ String queryUrlString = abstractBugzillaTest.getRepository().getRepositoryUrl() + "/buglist.cgi?"
+ + "short_desc=test%20Alias%20Bug&resolution=---&query_format=advanced"
+ + "&short_desc_type=casesubstring&component=TestComponent&product=TestProduct";
+ RepositoryQuery query = new RepositoryQuery(abstractBugzillaTest.getRepository().getConnectorKind(),
+ "handle-testQueryViaConnector");
+ query.setUrl(queryUrlString);
+ final Map<Integer, TaskData> changedTaskData = new HashMap<Integer, TaskData>();
+ TaskDataCollector collector = new TaskDataCollector() {
+ @Override
+ public void accept(TaskData taskData) {
+ changedTaskData.put(Integer.valueOf(taskData.getTaskId()), taskData);
+ }
+ };
+ abstractBugzillaTest.getConnector().performQuery(abstractBugzillaTest.getRepository(), query, collector, null,
+ new NullProgressMonitor());
+ if (changedTaskData.size() > 0) {
+ Set<Integer> ks = changedTaskData.keySet();
+ SortedSet<Integer> sks = new TreeSet<Integer>(ks);
+ taskID = sks.last().toString();
+ }
+ return taskID;
+ }
+
+ public String createAliasTask() throws Exception {
+ final TaskMapping taskMappingInit = new TaskMapping() {
+
+ @Override
+ public String getProduct() {
+ return "TestProduct";
+ }
+ };
+ final TaskMapping taskMappingSelect = new TaskMapping() {
+ @Override
+ public String getComponent() {
+ return "TestComponent";
+ }
+
+ @Override
+ public String getSummary() {
+ return "test Alias Bug";
+ }
+
+ @Override
+ public String getDescription() {
+ return "The Description of the Alias Bug";
+ }
+ };
+ final TaskData[] taskDataNew = new TaskData[1];
+
+ // create Task
+ taskDataNew[0] = TasksUiInternal.createTaskData(abstractBugzillaTest.getRepository(), taskMappingInit,
+ taskMappingSelect, null);
+ ITask taskNew = TasksUiUtil.createOutgoingNewTask(taskDataNew[0].getConnectorKind(),
+ taskDataNew[0].getRepositoryUrl());
+
+ ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(taskNew, taskDataNew[0]);
+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
+ TaskAttribute alias = taskDataNew[0].getRoot().getAttribute("alias");
+ if (alias == null) {
+ alias = taskDataNew[0].getRoot().createAttribute("alias");
+ }
+ alias.setValue("Fritz");
+ changed.add(alias);
+ workingCopy.save(changed, null);
+ RepositoryResponse response = BugzillaFixture.current().submitTask(taskDataNew[0],
+ abstractBugzillaTest.getClient());
+ ((AbstractTask) taskNew).setSubmitting(true);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
+ String taskId = response.getTaskId();
+ return taskId;
+ }
+
+ public String taskAlias2Exists() {
+ String taskID = null;
+ String queryUrlString = abstractBugzillaTest.getRepository().getRepositoryUrl() + "/buglist.cgi?"
+ + "short_desc=test%20Alias%20Bug2&resolution=---&query_format=advanced"
+ + "&short_desc_type=casesubstring&component=TestComponent&product=TestProduct";
+ RepositoryQuery query = new RepositoryQuery(abstractBugzillaTest.getRepository().getConnectorKind(),
+ "handle-testQueryViaConnector");
+ query.setUrl(queryUrlString);
+ final Map<Integer, TaskData> changedTaskData = new HashMap<Integer, TaskData>();
+ TaskDataCollector collector = new TaskDataCollector() {
+ @Override
+ public void accept(TaskData taskData) {
+ changedTaskData.put(Integer.valueOf(taskData.getTaskId()), taskData);
+ }
+ };
+ abstractBugzillaTest.getConnector().performQuery(abstractBugzillaTest.getRepository(), query, collector, null,
+ new NullProgressMonitor());
+ if (changedTaskData.size() > 0) {
+ Set<Integer> ks = changedTaskData.keySet();
+ SortedSet<Integer> sks = new TreeSet<Integer>(ks);
+ taskID = sks.last().toString();
+ }
+ return taskID;
+ }
+
+ public String createAliasTask2() throws Exception {
+ final TaskMapping taskMappingInit = new TaskMapping() {
+
+ @Override
+ public String getProduct() {
+ return "TestProduct";
+ }
+ };
+ final TaskMapping taskMappingSelect = new TaskMapping() {
+ @Override
+ public String getComponent() {
+ return "TestComponent";
+ }
+
+ @Override
+ public String getSummary() {
+ return "test Alias Bug2";
+ }
+
+ @Override
+ public String getDescription() {
+ return "The Description of the Alias Bug";
+ }
+ };
+ final TaskData[] taskDataNew = new TaskData[1];
+
+ // create Task
+ taskDataNew[0] = TasksUiInternal.createTaskData(abstractBugzillaTest.getRepository(), taskMappingInit,
+ taskMappingSelect, null);
+ ITask taskNew = TasksUiUtil.createOutgoingNewTask(taskDataNew[0].getConnectorKind(),
+ taskDataNew[0].getRepositoryUrl());
+
+ ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(taskNew, taskDataNew[0]);
+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
+ workingCopy.save(changed, null);
+ RepositoryResponse response = BugzillaFixture.current().submitTask(taskDataNew[0],
+ abstractBugzillaTest.getClient());
+ ((AbstractTask) taskNew).setSubmitting(true);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
+ String taskId = response.getTaskId();
+ return taskId;
+ }
+
+ public String taskCfBugIdExists() {
+ String taskID = null;
+ String queryUrlString = abstractBugzillaTest.getRepository().getRepositoryUrl() + "/buglist.cgi?"
+ + "short_desc=test%20CF%20Bug%20ID%20Bug&resolution=---&query_format=advanced"
+ + "&short_desc_type=casesubstring&component=TestComponent&product=TestProduct";
+ RepositoryQuery query = new RepositoryQuery(abstractBugzillaTest.getRepository().getConnectorKind(),
+ "handle-testQueryViaConnector");
+ query.setUrl(queryUrlString);
+ final Map<Integer, TaskData> changedTaskData = new HashMap<Integer, TaskData>();
+ TaskDataCollector collector = new TaskDataCollector() {
+ @Override
+ public void accept(TaskData taskData) {
+ changedTaskData.put(Integer.valueOf(taskData.getTaskId()), taskData);
+ }
+ };
+ abstractBugzillaTest.getConnector().performQuery(abstractBugzillaTest.getRepository(), query, collector, null,
+ new NullProgressMonitor());
+ if (changedTaskData.size() > 0) {
+ Set<Integer> ks = changedTaskData.keySet();
+ SortedSet<Integer> sks = new TreeSet<Integer>(ks);
+ taskID = sks.last().toString();
+ }
+ return taskID;
+ }
+
+ public String createCfBugIdTask() throws Exception {
+ final TaskMapping taskMappingInit = new TaskMapping() {
+
+ @Override
+ public String getProduct() {
+ return "TestProduct";
+ }
+ };
+ final TaskMapping taskMappingSelect = new TaskMapping() {
+ @Override
+ public String getComponent() {
+ return "TestComponent";
+ }
+
+ @Override
+ public String getSummary() {
+ return "test CF Bug ID Bug";
+ }
+
+ @Override
+ public String getDescription() {
+ return "The Description of the CF Bug ID Bug";
+ }
+ };
+ final TaskData[] taskDataNew = new TaskData[1];
+
+ // create Task
+ taskDataNew[0] = TasksUiInternal.createTaskData(abstractBugzillaTest.getRepository(), taskMappingInit,
+ taskMappingSelect, null);
+ ITask taskNew = TasksUiUtil.createOutgoingNewTask(taskDataNew[0].getConnectorKind(),
+ taskDataNew[0].getRepositoryUrl());
+
+ ITaskDataWorkingCopy workingCopy = TasksUi.getTaskDataManager().createWorkingCopy(taskNew, taskDataNew[0]);
+ Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
+ workingCopy.save(changed, null);
+ RepositoryResponse response = BugzillaFixture.current().submitTask(taskDataNew[0],
+ abstractBugzillaTest.getClient());
+ ((AbstractTask) taskNew).setSubmitting(true);
+ assertNotNull(response);
+ assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString());
+ String taskId = response.getTaskId();
+ return taskId;
+ }
+
}

Back to the top