Wikipedia implements WikiConstants { public List<Integer> getPageIdsCaseInsensitive(String title) throws WikiApiException { title = title.toLowerCase(); title = title.replaceAll(" ", "_"); Session session = this.__getHibernateSession(); session.beginTransaction(); Iterator results = session.createQuery( "select p.pageID from PageMapLine as p where lower(p.name) = :pName").setParameter("pName", title, StringType.INSTANCE).list().iterator(); session.getTransaction().commit(); if(!results.hasNext()){ throw new WikiPageNotFoundException(); } List<Integer> resultList = new LinkedList<Integer>(); while(results.hasNext()){ resultList.add((Integer)results.next()); } return resultList; } Wikipedia(DatabaseConfiguration dbConfig); Page getPage(String title); Page getPageByExactTitle(String exactTitle); Set<Page> getPages(String title); Page getPage(int pageId); Title getTitle(int pageId); List<Integer> getPageIds(String title); List<Integer> getPageIdsCaseInsensitive(String title); Page getArticleForDiscussionPage(Page discussionPage); Page getDiscussionPage(int articlePageId); Page getDiscussionPage(String title); Page getDiscussionPage(Page articlePage); Iterable<Page> getDiscussionArchives(int articlePageId); Iterable<Page> getDiscussionArchives(String title); Iterable<Page> getDiscussionArchives(Page articlePage); Category getCategory(String title); Category getCategory(int pageId); Iterable<Category> getCategories(); Set<Category> getCategories(String pageTitle); Iterable<Page> getPages(); Iterable<Integer> getPageIds(); Iterable<Page> getPages(PageQuery query); Iterable<Page> getArticles(); Iterable<Title> getTitles(); Language getLanguage(); boolean existsPage(String title); boolean existsPage(int pageID); MetaData getMetaData(); DatabaseConfiguration getDatabaseConfiguration(); String getWikipediaId();  }
@Test public void testGetPageIdsCaseInsensitive() { try { List<Integer> pageIDs = wiki.getPageIdsCaseInsensitive(A_FAMOUS_PAGE); assertNotNull(pageIDs); assertEquals(1, pageIDs.size()); assertTrue(pageIDs.contains(A_FAMOUS_PAGE_ID)); } catch (WikiApiException e) { logger.error(e.getLocalizedMessage(), e); fail("Encountered WikiApiException: " + e.getLocalizedMessage()); } }
@Test public void testGetPageIdsCaseInsensitiveInvalid() { try { wiki.getPageIdsCaseInsensitive(UUID.randomUUID().toString()); } catch (WikiPageNotFoundException wpnfe) { } catch (WikiApiException wae) { fail("Expected a WikiPageNotFoundException, yet encountered WikiApiException: " + wae.getLocalizedMessage()); } }