Giter Club home page Giter Club logo

mediawiki-japi's Introduction

Mediawiki-Japi

Java library to call Mediawiki API described at http://www.mediawiki.org/wiki/API:Main_page

Travis (.org) Maven Central codecov GitHub issues GitHub issues GitHub BITPlan

Documentation

Maven dependency

Maven dependency

<!-- Java library to call Mediawiki API described at http://www.mediawiki.org/wiki/API:Main_page http://mediawiki-japi.bitplan.com/index.php/Main_Page -->
<dependency>
  <groupId>com.bitplan</groupId>
  <artifactId>mediawiki-japi</artifactId>
  <version>0.2.3</version>
</dependency>

Current release at repo1.maven.org

How to build

git clone https://github.com/WolfgangFahl/Mediawiki-Japi
cd Mediawiki-Japi
mvn install

Status

  • Implemented Features are limited to what the test cases of the current version check
  • tests run against current wikipedia installations as well as 1.23.17,1.25.6,1.27.3 and 1.29.1 test wikis

Examples

See also Examples on the Mediawiki-Japi Wiki

Sample query:get a single page

http://www.mediawiki.org/wiki/API:Query#Sample_query

	Mediawiki wiki=new Mediawiki("http://en.wikipedia.org");
	String content=wiki.getPageContent("Main Page");

junit test

  /**
   * http://www.mediawiki.org/wiki/API:Query#Sample_query
   * http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&titles=Main%20Page&format=xml
   * @throws Exception 
   */
	@Test
	public void testSampleQuery() throws Exception {
		Mediawiki wiki=new Mediawiki("http://en.wikipedia.org");
		String content=wiki.getPageContent("Main Page");
		assertTrue(content.contains("Wikipedia"));
	}

login/logout

http://www.mediawiki.org/wiki/API:Login

Login login=wiki.login("scott","tiger");
wiki.logout();

junit test

  /**
	 * test Login and logout 
	 * see <a href='http://www.mediawiki.org/wiki/API:Login'>API:Login</a>
	 * @throws Exception
	 */
	@Test
	public void testLogin() throws Exception {
		WikiUser wuser=WikiUser.getUser("mediawiki_org");
		Login login=wiki.login(wuser.getUsername(),wuser.getPassword());
		assertEquals("Success",login.getResult());
		assertNotNull(login.getLguserid());
		assertEquals(wuser.getUsername(),login.getLgusername());
		assertNotNull(login.getLgtoken());
		wiki.logout();
	}

Design decisions

Jaxb-Generator

This is a semi-automatic process. The resulting java code needs to be adapted to be workable. For a start 18 Java classes have been generated that allow some 19 JUnit tests to pass (to a total of 43 including the 24 unit tests supplied with Wiki.java).

Version history

  • 0.0.1 - 2015-01-01: first version as JMediawiki
  • 0.0.2 - 2015-01-18: fixes issues #1 - #7
  • 0.0.3 - 2015-01-20: fixes issue #8 refactors to multi implementation approach with guice
  • 0.0.4 - 2015-04-05: adds section handling
  • 0.0.5 - 2015-06-14: improves section handling handles uploads in copyToWiki fixes issue with test on en.wikipedia.org
  • 0.0.6 - 2015-07-02: fixes revprop handling
  • 0.0.7 - 2015-07-08: fixes #14 namespace handling in copy adds #15 - delete function
  • 0.0.8 - 2015-08-26: fixes #16 allImages support (timestamp based for the time being)
  • 0.0.9 - 2015-10-10: fixes #17 to #18 and #19: ignore superfluous newlines in xml api results (if any)
  • 0.0.10 - 2015-10-12: fixes #20
  • 0.0.11 - 2015-11-09: fixes #21
  • 0.0.12 - 2016-01-09: fixes issues #21 to #24
  • 0.0.13 - 2016-01-19: fixes #25
  • 0.0.14 - 2016-03-12: fixes #26,#27
  • 0.0.15 - 2016-10-22: fixes #30,#31
  • 0.0.16 - 2016-11-16: fixes #32
  • 0.0.17 - 2016-11-16: fixes #33
  • 0.0.18 - 2016-11-17: fixes #34 upgrades to Jersey 1.19.3
  • 0.0.19 - 2017-05-30: pr #37 login to domain support 2017-08-24: adds travis build check
  • 0.0.20 - 2017-09-13: fixes #38
  • 0.0.21 - 2017-09-16: fixes #39
  • 0.1.01 - 2018-01-25: Java 8 and first steps for json support
  • 0.1.02 - 2018-08-20: fixes #40,#41
  • 0.1.03 - 2019-03-20: merges #43
  • 0.1.04 - 2019 : not released to maven central
  • 0.1.05 - 2020-03-16: fixes #49 - adds command line mode and upgrades some dependencies
  • 0.2.0 - 2021 : not released to maven central
  • 0.2.1 - 2021-12-16: failed sonatype release
  • 0.2.2 - 2021-12-17: fixes log4j upgrade to 2.16.0
  • 0.2.3 - 2021-12-19: fixes log4j upgrade to 2.17.0

mediawiki-japi's People

Contributors

barroisr avatar dependabot[bot] avatar intracer avatar objecttrouve avatar wolfgangfahl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mediawiki-japi's Issues

Problem accessing wiki

Hi

not sure why it fails to find the api on my debian based mediawiki version 1.2.6.2.
to get it to work I had to do this
public static final String DEFAULT_SCRIPTPATH = "";
Now its working so far.

Data formats

I could be wrong but I saw your library and I see that you use the XML format, but it's not going to be supported in new versions o MediaWiki, you can see this warning below:

"All formats other than JSON are deprecated. XML and PHP are still supported, but all others have been removed in either MediaWiki 1.26 or 1.27; see the table below. All new API users should use JSON" [1]

[1] API:Data formats. (2015, December 16). MediaWiki, The Free Wiki Engine. Retrieved 12:59, April 17, 2016 from https://www.mediawiki.org/w/index.php?title=API:Data_formats&oldid=1964994

Function to copy pages from one wiki to another

There should be a function copyPage(pageTitle,sourceWiki,targetWiki) that will copy an
article from one wiki to another. For a start it's good enough to only copy the content and to assume the targetWiki has already been logged in to.

Server Errror codes are not handled properly

e.g. when an upload of a file which is bigger than the allowed PHP limit (default: 2MB) is tried the server will respond with Status code 500 and INTERNAL_SERVER_ERROR but the Mediawiki-Japi software will only throw an "invalid xml:" and show no xml which is misleading.

Ability to automatically run tests for CI builds

Now some tests are failing and require configuration

Failed tests:
TestAPI_Edit.testDelete:90 expected:<0> but was:<3>
TestAPI_Login.testGetUser:38 User credentials not found/configured
TestAPI_Login.testLogin:72 Need to be able to read Credentials for
http://mediawiki-japi.bitplan.com
from /home/ilya/.mediawiki-japi/ilya_mediawiki-japi-test1_19.ini
Please run
java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki-japi-test1_19
to create it. Then restart your tests.
TestAPI_Login.testLoginWrongPassword:96 Need to be able to read Credentials for
http://mediawiki-japi.bitplan.com
from /home/ilya/.mediawiki-japi/ilya_mediawiki-japi-test1_19.ini
Please run
java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki-japi-test1_19
to create it. Then restart your tests.
Tests in error:
TestAPI_Allpages.testAllImages:51 » NullPointer
TestAPI_Allpages.testAllpages:38 » NullPointer
TestAPI_Allpages.testBacklink:81 » NullPointer
TestAPI_Allpages.testImagesInfosForPage:115 » NullPointer
TestAPI_Allpages.testImagesOnPage:92 » NullPointer
TestAPI_Edit.TestEdit:104 » NullPointer
TestAPI_Edit.TestURLengthLimit:126 » NullPointer
TestAPI_Edit.testCopy:167 » NullPointer
TestAPI_Edit.testEditNoLogin:150 » NullPointer
TestAPI_Edit.testEditSection:211 » NullPointer
TestAPI_Edit.testGetEditToken:56 » NullPointer
TestAPI_Login.testLoginToken:53 NullPointer
TestAPI_Recentchanges.testGetMostRecentChanges:96 » NullPointer
TestAPI_Upload.testUpload:36 » NullPointer
TestAPI_Upload.testUploadViaII:60 » NullPointer
TestCreateAccount.testCreateAccount:40 » NullPointer
TestProtectionMarker.testProtectionMarker:26 » NullPointer

Tests run: 74, Failures: 4, Errors: 17, Skipped: 0

Mw 1.28 compatibility Fetching a token via action=login is deprecated

<api>
<warnings>
<login xml:space="preserve">
Fetching a token via action=login is deprecated. Use action=query&amp;meta=tokens&amp;type=login instead.</login>
</warnings>
<login result="NeedToken" token="8db00b6979cf3755f3fa8355441a4a14580b695e+\" />
</api>

and when doing the token part as required
Information:

<?xml version="1.0"?>
<api>
<warnings>
<login xml:space="preserve">
The following parameters were found in the query string, but must be in the POST body: lgpassword, lgtoken
Main-account login via action=login is deprecated and may stop working without warning. To continue login with action=login, see [[Special:BotPasswords]]. To safely continue using main-account login, see action=clientlogin.</login>
</warnings>
<login result="Success" lguserid="..." lgusername="..." />
</api>

Login might fail if version can't be retrieved via API

error code=readapidenied info:'You need read permission to use this module'

Stacktrace

java.lang.Exception: error code=readapidenied info:'You need read permission to use this module'
at com.bitplan.mediawiki.japi.MediaWikiApiImpl.handleError(MediaWikiApiImpl.java:93)
at com.bitplan.mediawiki.japi.MediaWikiApiImpl.fromXML(MediaWikiApiImpl.java:146)
at com.bitplan.mediawiki.japi.Mediawiki.getActionResult(Mediawiki.java:409)
at com.bitplan.mediawiki.japi.Mediawiki.getQueryResult(Mediawiki.java:434)
at com.bitplan.mediawiki.japi.Mediawiki.getSiteInfo(Mediawiki.java:464)
at com.bitplan.mediawiki.japi.MediaWikiApiImpl.getVersion(MediaWikiApiImpl.java:208)
at com.bitplan.mediawiki.japi.Mediawiki.prepareLogin(Mediawiki.java:494)
at com.bitplan.mediawiki.japi.Mediawiki.login(Mediawiki.java:547)

need getMostRecentChanges function

getRecentChanges delivers multiple changes per Title if a page has been touched many times.
The function getMostRecentChanges should sort the changes by Title and most RecentChange and only deliver the most recent changes for each title. The resulting list is then resorted by most recent change in a descending order delivering the most recent changes first.

Login with OAuth

I have a tool using this fantastic library. However, in order to be used by several users, I have had to implement OAuth authentication, so I no longer login with the library (user / password). Thus, I have had to implement the edit method by myself.

I guess I could separate the edit method, to be able to receive an edit token generated outside the library. Or even add an implementation of getEditToken using an access token as a parameter.

Which one do you think it is the best approach ?

Thanks in advance,

Fix XML error handling with broken wikis

when trying to contact a misconfigured wiki that bails out e.g. with
Parse error: syntax error, unexpected $end in /var/www/scan/LocalSettings.php ...

the resulting error handling should be improved
Instead of an exception Exception Description: A descriptor with default root element br was not found in the project
the resulting answer should be logged and a descent exception be thrown.

protection marker

add protection marker concept so that edit's won't be done if the page contains the protection marker.

regression of #32

#32 wasn't fixed properly - there was another call in the code that checked for MW 1.28

How can I change the DEFAULT_SCRIPTPATH?

My mediawiki installation has the api at mywiki.com/api.php and not mywiki.com/w/api.php.

How can I change this since I imported the JAPI as a Maven Dependency?

Thank you very much!

JaxbException null

Okt 10, 2015 11:29:58 AM com.bitplan.mediawiki.japi.jaxb.JaxbFactory fromString
SCHWERWIEGEND: JAXBException: null
Okt 10, 2015 11:29:58 AM com.bitplan.mediawiki.japi.jaxb.JaxbFactory fromString
SCHWERWIEGEND: 

<?xml version="1.0"?><api><login result="NeedToken" token="bd76872088b90aee85074b5c12e8ae54" cookieprefix="gfwiki" sessionid="b4afedfda4a183e44c9bd696b92b5191" /></api>

Please note the two newlines in the xml messsage!

avax.xml.bind.PropertyException: name: eclipselink.media-type value: application/xml at javax.xml.bind.helpers.AbstractUnmarshallerImpl.setProperty(AbstractUnmarshallerImpl.java:352)

Hi,

I've got an exception while fetching a page from de.wikipedia.org. The content is received but apparently not parseable. Building Mediawiki-Japi with tests fails as well, but with different errors.

Test code:
@test
public void testSampleQuery() throws Exception {
Mediawiki wiki = new Mediawiki("http://en.wikipedia.org");
String content = wiki.getPageContent("Main Page");
assertTrue(content.contains("Wikipedia"));
}

exception:

/usr/lib/jvm/java-7-openjdk-amd64/bin/java -ea -Didea.launcher.port=7532 -Didea.launcher.bin.path=/home/trublu/bin/idea/bin -Dfile.encoding=UTF-8 -classpath /home/trublu/bin/idea/lib/idea_rt.jar:/home/trublu/bin/idea/plugins/junit/lib/junit-rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rhino.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/rt.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/javazic.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/home/trublu/git/hipedia/bot1/target/test-classes:/home/trublu/git/hipedia/bot1/target/classes:/home/trublu/.m2/repository/com/bitplan/mediawiki-japi/0.0.11/mediawiki-japi-0.0.11.jar:/home/trublu/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar:/home/trublu/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/home/trublu/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/home/trublu/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar:/home/trublu/.m2/repository/com/sun/jersey/jersey-client/1.18/jersey-client-1.18.jar:/home/trublu/.m2/repository/com/sun/jersey/jersey-core/1.18/jersey-core-1.18.jar:/home/trublu/.m2/repository/com/sun/jersey/contribs/jersey-apache-client/1.18/jersey-apache-client-1.18.jar:/home/trublu/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/home/trublu/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar:/home/trublu/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar:/home/trublu/.m2/repository/com/sun/jersey/contribs/jersey-multipart/1.18/jersey-multipart-1.18.jar:/home/trublu/.m2/repository/org/jvnet/mimepull/mimepull/1.9.3/mimepull-1.9.3.jar:/home/trublu/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.moxy/2.6.0-M3/org.eclipse.persistence.moxy-2.6.0-M3.jar:/home/trublu/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.core/2.6.0-M3/org.eclipse.persistence.core-2.6.0-M3.jar:/home/trublu/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.asm/2.6.0-M3/org.eclipse.persistence.asm-2.6.0-M3.jar:/home/trublu/.m2/repository/org/eclipse/persistence/org.eclipse.persistence.antlr/2.6.0-M3/org.eclipse.persistence.antlr-2.6.0-M3.jar:/home/trublu/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar:/home/trublu/.m2/repository/args4j/args4j/2.0.29/args4j-2.0.29.jar:/home/trublu/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar:/home/trublu/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar:/home/trublu/.m2/repository/junit/junit/4.11/junit-4.11.jar:/home/trublu/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 LibrarieTest,testSampleQuery
Nov 20, 2015 4:05:15 PM com.bitplan.mediawiki.japi.api.Api fromXML
SEVERE: name: eclipselink.media-type value: application/xml
Nov 20, 2015 4:05:15 PM com.bitplan.mediawiki.japi.api.Api fromXML
INFO: <!-- BANNER ACROSS TOP OF PAGE -->
{| id="mp-topbanner" style="width:100%; background:#f9f9f9; margin:1.2em 0 6px 0; border:1px solid #ddd;"
| style="width:61%; color:#000;" |
<!-- "WELCOME TO WIKIPEDIA" AND ARTICLE COUNT -->
{| style="width:280px; border:none; background:none;"
| style="width:280px; text-align:center; white-space:nowrap; color:#000;" |
<div style="font-size:162%; border:none; margin:0; padding:.1em; color:#000;">Welcome to [[Wikipedia]],</div>
<div style="top:+0.2em; font-size:95%;">the [[free content|free]] [[encyclopedia]] that [[Wikipedia:Introduction|anyone can edit]].</div>
<div id="articlecount" style="font-size:85%;">[[Special:Statistics|{{NUMBEROFARTICLES}}]] articles in [[English language|English]]</div>
|}
<!-- PORTAL LIST ON RIGHT-HAND SIDE -->
| style="width:13%; font-size:95%;" |

  • [[Portal:Arts|Arts]]
  • [[Portal:Biography|Biography]]
  • [[Portal:Geography|Geography]]
    | style="width:13%; font-size:95%;" |
  • [[Portal:History|History]]
  • [[Portal:Mathematics|Mathematics]]
  • [[Portal:Science|Science]]
    | style="width:13%; font-size:95%;" |
  • [[Portal:Society|Society]]
  • [[Portal:Technology|Technology]]
  • '''[[Portal:Contents/Portals|All portals]]'''
    |}
    <!-- MAIN PAGE BANNER -->
    {{#if:{{Main Page banner}}|
    <table id="mp-banner" style="width: 100%; margin:4px 0 0 0; background:none; border-spacing: 0px;">
    <tr><td class="MainPageBG" style="padding:8px; background-color:#fffaf5; border:1px solid #f2e0ce; color:#000; font-size:100%;">{{Main Page banner}}
    </td></tr>
    </table>
    }}
    <!-- TODAY'S FEATURED CONTENT -->
    {| id="mp-upper" style="width: 100%; margin:4px 0 0 0; background:none; border-spacing: 0px;"
    <!-- TODAY'S FEATURED ARTICLE; DID YOU KNOW -->
    | class="MainPageBG" style="width:55%; border:1px solid #cef2e0; background:#f5fffa; vertical-align:top; color:#000;" |
    {| id="mp-left" style="width:100%; vertical-align:top; background:#f5fffa;"
    | style="padding:2px;" | <h2 id="mp-tfa-h2" style="margin:3px; background:#cef2e0; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em;">{{#ifexpr:{{formatnum:{{PAGESIZE:Wikipedia:Today's featured article/{{#time:F j, Y}}}}|R}}>150|From today's featured article|Featured article <span style="font-size:85%; font-weight:normal;">(Check back later for today's.)</span>}}</h2>
    |-
    | style="color:#000;" | <div id="mp-tfa" style="padding:2px 5px">{{#ifexpr:{{formatnum:{{PAGESIZE:Wikipedia:Today's featured article/{{#time:F j, Y}}}}|R}}>150|{{Wikipedia:Today's featured article/{{#time:F j, Y}}}}|{{Wikipedia:Today's featured article/{{#time:F j, Y|-1 day}}}}}}</div>
    |-
    | style="padding:2px;" | <h2 id="mp-dyk-h2" style="margin:3px; background:#cef2e0; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3bfb1; text-align:left; color:#000; padding:0.2em 0.4em;">Did you know...</h2>
    |-
    | style="color:#000; padding:2px 5px 5px;" | <div id="mp-dyk">{{Did you know}}</div>
    |}
    | style="border:1px solid transparent;" |
    <!-- IN THE NEWS; ON THIS DAY -->
    | class="MainPageBG" style="width:45%; border:1px solid #cedff2; background:#f5faff; vertical-align:top;"|
    {| id="mp-right" style="width:100%; vertical-align:top; background:#f5faff;"
    | style="padding:2px;" | <h2 id="mp-itn-h2" style="margin:3px; background:#cedff2; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em;">In the news</h2>
    |-
    | style="color:#000; padding:2px 5px;" | <div id="mp-itn">{{In the news}}</div>
    |-
    | style="padding:2px;" | <h2 id="mp-otd-h2" style="margin:3px; background:#cedff2; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #a3b0bf; text-align:left; color:#000; padding:0.2em 0.4em;">On this day...</h2>
    |-
    | style="color:#000; padding:2px 5px 5px;" | <div id="mp-otd">{{Wikipedia:Selected anniversaries/{{#time:F j}}}}</div>
    |}
    |}
    <!-- TODAY'S FEATURED LIST --><!-- CONDITIONAL SHOW -->{{#switch:{{CURRENTDAYNAME}}|Monday|Friday=
    <table id="mp-middle" style="width:100%; margin:4px 0 0 0; background:none; border-spacing: 0px;">
    <tr>
    <td class="MainPageBG" style="width:100%; border:1px solid #f2cedd; background:#fff5fa; vertical-align:top; color:#000;">
    <table id="mp-center" style="width:100%; vertical-align:top; background:#fff5fa; color:#000;">
    <tr>
    <td style="padding:2px;"><h2 id="mp-tfl-h2" style="margin:3px; background:#f2cedd; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #bfa3af; text-align:left; color:#000; padding:0.2em 0.4em">From today's featured list</h2></td>
    </tr><tr>
    <td style="color:#000;"><div id="mp-tfl" style="padding:2px 5px;">{{#ifexist:Wikipedia:Today's featured list/{{#time:F j, Y}}|{{Wikipedia:Today's featured list/{{#time:F j, Y}}}}|{{TFLempty}}}}</div></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>|}}<!-- END CONDITIONAL SHOW -->
    <!-- TODAY'S FEATURED PICTURE -->
    {| id="mp-lower" style="margin:4px 0 0 0; width:100%; background:none; border-spacing: 0px;"
    | class="MainPageBG" style="width:100%; border:1px solid #ddcef2; background:#faf5ff; vertical-align:top; color:#000;" |
    {| id="mp-bottom" style="width:100%; vertical-align:top; background:#faf5ff; color:#000;"
    | style="padding:2px;" | <h2 id="mp-tfp-h2" style="margin:3px; background:#ddcef2; font-family:inherit; font-size:120%; font-weight:bold; border:1px solid #afa3bf; text-align:left; color:#000; padding:0.2em 0.4em">{{#ifexist:Template:POTD protected/{{#time:Y-m-d}}|Today's featured picture | Featured picture&ensp;<span style="font-size:85%; font-weight:normal;">(Check back later for today's.)</span>}}</h2>
    |-
    | style="color:#000; padding:2px;" | <div id="mp-tfp">{{#ifexist:Template:POTD protected/{{#time:Y-m-d}}|{{POTD protected/{{#time:Y-m-d}}}}|{{POTD protected/{{#time:Y-m-d|-1 day}}}}}}</div>
    |}
    |}
    <!-- SECTIONS AT BOTTOM OF PAGE -->
    <div id="mp-other" style="padding-top:4px; padding-bottom:2px;">
    == Other areas of Wikipedia ==
    {{Other areas of Wikipedia}}
    </div><div id="mp-sister">
    == Wikipedia's sister projects ==
    {{Wikipedia's sister projects}}
    </div><div id="mp-lang">
    == Wikipedia languages ==
    {{Wikipedia languages}}
    </div>
    <!-- INTERWIKI STRAPLINE -->
    <noinclude>{{Main Page interwikis}}{{noexternallanglinks}}{{#if:{{Wikipedia:Main_Page/Tomorrow}}||}}</noinclude>NOTOC____NOEDITSECTION

javax.xml.bind.PropertyException: name: eclipselink.media-type value: application/xml
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.setProperty(AbstractUnmarshallerImpl.java:352)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.setProperty(UnmarshallerImpl.java:450)
at com.bitplan.mediawiki.japi.jaxb.JaxbFactory.fromXML(JaxbFactory.java:120)
at com.bitplan.mediawiki.japi.api.Api.fromXML(Api.java:300)
at com.bitplan.mediawiki.japi.MediaWikiApiImpl.fromXML(MediaWikiApiImpl.java:134)
at com.bitplan.mediawiki.japi.Mediawiki.getActionResult(Mediawiki.java:404)
at com.bitplan.mediawiki.japi.Mediawiki.getQueryResult(Mediawiki.java:429)
at com.bitplan.mediawiki.japi.Mediawiki.getPageContent(Mediawiki.java:532)
at com.bitplan.mediawiki.japi.Mediawiki.getPageContent(Mediawiki.java:560)
at LibrarieTest.testSampleQuery(LibrarieTest.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

Process finished with exit code 255

Command Line interface

java -jar mediawiki-japi-0.0.2.jar should give a meaningful result and not
Failed to load Main-Class manifest attribute from
target/mediawiki-japi-0.0.2.jar

Example Wikis from Mediawiki-Japi

Export the Test-Examples to.csv and use these to initialize the ExampleWikis to be used in the tests.

Allow specification of the url to retrieve the tests from at test runtime e.g. via a maven -D parameter

Later .xml files could be used when the tests need to be more structured

Situation

There are some example wikis defined at:

Action

initialize ExampleWikis in ExampleWiki.java using the above exampleWikis siteurls and wikids

Expected Result

a) ExampleWiki.get("waihekepedia_org") should retrieve the ExampleWiki with siteurl http://www.waihekepedia.org and wikiid waihekepedia_org

b) The loop at TestAPI_Query.java will use the above example wikis to test the allpages api function.

Implementation idea

see http://stackoverflow.com/questions/27224870/getting-http-400-error-when-trying-to-download-file-using-jersey-client

Wolfgang took a possible implementaion to TestGetCSV.java.

extend copyToWiki to handle Images and Namespaces

copyToWiki should automatically detect the use of pageTitles that contain namespaces and convert the target pages to the localized namespace. It should also handle "pages" from the "File:" namespace.

Here are some examples assuming the source wiki is a german wiki and the target wiki is an english wiki.

  • Datei:Example.jpg should be transferred as File:Example.jpg and handled via Image upload
  • Kategory:Cities should be transferred as Category:Cities
  • Vorlage:someTemplate should be transferred as Template:someTemplate

need TestCase for wrongPassword

login.getResult() seems to have the following possible outcomes:

  • Success
  • WrongPass
  • NotExists
    and may be more.
    Need test cases for the three cases above - so testLoginWrongPassword is needed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.