Anchor(EclipseAndIntellij)

title(Development Tools Guideline) Action(edit)

TableOfContents(2)

Introduction

This guideline 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)

Anchor(UnitTests)

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)

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

(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