Difference between revisions of "Developer Info"

From BITPlan mediawiki-japi Wiki
Jump to navigation Jump to search
Line 19: Line 19:
 
the ini file at $HOME/.mediawiki-api/bob_mediawiki_org.ini.
 
the ini file at $HOME/.mediawiki-api/bob_mediawiki_org.ini.
  
If the credentials ini files do not exist yet they are created interactively during the test run.
+
If the credentials ini files do not exist yet you are warned during the test run e.g.
 +
<pre>
 +
Jan 04, 2015 6:27:51 PM com.bitplan.mediawiki.japi.user.WikiUser getUser
 +
Schwerwiegend: Need to be able to read Credentials for
 +
    http://www.mediawiki.org
 +
from /home/rene/.mediawiki-japi/rene_mediawiki_org.ini
 +
Please run
 +
    java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki_org
 +
to create it. Then restart your tests.
 +
</pre>
 +
In this case you might want to run
 +
<source lang='bash'>
 +
    java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki_org
 +
</source>
  
 
=== Example for a credential ini file ===
 
=== Example for a credential ini file ===

Revision as of 05:49, 5 January 2015

Development Environment

Maven

Maven 3 is is used in a pretty standard way - just look at pom.xml for details

Eclipse

The project can be imported to eclipse - using the m2eclipse plugin is recommended EclipseImportProject.png

Testenvironment

There is a JUnit 4 Testsuite for the Mediawiki-Japi library that accesses some ExampleWikis for the tests.

A login attempt is part of most of the tests - you'll need credentials at http://www.mediawiki.org to run these tests successfully. You might want to create an account at https://www.mediawiki.org/w/index.php?title=Special:UserLogin&type=signup


Credentials for the test example Mediawikis

The credentials for the test example Mediawikis are fetched from ini files in the .mediawiki-api subdirectory of your home directory. E.g. if your username is bob and the id of the Mediawiki is "mediawiki_org" then you'll find the ini file at $HOME/.mediawiki-api/bob_mediawiki_org.ini.

If the credentials ini files do not exist yet you are warned during the test run e.g.

Jan 04, 2015 6:27:51 PM com.bitplan.mediawiki.japi.user.WikiUser getUser
Schwerwiegend: Need to be able to read Credentials for
    http://www.mediawiki.org
from /home/rene/.mediawiki-japi/rene_mediawiki_org.ini
Please run
    java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki_org
to create it. Then restart your tests.

In this case you might want to run

    java -cp target/test-classes com.bitplan.mediawiki.japi.user.WikiUser mediawiki_org

Example for a credential ini file

#Mediawiki-api 
#Fri Jan 02 19:58:49 CET 2015
secret=5hKnFOyU1uE\=
user=Scott
email=scott@tiger.org
salt=w75pcoUN
cypher=YYmhAs86ygNnLbs@b9dNq36afytEzkCm