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/core/BugzillaXMLRPCTest.java (-7 / +25 lines)
Lines 16-24 Link Here
16
16
17
import junit.framework.TestCase;
17
import junit.framework.TestCase;
18
18
19
import org.apache.xmlrpc.XmlRpcException;
19
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
20
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
20
import org.eclipse.mylyn.commons.net.AuthenticationType;
21
import org.eclipse.mylyn.commons.net.AuthenticationType;
21
import org.eclipse.mylyn.commons.net.WebLocation;
22
import org.eclipse.mylyn.commons.net.WebLocation;
23
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
22
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
24
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
23
25
24
/**
26
/**
Lines 30-44 Link Here
30
public class BugzillaXMLRPCTest extends TestCase {
32
public class BugzillaXMLRPCTest extends TestCase {
31
	private BugzillaXmlRpcClient bugzillaClient;
33
	private BugzillaXmlRpcClient bugzillaClient;
32
34
33
//	private static String TEST_REPO = "http://.../Bugzilla36noRPC";
34
//	private static String TEST_REPO = "http://mylyn.eclipse.org/bugs36";
35
36
	@Override
35
	@Override
37
	public void setUp() throws Exception {
36
	public void setUp() throws Exception {
38
//		webLocation.setCredentials(AuthenticationType.REPOSITORY, "user", "password");
39
//		webLocation.setCredentials(AuthenticationType.HTTP, "user", "password");
40
//		WebLocation webLocation = new WebLocation(BugzillaTestConstants.TEST_BUGZILLA_HEAD_URL + "/xmlrpc.cgi");
41
42
		WebLocation webLocation = new WebLocation(BugzillaFixture.current().getRepositoryUrl() + "/xmlrpc.cgi");
37
		WebLocation webLocation = new WebLocation(BugzillaFixture.current().getRepositoryUrl() + "/xmlrpc.cgi");
43
		webLocation.setCredentials(AuthenticationType.REPOSITORY, "tests@mylyn.eclipse.org", "mylyntest");
38
		webLocation.setCredentials(AuthenticationType.REPOSITORY, "tests@mylyn.eclipse.org", "mylyntest");
44
		bugzillaClient = new BugzillaXmlRpcClient(webLocation);
39
		bugzillaClient = new BugzillaXmlRpcClient(webLocation);
Lines 65-68 Link Here
65
		int i = 9;
60
		int i = 9;
66
		i++;
61
		i++;
67
	}
62
	}
63
64
	@SuppressWarnings("unused")
65
	public void testxmlrpcInstalled() throws Exception {
66
		int uID = bugzillaClient.login();
67
		assertEquals(2, uID);
68
		BugzillaFixture.current().getBugzillaVersion();
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 {
77
				uID = bugzillaClientNoXMLRPC.login();
78
				fail("Never reach this! We should get an XmlRpcException");
79
			} catch (XmlRpcException e) {
80
				assertEquals("The server returned an unexpected content type: 'text/html; charset=UTF-8'",
81
						e.getMessage());
82
			}
83
		}
84
	}
85
68
}
86
}

Return to bug 302654