Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-04-10 16:24:06 -0400
committerfbecker2010-04-10 16:24:06 -0400
commitc2bfebf8d93832f3c1cc614dd4319f78c5da30ab (patch)
tree5f386953f3f77eeb539f11808d193d33d7e48858 /org.eclipse.mylyn.bugzilla.tests
parenteb74fdefa86061aa0344a02ce44563a05b46aee7 (diff)
downloadorg.eclipse.mylyn.tasks-c2bfebf8d93832f3c1cc614dd4319f78c5da30ab.tar.gz
org.eclipse.mylyn.tasks-c2bfebf8d93832f3c1cc614dd4319f78c5da30ab.tar.xz
org.eclipse.mylyn.tasks-c2bfebf8d93832f3c1cc614dd4319f78c5da30ab.zip
ASSIGNED - bug 282211: create Webservice API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=282211
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java78
1 files changed, 78 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java
new file mode 100644
index 000000000..de699bcf8
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaXMLRPCTest.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Frank Becker 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.tests.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.HashMap;
+
+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.BugzillaRepositoryConnector;
+import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.junit.Before;
+import org.junit.Test;
+
+public class BugzillaXMLRPCTest {
+ private TaskRepository repository;
+
+ private BugzillaRepositoryConnector connector;
+
+ private static String TEST_REPO = "http://macmainz.dyndns.org/Internet/BugzillaDevelop";
+
+
+ public static BugzillaFixture BUGS_3_7 = new BugzillaFixture(TEST_REPO, "3.7", "");
+
+ @Before
+ public void setUp() throws Exception {
+ repository = BugzillaFixture.current(BUGS_3_7).repository();
+ repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"),
+ false);
+ repository.setCredentials(AuthenticationType.HTTP, new AuthenticationCredentials("YYYYYYYY", "XXXXXXXX"), false);
+ connector = BugzillaFixture.current(BUGS_3_7).connector();
+ }
+
+ @Test
+ @SuppressWarnings("unused")
+ public void testxmlrpc() throws Exception {
+ BugzillaXmlRpcClient ws = new BugzillaXmlRpcClient(repository);
+ int user = ws.getUserID();
+ assertEquals(-1, user);
+
+ // Services from Bugzilla::WebService::Bugzilla
+ String version = ws.getVersion();
+ assertEquals("3.7", version);
+ user = ws.getUserID();
+ assertTrue(user != -1);
+ Date dbtime = ws.getDBTime();
+ Date webtime = ws.getWebTime();
+ HashMap<String, Date> time = ws.getTime();
+ // native Response
+ Object[] xx0 = ws.getUserInfoFromIDs(new Integer[] { 1, 2 });
+ Object[] xx1 = ws.getUserInfoFromNames(new String[] { "test@Frank-Becker.de" });
+ Object[] xx2 = ws.getUserInfoWithMatch(new String[] { "tes" });
+ Object[] xx3 = ws.getAllFields();
+ Object[] xx4 = ws.getFieldsWithNames(new String[] { "qa_contact" });
+ Object[] xx5 = ws.getFieldsWithIDs(new Integer[] { 12, 18 });
+ Object[] xx6 = ws.getSelectableProducts();
+ Object[] xx7 = ws.getEnterableProducts();
+ Object[] xx8 = ws.getAccessibleProducts();
+ Object[] xx9 = ws.getProducts(new Integer[] { 1, 3 });
+
+ user++;
+ user--;
+ }
+}

Back to the top