diff options
Diffstat (limited to 'org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java')
-rw-r--r-- | org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java | 281 |
1 files changed, 139 insertions, 142 deletions
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java index c637e3b19..6807276a4 100644 --- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java +++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java @@ -12,7 +12,6 @@ package org.eclipse.mylyn.trac.tests.client; -import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Date; @@ -27,12 +26,10 @@ import org.eclipse.mylyn.internal.trac.core.client.TracPermissionDeniedException import org.eclipse.mylyn.internal.trac.core.client.TracRemoteException; import org.eclipse.mylyn.internal.trac.core.client.TracXmlRpcClient; import org.eclipse.mylyn.internal.trac.core.model.TracAction; -import org.eclipse.mylyn.internal.trac.core.model.TracSearch; import org.eclipse.mylyn.internal.trac.core.model.TracTicket; import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key; import org.eclipse.mylyn.internal.trac.core.model.TracTicketField; import org.eclipse.mylyn.internal.trac.core.model.TracVersion; -import org.eclipse.mylyn.internal.trac.core.model.TracWikiPage; import org.eclipse.mylyn.internal.trac.core.model.TracWikiPageInfo; import org.eclipse.mylyn.trac.tests.support.TracFixture; import org.eclipse.mylyn.trac.tests.support.TracTestConstants; @@ -62,7 +59,7 @@ public class TracXmlRpcClientTest extends TestCase { } public void testValidateFailNoAuth() throws Exception { - client = TracFixture.current().connect(TracTestConstants.TEST_TRAC_010_URL, "", ""); + client = TracFixture.current().connect(TracTestConstants.TEST_TRAC_012_URL, "", ""); try { client.validate(new NullProgressMonitor()); fail("Expected TracPermissiongDeniedException"); @@ -104,20 +101,20 @@ public class TracXmlRpcClientTest extends TestCase { assertEquals(new Date(0), versions[1].getTime()); } - public void testSearchValidateTicket() throws Exception { - TracSearch search = new TracSearch(); - search.addFilter("summary", "summary1"); - List<TracTicket> result = new ArrayList<TracTicket>(); - client.search(search, result, null); - assertEquals(1, result.size()); - TracTestUtil.assertTicketEquals(tickets.get(0), result.get(0)); - assertEquals("component1", result.get(0).getValue(Key.COMPONENT)); - assertEquals("description1", result.get(0).getValue(Key.DESCRIPTION)); - assertEquals("milestone1", result.get(0).getValue(Key.MILESTONE)); - assertEquals("anonymous", result.get(0).getValue(Key.REPORTER)); - assertEquals("summary1", result.get(0).getValue(Key.SUMMARY)); - // assertEquals("", result.get(0).getValue(Key.VERSION)); - } +// public void testSearchValidateTicket() throws Exception { +// TracSearch search = new TracSearch(); +// search.addFilter("summary", "summary1"); +// List<TracTicket> result = new ArrayList<TracTicket>(); +// client.search(search, result, null); +// assertEquals(1, result.size()); +// TracTestUtil.assertTicketEquals(tickets.get(0), result.get(0)); +// assertEquals("component1", result.get(0).getValue(Key.COMPONENT)); +// assertEquals("description1", result.get(0).getValue(Key.DESCRIPTION)); +// assertEquals("milestone1", result.get(0).getValue(Key.MILESTONE)); +// assertEquals("anonymous", result.get(0).getValue(Key.REPORTER)); +// assertEquals("summary1", result.get(0).getValue(Key.SUMMARY)); +// // assertEquals("", result.get(0).getValue(Key.VERSION)); +// } public void testGetTicketActions() throws Exception { if (client.getUrl().equals(TracTestConstants.TEST_TRAC_010_URL)) { @@ -163,12 +160,12 @@ public class TracXmlRpcClientTest extends TestCase { assertNull(fields.get(0).getOptions()); assertEquals("accept", actions[3].getId()); - ticket = client.getTicket(tickets.get(1).getId(), null); - actions = ticket.getActions(); - assertNotNull(actions); - assertEquals(2, actions.length); - assertEquals("leave", actions[0].getId()); - assertEquals("reopen", actions[1].getId()); +// ticket = client.getTicket(tickets.get(1).getId(), null); +// actions = ticket.getActions(); +// assertNotNull(actions); +// assertEquals(2, actions.length); +// assertEquals("leave", actions[0].getId()); +// assertEquals("reopen", actions[1].getId()); } } @@ -210,124 +207,124 @@ public class TracXmlRpcClientTest extends TestCase { assertTrue(all.contains("Test")); } - public void testGetWikiPage() throws Exception { - TracWikiPage page = ((TracXmlRpcClient) client).getWikiPage("TestGetPage", null); - assertEquals("TestGetPage", page.getPageInfo().getPageName()); - assertEquals("tests@mylyn.eclipse.org", page.getPageInfo().getAuthor()); - assertEquals(2, page.getPageInfo().getVersion()); - // XXX The Date returned from Wiki API seems to have a problem with the Time Zone - //String date = "Sat Nov 11 18:10:56 EST 2006"; - //assertEquals(date, page.getPageVersion().getLastModified().toString()); - assertEquals("Version 2", page.getContent()); - assertTrue(page.getPageHTML().startsWith("<html>")); - - page = ((TracXmlRpcClient) client).getWikiPage("TestGetPage", 1, null); - assertEquals("TestGetPage", page.getPageInfo().getPageName()); - assertEquals("anonymous", page.getPageInfo().getAuthor()); - assertEquals(1, page.getPageInfo().getVersion()); - assertEquals("Version 1", page.getContent()); - assertTrue(page.getPageHTML().startsWith("<html>")); - } - - public void testGetWikiPageInvalid() throws Exception { - // get info -- non-existing version - try { - ((TracXmlRpcClient) client).getWikiPageInfo("Test", 10, null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get info -- non-existing page name - try { - ((TracXmlRpcClient) client).getWikiPageInfo("NoSuchPage", null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get info -- null parameter - try { - ((TracXmlRpcClient) client).getWikiPageInfo(null, null); - fail("Expected RuntimeException"); - } catch (IllegalArgumentException e) { - } - - // get content -- non-existing version - try { - ((TracXmlRpcClient) client).getWikiPageContent("Test", 10, null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get content -- non-existing page name - try { - ((TracXmlRpcClient) client).getWikiPageContent("NoSuchPage", null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get content -- null parameter - try { - ((TracXmlRpcClient) client).getWikiPageContent(null, null); - fail("Expected RuntimeException"); - } catch (IllegalArgumentException e) { - } - - // get HTML -- non-existing version - try { - ((TracXmlRpcClient) client).getWikiPageHtml("Test", 10, null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get HTML -- non-existing page name - try { - ((TracXmlRpcClient) client).getWikiPageHtml("NoSuchPage", null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get HTML -- null parameter - try { - ((TracXmlRpcClient) client).getWikiPageHtml(null, null); - fail("Expected RuntimeException"); - } catch (IllegalArgumentException e) { - } - - // get a page -- non-existing version - try { - ((TracXmlRpcClient) client).getWikiPage("Test", 10, null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get a page -- non-existing page name - try { - ((TracXmlRpcClient) client).getWikiPage("NoSuchPage", null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get a page -- null parameter - try { - ((TracXmlRpcClient) client).getWikiPage(null, null); - fail("Expected RuntimeException"); - } catch (IllegalArgumentException e) { - } - - // get all versions of a page -- non-existing page name - try { - ((TracXmlRpcClient) client).getWikiPageInfoAllVersions("NoSuchPage", null); - fail("Expected TracRemoteException"); - } catch (TracRemoteException e) { - } - - // get all versions of a page -- null parameter - try { - ((TracXmlRpcClient) client).getWikiPageInfoAllVersions(null, null); - fail("Expected RuntimeException"); - } catch (IllegalArgumentException e) { - } - } +// public void testGetWikiPage() throws Exception { +// TracWikiPage page = ((TracXmlRpcClient) client).getWikiPage("TestGetPage", null); +// assertEquals("TestGetPage", page.getPageInfo().getPageName()); +// assertEquals("tests@mylyn.eclipse.org", page.getPageInfo().getAuthor()); +// assertEquals(2, page.getPageInfo().getVersion()); +// // XXX The Date returned from Wiki API seems to have a problem with the Time Zone +// //String date = "Sat Nov 11 18:10:56 EST 2006"; +// //assertEquals(date, page.getPageVersion().getLastModified().toString()); +// assertEquals("Version 2", page.getContent()); +// assertTrue(page.getPageHTML().startsWith("<html>")); +// +// page = ((TracXmlRpcClient) client).getWikiPage("TestGetPage", 1, null); +// assertEquals("TestGetPage", page.getPageInfo().getPageName()); +// assertEquals("anonymous", page.getPageInfo().getAuthor()); +// assertEquals(1, page.getPageInfo().getVersion()); +// assertEquals("Version 1", page.getContent()); +// assertTrue(page.getPageHTML().startsWith("<html>")); +// } + +// public void testGetWikiPageInvalid() throws Exception { +// // get info -- non-existing version +// try { +// ((TracXmlRpcClient) client).getWikiPageInfo("Test", 10, null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get info -- non-existing page name +// try { +// ((TracXmlRpcClient) client).getWikiPageInfo("NoSuchPage", null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get info -- null parameter +// try { +// ((TracXmlRpcClient) client).getWikiPageInfo(null, null); +// fail("Expected RuntimeException"); +// } catch (IllegalArgumentException e) { +// } +// +// // get content -- non-existing version +// try { +// ((TracXmlRpcClient) client).getWikiPageContent("Test", 10, null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get content -- non-existing page name +// try { +// ((TracXmlRpcClient) client).getWikiPageContent("NoSuchPage", null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get content -- null parameter +// try { +// ((TracXmlRpcClient) client).getWikiPageContent(null, null); +// fail("Expected RuntimeException"); +// } catch (IllegalArgumentException e) { +// } +// +// // get HTML -- non-existing version +// try { +// ((TracXmlRpcClient) client).getWikiPageHtml("Test", 10, null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get HTML -- non-existing page name +// try { +// ((TracXmlRpcClient) client).getWikiPageHtml("NoSuchPage", null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get HTML -- null parameter +// try { +// ((TracXmlRpcClient) client).getWikiPageHtml(null, null); +// fail("Expected RuntimeException"); +// } catch (IllegalArgumentException e) { +// } +// +// // get a page -- non-existing version +// try { +// ((TracXmlRpcClient) client).getWikiPage("Test", 10, null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get a page -- non-existing page name +// try { +// ((TracXmlRpcClient) client).getWikiPage("NoSuchPage", null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get a page -- null parameter +// try { +// ((TracXmlRpcClient) client).getWikiPage(null, null); +// fail("Expected RuntimeException"); +// } catch (IllegalArgumentException e) { +// } +// +// // get all versions of a page -- non-existing page name +// try { +// ((TracXmlRpcClient) client).getWikiPageInfoAllVersions("NoSuchPage", null); +// fail("Expected TracRemoteException"); +// } catch (TracRemoteException e) { +// } +// +// // get all versions of a page -- null parameter +// try { +// ((TracXmlRpcClient) client).getWikiPageInfoAllVersions(null, null); +// fail("Expected RuntimeException"); +// } catch (IllegalArgumentException e) { +// } +// } public void testGetWikiPageInfoAllVersions() throws Exception { String pageName = "Test"; |