diff options
author | Frank Becker | 2014-11-22 09:32:04 +0000 |
---|---|---|
committer | Frank Becker | 2014-11-27 18:53:59 +0000 |
commit | f342436e4adb9a34a62247fabca4a629c83ce6b0 (patch) | |
tree | d4fe228c7ee289a5ff44288fa46ea2b94ca3bb23 /org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn | |
parent | 098f65b7d49ae7a6c413c8706d5fd2777ae8e857 (diff) | |
download | org.eclipse.mylyn.tasks-f342436e4adb9a34a62247fabca4a629c83ce6b0.tar.gz org.eclipse.mylyn.tasks-f342436e4adb9a34a62247fabca4a629c83ce6b0.tar.xz org.eclipse.mylyn.tasks-f342436e4adb9a34a62247fabca4a629c83ce6b0.zip |
448429: end support for Bugzilla 3
Change-Id: I7ec71b76c9de4d685b9929105754fbe98025ca01
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=448429
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn')
3 files changed, 28 insertions, 381 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java index 1f26f87c6..4c3102292 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java @@ -85,11 +85,6 @@ public class AllBugzillaTests { fixture.add(BugzillaRepositoryConnectorTest.class); fixture.add(BugzillaAttachmentHandlerTest.class); - // Only run this if we have custom status and Workflow - if (fixture.isCustomWorkflowAndStatus()) { - fixture.add(BugzillaCustomRepositoryTest.class); - } - fixture.done(); } 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 deleted file mode 100644 index 52e02d8bf..000000000 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaCustomRepositoryTest.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat Inc. 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: - * Red Hat Inc. - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.bugzilla.tests; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; -import org.eclipse.mylyn.internal.bugzilla.core.Messages; -import org.eclipse.mylyn.internal.tasks.core.AbstractTask; -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.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.TaskData; -import org.eclipse.mylyn.tasks.core.data.TaskDataModel; -import org.eclipse.mylyn.tasks.core.data.TaskOperation; -import org.eclipse.mylyn.tasks.ui.TasksUi; -import org.eclipse.mylyn.tasks.ui.TasksUiUtil; - -/** - * @author Charley Wang - */ -public class BugzillaCustomRepositoryTest extends AbstractBugzillaTest { - - public void testWorkflow() throws Exception { - String taskId = harness.taskCfBugIdExists(); - if (taskId == null) { - taskId = harness.createCfBugIdTask(); - } - doCustomWorkflow(taskId); - } - - private void doCustomWorkflow(String DupBugID) 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 the custom workflow"; - } - - @Override - public String getDescription() { - return "The Description of the custom workflow task"; - } - - }; - - final TaskData[] taskDataNew = new TaskData[1]; - // create Task - taskDataNew[0] = TasksUiInternal.createTaskData(repository, 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], client); - ((AbstractTask) taskNew).setSubmitting(true); - - assertNotNull(response); - assertEquals(ResponseKind.TASK_CREATED.toString(), response.getReposonseKind().toString()); - String taskId = response.getTaskId(); - - // change Status from NEW -> ASSIGNED - ITask task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - TaskDataModel model = createModel(task); - TaskData taskData = model.getTaskData(); - assertNotNull(taskData); - TaskAttribute statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("NEW", statusAttribute.getValue()); - TaskAttribute selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "accept", Messages.BugzillaOperation_Accept_to_ASSIGNED); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); -// response = submit(taskNew, taskData, changed); -// assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 1: Change workflow for standard statuses - // change Status from ASSIGNED -> NEW should not work and should not throw an error - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("ASSIGNED", statusAttribute.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "markNew", Messages.BugzillaOperation_Mark_as_NEW); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 3: Special Bugzilla information (duplicateStatus) - // change Status from ASSIGNED -> DUPLICATE - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("ASSIGNED", statusAttribute.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "duplicate", Messages.BugzillaOperation_Duplicate_of); - TaskAttribute duplicateAttribute = taskData.getRoot().getAttribute("dup_id"); - duplicateAttribute.setValue(DupBugID); - model.attributeChanged(selectedOperationAttribute); - model.attributeChanged(duplicateAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - changed.add(duplicateAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 3: Special Bugzilla information (duplicateStatus) - // change Status from [CLOSED] DUPLICATE -> VERIFIED - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("CLOSED", statusAttribute.getValue()); - TaskAttribute resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION); - assertEquals("DUPLICATE", resolution.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "verify", Messages.BugzillaOperation_Mark_as_VERIFIED); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 2: Custom name, open bug_status - // change Status from VERIFIED -> MODIFIED - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("VERIFIED", statusAttribute.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "MODIFIED", Messages.BugzillaOperation_Reopen_bug); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 2: Custom name, open bug_status - // change Status from MODIFIED -> ON_DEV - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("MODIFIED", statusAttribute.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "ON_DEV", Messages.BugzillaOperation_Reopen_bug); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 2: Custom name, closed bug_status - // change Status from ON_DEV -> POST FIXED - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("ON_DEV", statusAttribute.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "POST", Messages.BugzillaOperation_Resolve_as); - resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION); - resolution.setValue("FIXED"); - model.attributeChanged(selectedOperationAttribute); - model.attributeChanged(resolution); - changed.clear(); - changed.add(selectedOperationAttribute); - changed.add(resolution); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 2: Custom name, closing bug - // change Status from POST FIXED -> CLOSED FIXED - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("POST", statusAttribute.getValue()); - resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION); - assertEquals("FIXED", resolution.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "close", Messages.BugzillaOperation_Resolve_as); - resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION); - resolution.setValue("FIXED"); - model.attributeChanged(selectedOperationAttribute); - model.attributeChanged(resolution); - changed.clear(); - changed.add(selectedOperationAttribute); - changed.add(resolution); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // Customization case 1: Change workflow for standard statuses - // change Status from CLOSE -> REOPENED should not work - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - assertEquals("CLOSED", statusAttribute.getValue()); - resolution = taskData.getRoot().getMappedAttribute(TaskAttribute.RESOLUTION); - assertEquals("FIXED", resolution.getValue()); - selectedOperationAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION); - TaskOperation.applyTo(selectedOperationAttribute, "reopen", Messages.BugzillaOperation_Reopen_bug); - model.attributeChanged(selectedOperationAttribute); - changed.clear(); - changed.add(selectedOperationAttribute); - workingCopy.save(changed, null); - response = BugzillaFixture.current().submitTask(taskData, client); - assertNotNull(response); - assertEquals(ResponseKind.TASK_UPDATED.toString(), response.getReposonseKind().toString()); - - // test last state has not changed - task = generateLocalTaskAndDownload(taskId); - assertNotNull(task); - model = createModel(task); - taskData = model.getTaskData(); - assertNotNull(taskData); - statusAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.STATUS); - 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/core/BugzillaXmlRpcClientTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXmlRpcClientTest.java index f67d02d69..213858a76 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 @@ -147,15 +147,13 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { put("RESOLVED", new ArrayList<String>() { { add("verify"); - add("reopen"); + add("unconfirmed"); add("CONFIRMED"); } }); put("VERIFIED", new ArrayList<String>() { { - add("reopen"); - add("resolve"); - add("duplicate"); + add("unconfirmed"); add("CONFIRMED"); } }); @@ -163,140 +161,99 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { }); put(BugzillaFixture.CUSTOM_WF, new HashMap<String, ArrayList<String>>() { { - put("NEW", new ArrayList<String>() { - { - add("resolve"); - add("accept"); - add("duplicate"); - add("close"); - } - }); put("UNCONFIRMED", new ArrayList<String>() { { add("resolve"); - add("accept"); + add("CONFIRMED"); + add("IN_PROGRESS"); add("duplicate"); - add("markNew"); } }); - put("ASSIGNED", new ArrayList<String>() { + put("CONFIRMED", new ArrayList<String>() { { add("resolve"); + add("verify"); + add("IN_PROGRESS"); add("duplicate"); - add("markNew"); } }); - put("REOPENED", new ArrayList<String>() { + put("IN_PROGRESS", new ArrayList<String>() { { + add("unconfirmed"); add("resolve"); - add("accept"); add("duplicate"); - add("markNew"); - add("reopen"); - add("close"); - add("verify"); } }); put("RESOLVED", new ArrayList<String>() { { + add("unconfirmed"); + add("CONFIRMED"); add("verify"); - add("reopen"); - add("close"); } }); put("VERIFIED", new ArrayList<String>() { { - add("reopen"); - add("resolve"); - add("duplicate"); - add("close"); - } - }); - put("CLOSED", new ArrayList<String>() { - { - add("reopen"); + add("unconfirmed"); + add("CONFIRMED"); add("resolve"); - add("duplicate"); } }); } }); put(BugzillaFixture.CUSTOM_WF_AND_STATUS, new HashMap<String, ArrayList<String>>() { { - put("NEW", new ArrayList<String>() { - { - add("resolve"); - add("accept"); - add("duplicate"); - add("close"); - add("reopen"); - } - }); put("UNCONFIRMED", new ArrayList<String>() { { add("resolve"); - add("accept"); + add("CONFIRMED"); + add("IN_PROGRESS"); add("duplicate"); - add("markNew"); - add("close"); + add("verify"); } }); - put("ASSIGNED", new ArrayList<String>() { + put("CONFIRMED", new ArrayList<String>() { { add("resolve"); + add("verify"); + add("IN_PROGRESS"); add("duplicate"); - add("markNew"); - add("close"); } }); - put("REOPENED", new ArrayList<String>() { + put("IN_PROGRESS", new ArrayList<String>() { { + add("CONFIRMED"); add("resolve"); - add("accept"); add("duplicate"); - add("markNew"); - add("reopen"); - add("close"); + add("verify"); } }); put("RESOLVED", new ArrayList<String>() { { + add("unconfirmed"); + add("CONFIRMED"); add("verify"); - add("reopen"); - add("close"); } }); put("VERIFIED", new ArrayList<String>() { { - add("reopen"); - add("resolve"); - add("duplicate"); - add("close"); add("MODIFIED"); - } - }); - put("CLOSED", new ArrayList<String>() { - { - add("reopen"); - add("resolve"); - add("duplicate"); - add("verify"); + add("CONFIRMED"); } }); put("ON_DEV", new ArrayList<String>() { { - add("close"); + add("verify"); add("POST"); } }); put("POST", new ArrayList<String>() { { - add("close"); + add("verify"); } }); put("MODIFIED", new ArrayList<String>() { { - add("close"); + add("verify"); add("ON_DEV"); } }); @@ -339,21 +296,6 @@ public class BugzillaXmlRpcClientTest extends AbstractBugzillaTest { } } -// @SuppressWarnings("unused") -// only for local development work -// public void testXmlRpc() throws Exception { -// if (!BugzillaFixture.current().getDescription().equals(BugzillaFixture.XML_RPC_DISABLED)) { -// IProgressMonitor monitor = new NullProgressMonitor(); -// HashMap<?, ?> x1 = bugzillaClient.getTime(monitor); -// Date x2 = bugzillaClient.getDBTime(monitor); -// Date x3 = bugzillaClient.getWebTime(monitor); -// if (BugzillaVersion.BUGZILLA_3_4.compareTo(BugzillaFixture.current().getBugzillaVersion()) == 0) { -// Object[] xx3 = bugzillaClient.getAllFields(monitor); -// Object[] xx4 = bugzillaClient.getFieldsWithNames(monitor, new String[] { "qa_contact" }); -// Object[] xx5 = bugzillaClient.getFieldsWithIDs(monitor, new Integer[] { 12, 18 }); -// } -// } -// } public void testGetVersion() throws Exception { if (!BugzillaFixture.current().isXmlRpcEnabled()) { return; |