Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 302654 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java (-16 / +18 lines)
Lines 38-47 Link Here
38
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
38
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
39
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
39
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
40
import org.eclipse.mylyn.tasks.core.ITask;
40
import org.eclipse.mylyn.tasks.core.ITask;
41
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
42
import org.eclipse.mylyn.tasks.core.TaskMapping;
43
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
41
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
42
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
44
import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
43
import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
44
import org.eclipse.mylyn.tasks.core.TaskMapping;
45
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
45
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
46
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
46
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
47
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
47
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
Lines 344-351 Link Here
344
//	}
344
//	}
345
//
345
//
346
	public void testStdWorkflow32() throws Exception {
346
	public void testStdWorkflow32() throws Exception {
347
//		init32();
347
		if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_CUSTOM) {
348
		doStdWorkflow("3");
348
			doStdWorkflow("3");
349
		}
349
	}
350
	}
350
351
351
	private void doStdWorkflow(String DupBugID) throws Exception {
352
	private void doStdWorkflow(String DupBugID) throws Exception {
Lines 776-783 Link Here
776
			taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).setValue("" + deadline);
777
			taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).setValue("" + deadline);
777
		}
778
		}
778
779
779
		taskData.getRoot().getAttribute(BugzillaAttribute.NEW_COMMENT.getKey()).setValue(
780
		taskData.getRoot()
780
				"New Estimate: " + estimatedTime + "\nNew Remaining: " + remainingTime + "\nAdd: " + addTime);
781
				.getAttribute(BugzillaAttribute.NEW_COMMENT.getKey())
782
				.setValue("New Estimate: " + estimatedTime + "\nNew Remaining: " + remainingTime + "\nAdd: " + addTime);
781
		Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
783
		Set<TaskAttribute> changed = new HashSet<TaskAttribute>();
782
		changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()));
784
		changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()));
783
		changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()));
785
		changed.add(taskData.getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()));
Lines 793-804 Link Here
793
		model = createModel(task);
795
		model = createModel(task);
794
		taskData = model.getTaskData();
796
		taskData = model.getTaskData();
795
797
796
		assertEquals(estimatedTime, Float.parseFloat(taskData.getRoot().getAttribute(
798
		assertEquals(estimatedTime,
797
				BugzillaAttribute.ESTIMATED_TIME.getKey()).getValue()));
799
				Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey()).getValue()));
798
		assertEquals(remainingTime, Float.parseFloat(taskData.getRoot().getAttribute(
800
		assertEquals(remainingTime,
799
				BugzillaAttribute.REMAINING_TIME.getKey()).getValue()));
801
				Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey()).getValue()));
800
		assertEquals(actualTime + addTime, Float.parseFloat(taskData.getRoot().getAttribute(
802
		assertEquals(actualTime + addTime,
801
				BugzillaAttribute.ACTUAL_TIME.getKey()).getValue()));
803
				Float.parseFloat(taskData.getRoot().getAttribute(BugzillaAttribute.ACTUAL_TIME.getKey()).getValue()));
802
		if (enableDeadline) {
804
		if (enableDeadline) {
803
			assertEquals(deadline, taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).getValue());
805
			assertEquals(deadline, taskData.getRoot().getAttribute(BugzillaAttribute.DEADLINE.getKey()).getValue());
804
		}
806
		}
Lines 892-901 Link Here
892
		event.setTaskRepository(repository);
894
		event.setTaskRepository(repository);
893
		event.setFullSynchronization(true);
895
		event.setFullSynchronization(true);
894
		connector.preSynchronization(event, null);
896
		connector.preSynchronization(event, null);
895
		assertTrue("Expected " + task4.getTaskId() + ", got: " + event.getStaleTasks(), event.getStaleTasks().contains(
897
		assertTrue("Expected " + task4.getTaskId() + ", got: " + event.getStaleTasks(),
896
				task4));
898
				event.getStaleTasks().contains(task4));
897
		assertTrue("Expected " + task5.getTaskId() + ", got: " + event.getStaleTasks(), event.getStaleTasks().contains(
899
		assertTrue("Expected " + task5.getTaskId() + ", got: " + event.getStaleTasks(),
898
				task5));
900
				event.getStaleTasks().contains(task5));
899
901
900
		TasksUiInternal.synchronizeTasks(connector, tasks, true, null);
902
		TasksUiInternal.synchronizeTasks(connector, tasks, true, null);
901
903
(-)src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java (-29 / +24 lines)
Lines 20-26 Link Here
20
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
20
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
21
import org.eclipse.mylyn.commons.net.AuthenticationType;
21
import org.eclipse.mylyn.commons.net.AuthenticationType;
22
import org.eclipse.mylyn.commons.net.WebLocation;
22
import org.eclipse.mylyn.commons.net.WebLocation;
23
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
24
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
23
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
25
24
26
/**
25
/**
Lines 42-85 Link Here
42
41
43
	@SuppressWarnings("unused")
42
	@SuppressWarnings("unused")
44
	public void testxmlrpc() throws Exception {
43
	public void testxmlrpc() throws Exception {
45
		int uID = bugzillaClient.login();
44
		if (BugzillaFixture.current() != BugzillaFixture.BUGS_3_6_NO_XMLRPC) {
46
		String x0 = bugzillaClient.getVersion();
45
			int uID = bugzillaClient.login();
47
		HashMap<?, ?> x1 = bugzillaClient.getTime();
46
			String x0 = bugzillaClient.getVersion();
48
		Date x2 = bugzillaClient.getDBTime();
47
			HashMap<?, ?> x1 = bugzillaClient.getTime();
49
		Date x3 = bugzillaClient.getWebTime();
48
			Date x2 = bugzillaClient.getDBTime();
50
		Object[] xx0 = bugzillaClient.getUserInfoFromIDs(new Integer[] { 1, 2 });
49
			Date x3 = bugzillaClient.getWebTime();
51
		Object[] xx1 = bugzillaClient.getUserInfoFromNames(new String[] { "tests@mylyn.eclipse.org" });
50
			Object[] xx0 = bugzillaClient.getUserInfoFromIDs(new Integer[] { 1, 2 });
52
		Object[] xx2 = bugzillaClient.getUserInfoWithMatch(new String[] { "est" });
51
			Object[] xx1 = bugzillaClient.getUserInfoFromNames(new String[] { "tests@mylyn.eclipse.org" });
53
		Object[] xx3 = bugzillaClient.getAllFields();
52
			Object[] xx2 = bugzillaClient.getUserInfoWithMatch(new String[] { "est" });
54
		Object[] xx4 = bugzillaClient.getFieldsWithNames(new String[] { "qa_contact" });
53
			Object[] xx3 = bugzillaClient.getAllFields();
55
		Object[] xx5 = bugzillaClient.getFieldsWithIDs(new Integer[] { 12, 18 });
54
			Object[] xx4 = bugzillaClient.getFieldsWithNames(new String[] { "qa_contact" });
56
		Object[] xx6 = bugzillaClient.getSelectableProducts();
55
			Object[] xx5 = bugzillaClient.getFieldsWithIDs(new Integer[] { 12, 18 });
57
		Object[] xx7 = bugzillaClient.getEnterableProducts();
56
			Object[] xx6 = bugzillaClient.getSelectableProducts();
58
		Object[] xx8 = bugzillaClient.getAccessibleProducts();
57
			Object[] xx7 = bugzillaClient.getEnterableProducts();
59
		Object[] xx9 = bugzillaClient.getProducts(new Integer[] { 1, 3 });
58
			Object[] xx8 = bugzillaClient.getAccessibleProducts();
60
		int i = 9;
59
			Object[] xx9 = bugzillaClient.getProducts(new Integer[] { 1, 3 });
61
		i++;
60
		}
62
	}
61
	}
63
62
64
	@SuppressWarnings("unused")
63
	@SuppressWarnings("unused")
65
	public void testxmlrpcInstalled() throws Exception {
64
	public void testxmlrpcInstalled() throws Exception {
66
		int uID = bugzillaClient.login();
65
		int uID = -1;
67
		assertEquals(2, uID);
66
		BugzillaFixture a = BugzillaFixture.current();
68
		BugzillaFixture.current().getBugzillaVersion();
67
		if (BugzillaFixture.current() == BugzillaFixture.BUGS_3_6_NO_XMLRPC) {
69
		if (BugzillaFixture.current().getBugzillaVersion().compareTo(BugzillaVersion.BUGZILLA_3_6) == 0) {
70
			uID = -1;
71
			WebLocation webLocation = new WebLocation(BugzillaFixture.current().getRepositoryUrl()
72
					+ "noxmlrpc/xmlrpc.cgi");
73
			webLocation.setCredentials(AuthenticationType.REPOSITORY, "tests@mylyn.eclipse.org", "mylyntest");
74
			BugzillaXmlRpcClient bugzillaClientNoXMLRPC = new BugzillaXmlRpcClient(webLocation);
75
			bugzillaClientNoXMLRPC.setContentTypeCheckingEnabled(true);
76
			try {
68
			try {
77
				uID = bugzillaClientNoXMLRPC.login();
69
				uID = bugzillaClient.login();
78
				fail("Never reach this! We should get an XmlRpcException");
70
				fail("Never reach this! We should get an XmlRpcException");
79
			} catch (XmlRpcException e) {
71
			} catch (XmlRpcException e) {
80
				assertEquals("The server returned an unexpected content type: 'text/html; charset=UTF-8'",
72
				assertEquals("The server returned an unexpected content type: 'text/html; charset=UTF-8'",
81
						e.getMessage());
73
						e.getMessage());
82
			}
74
			}
75
		} else {
76
			uID = bugzillaClient.login();
77
			assertEquals(2, uID);
83
		}
78
		}
84
	}
79
	}
85
80
(-)src/org/eclipse/mylyn/bugzilla/tests/support/BugzillaFixture.java (-1 / +11 lines)
Lines 68-73 Link Here
68
68
69
	public static final String TEST_BUGZILLA_36_URL = getServerUrl("bugs36");
69
	public static final String TEST_BUGZILLA_36_URL = getServerUrl("bugs36");
70
70
71
	public static final String TEST_BUGZILLA_36_CUSTOM_URL = getServerUrl("bugs36customWF");
72
73
	public static final String TEST_BUGZILLA_36_NO_XMLRPC = getServerUrl("bugs36noxmlrpc");
74
71
	public static final String TEST_BUGZILLA_HEAD_URL = getServerUrl("bugshead");
75
	public static final String TEST_BUGZILLA_HEAD_URL = getServerUrl("bugshead");
72
76
73
	public static final String TEST_BUGZILLA_LATEST_URL = TEST_BUGZILLA_36_URL;
77
	public static final String TEST_BUGZILLA_LATEST_URL = TEST_BUGZILLA_36_URL;
Lines 97-109 Link Here
97
	public static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
101
	public static BugzillaFixture BUGS_3_6 = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_URL, //
98
			"3.6", "");
102
			"3.6", "");
99
103
104
	public static BugzillaFixture BUGS_3_6_CUSTOM = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_CUSTOM_URL, //
105
			"3.6", "CUSTOM-WF");
106
107
	public static BugzillaFixture BUGS_3_6_NO_XMLRPC = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_36_NO_XMLRPC, //
108
			"3.6", "NO-XMLRPC");
109
100
	public static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
110
	public static BugzillaFixture BUGS_HEAD = new BugzillaFixture(BugzillaFixture.TEST_BUGZILLA_HEAD_URL, //
101
			"3.7", "");
111
			"3.7", "");
102
112
103
	public static BugzillaFixture DEFAULT = BUGS_3_6;
113
	public static BugzillaFixture DEFAULT = BUGS_3_6;
104
114
105
	public static final BugzillaFixture[] ALL = new BugzillaFixture[] { BUGS_2_22, BUGS_3_0, BUGS_3_2, BUGS_3_4,
115
	public static final BugzillaFixture[] ALL = new BugzillaFixture[] { BUGS_2_22, BUGS_3_0, BUGS_3_2, BUGS_3_4,
106
			BUGS_3_6, BUGS_HEAD };
116
			BUGS_3_6, BUGS_3_6_CUSTOM, BUGS_3_6_NO_XMLRPC, BUGS_HEAD };
107
117
108
	private final String version;
118
	private final String version;
109
119

Return to bug 302654