## page was renamed from Developer Manual devel/Development Tools <> <> <> <> = Introduction = These guidelines covers the coding and unit testing based on the development tools Eclipse and Intellij (IDEA). = Eclipse = Development of !NetarchiveSuite is currently done using either Eclipse or Intellij. There are project files for both these development tools in the root of the subversion trunk. The eclipse specific project files are {{{ .project .classpath .checkstyle }}} The .checkstyle contains a reference to the file !NetarchiveSuite_checks.xml also located in the root of the trunk. To start developing using Eclipse, you need to first install a Sun JDK 1.6_0+ on your machine, and add it to the list of installed JREs under Eclipse->windows->preferences->java->Installed JREs. Furthermore, you need to make it the default JRE. Additionally, you need to install an Subversion client for Eclipse. We are using the [[http://subclipse.tigris.org/|Subclipse]] plugin. Then import the !NetarchiveSuite project by opening the SVN Repository Exploring perspective, adding the subversion repository https://gforge.statsbiblioteket.dk/svn/netarchivesuite/trunk (Note that you need to be a developer on !NetarchiveSuite to do this), mark the whole trunk for checkout, and then click checkout. You have now a viable eclipse project. = Intellij = The '''''Intellij''''' specific project files are {{{ netarchivesuite.iml netarchivesuite.ipr }}} To start developing using Intellij, you need to ... (TBW) <> = Run Unit tests = To run the unittests (the dk.netarkivet.!UnitTesterSuite) the following prerequisites must be fullfilled (will normally be fullfilled, if the test has been executed previously) * the http port 8076 is not occupied by other applications on localhost, - otherwise all GUI-tests will fail. * tests/dk/netarkivet/jmxremote.password has permissions {{{-r--------}}} (chmod 400 jmxremote.password) To run the unittests (the dk.netarkivet.!UnitTesterSuite) from inside '''''eclipse''''', you need to set the following properties in the arguments given to the VM when starting the !UnitTesterSuite: {{{ -Xmx700m -Ddk.netarkivet.settings.file=tests/dk/netarkivet/test-settings.xml -Djava.util.logging.config.file=tests/dk/netarkivet/testlog.prop -Ddk.netarkivet.jms.broker=localhost -Djava.security.manager -Djava.security.policy=tests/dk/netarkivet/kbtest.policy -Ddk.netarkivet.settings.jmx.passwordFile=tests/dk/netarkivet/jmxremote.password -Dorg.apache.commons.logging.log=org.apache.commons.logging.impl.Jdk14Logger }}} (In Eclipse these options are placed under VM arguments in "Run" of the program) If you are running on a shared machine, In order to prevent confusion of JMS broker used for other test, it may be a good idea also to include JVM following options with INITIALS replaced with your own initials: {{{ -Dsettings.common.jms.environmentName=INITIALS }}} You may need to change the security policy defined in "kbtest.policy" to suit local conditions. You can also make an Eclipse project from a !NetarchiveSuite source distributions. This should be quite straight forward. == Running the GUIApplication to from inside eclipse (or Intellij) == If you want to sanity-check any changes to the JSP-changes, you can run the dk.netarkivet.common.webinterface.GUIApplication from inside your IDE. This requires that the five war files (!HarvestDefinition.war, History.war, !BitPreservation.war, QA.war, Status.war) are present in the webpages directory. You generate them by executing the following command (either from inside your IDE, or from the commandline):'''ant warfiles''' A further requirement is that you have unzipped the default database in the harvestdefinitionbasedir/fullhddb.jar. Finally, you need to give the HTTP port to use by the GUI application and its JMX and RMI ports as arguments for the Java VM (You may have to use other port-numbers than those given here, as the numbers given here may be occupied by other applications on the machine): {{{ -Dsettings.common.http.port=8078 -Dsettings.common.jmx.port=8110 -Dsettings.common.jmx.rmiPort=8210 }}} = Performing additional checks on the code = Before committing code, it is a good idea to check, if the code is lacking in some way or other in regard to the NetarchiveSuite coding standards or otherwise. Note that any problems found by the tools in the test-code should normally be disregarded! We usually use the following tools for this purpose: == checkstyle == This checks, if our coding standards are followed (no tabs, lines <= 80, errors in javadoc, or missing javadoc). A checkstyle plugin for eclipse can be found here: http://eclipse-cs.sourceforge.net/ The file the ''trunk/NetarchiveSuite_checks.xml'' contains the style checks we have decided to make on the NetarchiveSuite code. == Findbugs == Findbugs makes a static analysis of the code, and tries to detect problems with the code. A findbugs plugin for eclipse can be found here: http://findbugs.sourceforge.net/manual/eclipse.html == PMD == PMD also makes a static analysis of the code, and tries to detect problems with the code. A PMD plugin for eclipse can be found here: http://pmd.sourceforge.net/eclipse