Alexandria

About

References

Continuous Intergration

Alexandrias ability to automatically get the latest versions of source code makes it ideally suited as a tool for continuous intergration.

Contious intergration is an approach which was brought to the fore as part of eXtreme Programming or XP. The idea has long been part of open source projects but is now becouming more widly accepted and formalised into a recognised process.

Building Modules

Alexandria provides support for build projects which use Ant as there build tool. To enable Alexandria to build a module you add the build taga to the global.xml file.

Alexandria runs the build in a seperate JVM to avoid clashes the source libraries ant those used by Alexandria. This means that the classpath attribute is used to specify classes that will be needed byt the module. Ant properties can also be passed to the build file using the arg tag this allows properties such as the output dir for the build to be changed from there defaults.

  
    <build buildfile="build.xml" target="main" classpath="lib/mylib.jar">
      <arg name="build.dir" value="build"/>
    </build>  
   
Testing Modules

Alexandria provides support for analyzing the output from the JUnit Ant task. JUnit is a java based framework for writing unit tests for java applications.

To anable Alexandria to use the output from the JUnit task it needs to be formatted using the xml formatter. The following example shows an example of this in the JUnit task.

 <property name="test.format" value="plain"/>   

If you wish to allow developers to run tests and provide them with plain text output, using an variable which defaults to plain and can be overriden with xml via the -D option is recommended.

  
    <junit printsummary="yes" haltonfailure="yes">
      <classpath>
        <pathelement location="${build.tests}" />
        <pathelement path="${java.class.path}" />
      </classpath>

      <formatter type="${test.format}" />

      <batchtest fork="yes">
        <fileset dir="${src.tests}">
          <include name="**/*Test*.java" />
          <exclude name="**/AllTests.java" />
        </fileset>
      </batchtest>
    </junit> 
   
  

Test targets are included in the global.xml file using the test tag. The test tag has two attributes buildfile and target. Buildfile is the name of the Ant buildfile which contains the test target and target is the name of the Ant target to be run. Test optionally takes a classpath (Test are always run in a seperate JVM to avoid class version problems) and arg tags that are used to pass Ant property values into Ant.

  
  <test buildfile="build.xml" target="test" classpath="lib/mylib.jar">
    <arg name="test.format" value="xml"/>
  </test>
   

Copyright © 1999-2001, Apache Software Foundation