Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2010-01-28 16:48:34 -0500
committerrelves2010-01-28 16:48:34 -0500
commitc359f0e36bc69f6cfc3e0091f6c90aba54ed4516 (patch)
tree7be8f323b94a8fdf824615d3d29097811af0d288 /org.eclipse.mylyn.bugzilla.tests
parent2dcfade0b7b30d7cdd74b63c66485584f7f9386f (diff)
downloadorg.eclipse.mylyn.tasks-c359f0e36bc69f6cfc3e0091f6c90aba54ed4516.tar.gz
org.eclipse.mylyn.tasks-c359f0e36bc69f6cfc3e0091f6c90aba54ed4516.tar.xz
org.eclipse.mylyn.tasks-c359f0e36bc69f6cfc3e0091f6c90aba54ed4516.zip
REOPENED - bug 290465: fix Bugzilla test suite
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290465
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java77
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java15
2 files changed, 5 insertions, 87 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
index 34a339df3..9b6d7abdf 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AbstractBugzillaTest.java
@@ -16,10 +16,7 @@ import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
-import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
-import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
@@ -28,7 +25,6 @@ import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
@@ -37,8 +33,6 @@ import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tests.util.TestFixture;
-import org.eclipse.mylyn.tests.util.TestUtil;
-import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
/**
* @author Mik Kersten
@@ -83,76 +77,6 @@ public abstract class AbstractBugzillaTest extends TestCase {
manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
}
- protected void init34() {
- init(BugzillaTestConstants.TEST_BUGZILLA_34_URL);
- }
-
- protected void init323() {
- init(BugzillaTestConstants.TEST_BUGZILLA_323_URL);
- }
-
- protected void init322() {
- init(BugzillaTestConstants.TEST_BUGZILLA_322_URL);
- }
-
- protected void init32() {
- init(BugzillaTestConstants.TEST_BUGZILLA_32_URL);
- }
-
- protected void init30() {
- init(BugzillaTestConstants.TEST_BUGZILLA_30_URL);
- }
-
- protected void init222() {
- init(BugzillaTestConstants.TEST_BUGZILLA_222_URL);
- }
-
- protected void init2201() {
- init(BugzillaTestConstants.TEST_BUGZILLA_2201_URL);
- }
-
- protected void init220() {
- init(BugzillaTestConstants.TEST_BUGZILLA_220_URL);
- }
-
- protected void init218() {
- init(BugzillaTestConstants.TEST_BUGZILLA_218_URL);
- }
-
- @SuppressWarnings("deprecation")
- protected void init(String url) {
- repository = new TaskRepository(DEFAULT_KIND, url);
- Credentials credentials = TestUtil.readCredentials();
- repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
- credentials.password), false);
-
- repository.setTimeZoneId("Canada/Eastern");
- assertNotNull(manager);
- manager.addRepository(repository);
-
- taskList = TasksUiPlugin.getTaskList();
-
- AbstractRepositoryConnector abstractRepositoryClient = manager.getRepositoryConnector(DEFAULT_KIND);
-
- assertEquals(abstractRepositoryClient.getConnectorKind(), DEFAULT_KIND);
-
- connector = (BugzillaRepositoryConnector) abstractRepositoryClient;
- try {
- connector.getRepositoryConfiguration(repository, false, new NullProgressMonitor());
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- }
-
-// protected ITask generateLocalTaskAndDownload(String taskNumber) throws CoreException {
-// ITask task = TasksUi.getRepositoryModel().createTask(repository, taskNumber);
-// // FIXME task.setStale(true);
-// TasksUiPlugin.getTaskList().addTask(task);
-// TasksUiInternal.synchronizeTask(connector, task, true, null);
-// TasksUiPlugin.getTaskDataManager().setTaskRead(task, true);
-// return task;
-// }
-
protected TaskDataModel createModel(ITask task) throws CoreException {
ITaskDataWorkingCopy taskDataState = getWorkingCopy(task);
return new TaskDataModel(repository, task, taskDataState);
@@ -182,7 +106,6 @@ public abstract class AbstractBugzillaTest extends TestCase {
}
public ITask generateLocalTaskAndDownload(String id) throws CoreException {
- TasksUi.getRepositoryManager().addRepository(repository);
ITask task = TasksUi.getRepositoryModel().createTask(repository, id);
TasksUiPlugin.getTaskList().addTask(task);
TasksUiInternal.synchronizeTask(connector, task, true, null);
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 40f7623ff..3b8ad3b67 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
@@ -38,7 +38,6 @@ import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
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.ui.TasksUi;
import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
@@ -441,12 +440,8 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
* Ensure obsoletes and patches are marked as such by the parser.
*/
public void testAttachmentAttributes() throws Exception {
- init222();
String taskNumber = "19";
- ITask task = generateLocalTaskAndDownload(taskNumber);
- assertNotNull(task);
- TaskDataModel model = createModel(task);
- TaskData taskData = model.getTaskData();
+ TaskData taskData = BugzillaFixture.current().getTask(taskNumber, client);
assertNotNull(taskData);
boolean isPatch[] = { false, true, false, false, false, false, false, true, false, false, false };
@@ -455,15 +450,15 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
int index = 0;
for (TaskAttribute attribute : taskData.getAttributeMapper().getAttributesByType(taskData,
TaskAttribute.TYPE_ATTACHMENT)) {
- assertTrue(validateAttachmentAttributes(model, attribute, isPatch[index], isObsolete[index]));
+ assertTrue(validateAttachmentAttributes(taskData, attribute, isPatch[index], isObsolete[index]));
index++;
}
}
- private boolean validateAttachmentAttributes(TaskDataModel model, TaskAttribute taskAttribute, boolean isPatch,
+ private boolean validateAttachmentAttributes(TaskData data, TaskAttribute taskAttribute, boolean isPatch,
boolean isObsolete) {
- TaskAttachment taskAttachment = new TaskAttachment(model.getTaskRepository(), model.getTask(), taskAttribute);
- model.getTaskData().getAttributeMapper().updateTaskAttachment(taskAttachment, taskAttribute);
+ TaskAttachment taskAttachment = new TaskAttachment(BugzillaFixture.current().repository(), null, taskAttribute);
+ data.getAttributeMapper().updateTaskAttachment(taskAttachment, taskAttribute);
return (taskAttachment.isPatch() == isPatch) && (taskAttachment.isDeprecated() == isObsolete);
}

Back to the top