« November 2006 | Main | February 2007 »
January 17, 2007
Continuous Integration with CruiseControl + FlexUnit + XDoclet2
Last year I blogged about XDoclet2 and FlexUnit and Ant . In this entry I am going to look at setting up CruiseControl for continuous integration. I have setup my CruiseControl server on Linux so I will do my best to make sure these instruction also apply to Windows. I also used Perforce as my source control repository so I have included the extra steps that are required to get CruiseControl working with Perforce. CruiseControl supports many other repositories such as Subversion and CVS. Please refer the the CuriseControl configuration reference for more details.
What software do I need?
You will need to download the following software:
- Download the CruiseControl binary distribution - I downloaded CruiseControl 2.6.
- Download a Java SE Development Kit (JDK) - I downloaded JDK 5.0 Update 10.
- Download FlexAntTasks.
- Download Flash Player 9 for Windows, Macintosh or Linux.
- Download Flex SDK.
If you are using Perforce you will also need the following:
- Download the Apache Ant binary distribution Don’t use the embedded copy of Ant that comes with CruiseControl as it doesn’t contain the Perforce tasks - I downloaded Apache Ant 1.7.0.
- Download the Jakarta ORO binary distribution. Jakarta ORO is required by the Perforce Ant tasks - I downloaded Jakarta ORO 2.0.8.
- Download the Perforce client (p4).
Do I need anything else?
Yes - if you are running this on Linux you will need an X Server installed and you will probably want a virtual frame buffer. These are required by the Flash Player - there is no headless version of the player. If you try and run the Flash Player without these you will probably get the following error:
Can't connect to X11 window server using ':0.0' as the value of the DISPLAY
The virtual frame buffer will allow the Flash Player to run in a virtual window without the need for a display plugged in to your server. I used XFree86, which provides an X Server and a virtual frame buffer (Xvfb).
How do I install the software?
- Extract CruiseControl to a suitable location on your local machine.
- Install your JDK.
- Create a JAVA_HOME environment variable with the path to your JDK installation.
- Add $JAVA_HOME/bin (or %JAVA_HOME%\bin on Windows) to your path.
- Copy FlexAntTasks.jar to <ANT_HOME>\lib, where <ANT_HOME> is the path to your Ant installation. If you are using the version of Ant that comes with CruiseControl you will find it under your CruiseControl instalaltion. The example config at the end of this blog shows how to configure an alternative Ant installation.
- Install Flash Player 9.
- Install Flex SDK.
Note: if you are using Linux the FlexUnit Ant task will use the standalone player, please make sure the Flash Player executable (gflashplayer) is on your PATH.
To verify CruiseControl is working start is using cruisecontrol.sh or cruisecontrol.bat (start CruiseControl from its home directory) and connect to the console through your browser using http://<your_server>:8080. You should see a test project called connectfour. Stop CruiseControl after you have connected sucessfully.
If you are using Perforce:
- Extract Apache Ant to a suitable location on your local machine.
- Extract Jakarta ORO and copy the JAR (e.g. jakarta-oro-2.0.8.jar) to <ANT_HOME>\lib, where <ANT_HOME> is the path to your Ant installation.
- Make sure the Perforce client executable (p4) is on your PATH.
You will also need to create a client workspace for Perforce, which is used by CruiseControl. You can do this using the P4V tool or on the command line using p4, for example you can do the following on Linux to create a client workspace:
- mkdir ~/cruisecontrol
- cd ~/cruisecontrol
- p4 -p <port> -c <client_workspace> -u <user> -P <password> client
The final command puts you in the editor, which you can just quit.
How do I run CruiseControl?
If you are running on Linux and using Xvfb execute the following commands:
- export DISPLAY=:1.0
- /usr/X11R6/bin/Xvfb :1 -screen 0 1280x1024x8 &
- cd <CC_HOME>, where <CC_HOME> is the parth to your CruiseControl installation.
- cruisecontrol.sh &
If you are on Windows:
- Open a command prompt.
- cd <CC_HOME>, where <CC_HOME> is the parth to your CruiseControl installation.
- cruisecontrol.bat
You can then connect to the console using your browser: http://<your_server>:8080
How do I configure a project?
You must configure your projects in <CC_HOME>\config.xml, where <CC_HOME> is the parth to your CruiseControl installation.
I have provided an example of config.xml , which externalises its configuration parameters to config.properties. This example uses my FlexUnitExample project.
Note: use the latest version of FlexUnit for Ant as it no longer requires you to create a FlashPlayerTrust configuration file.
Posted by at 07:34 PM | Comments (3)
FlexUnit for Ant Update#4
You can download a new release of FlexUnit for Ant. This version fixes a bug with the toDir property and also removes the need to create a configuration file under the FlashPlayerTrust folder to allow the SWF to run in the local trusted sandbox. The Ant task will now send a policy file to the Flash Player to allow the data to be sent over the socket - should make life a little easier.
For more details on how to use FlexUnit for Ant please see my earlier blog. There is also documentation on the flexunit Ant task parameters at the end of this blog. You can download FlexUnit from Adobe Labs.
Binary distribution
Source Distribution
Example Project
Ant Task Parameters
Attribute |
Description |
Required |
|---|---|---|
| swf | The name of SWF containing the tests to execute. | Yes |
| port | The port to receive the test results on from FlexUnit. The default port is 1024. | No |
| timeout | The time in milliseconds to wait for results from FlexUnit before stopping the building process. The default is 60 seconds. You need to allow enought time for your tests to run as the socket is opended prior to the test execution. | No |
| toDir | The output directory for the test resutlts. The default is the working directory. | No |
| haltonfailure | Stop the build process if a test fails. The default is true. | No |
| failureproperty | The name of the property to set in the event of a failure. The default is 'flexunit.failed''. | No |
| verbose | Causes the flexunit tasks to print status messages. The default is false. | No |
Posted by at 05:11 PM | Comments (3)
January 09, 2007
FDS Plugin 2 (Beta)
A number of people of have been asking me when a new version of my FDS plugin will be released to support Flex 2.0.1, Eclipse 3.2 and the Mac. Now that Flex 2.0.1 is released I am happy to say I have made a beta version of the plugin available. So please install it and let me know what you think. More importantly if you find a bug send me an email, pmartin@adobe.com.
This is a complete re-write and I have done my best to address the issues that I saw in the previous versions. In particular I have removed the dependency on Java 5 and externalized Flex Data Services (you now need to have FDS installed on your your local machine).
Prerequisites
To install the plugin you need the following already installed:
- Eclipse 3.2.x
- Eclipse Web Tools Platform 1.5.x
- Flex Builder 2.0.1
With regards to Eclipse + Eclipse Web Tools Platform I would recommend installing the all-in-one, which can be downloaded from here.
Installation
- Download the plugin from here.
- Start Eclipse.
- Select Help > Software Updates > Find and Install.
- Select Search for new features to install.
- Click New Archived Site.
- Select the plugin ZIP file you downloaded.
- Click Finish.
- Check the feature.
- Complete the wizard.
What's new?
As mentioned above Flex Data Services (FDS) has been externalized. This means you need FDS installed on your local machine. You will find a new preferences page in Eclipse (Window > Preferences > Flex Data Services > FDS Installations) where you can configure the installation location of FDS.

The new project wizard now has a configuration page, which you can use to configure your FDS project.
In particular it adds an option to compile your application locally in Flex Builder, which should help improve your development velocity. In the past it only supported compile on server, which it continues to support. However, I would strongly urge against using this option as I have found it to be troublesome when you are debugging as Flex Builder won't always find the source.
Other than that it should be business as usual.
Posted by at 10:48 AM
