RIA Continuous Integration with Flex and Java

January 16th, 2009

In the last month I have been working intensively to set up a professional environment for developing Rich Internet Applications at enterprise level.

Here is a summary of the setup I use:

 

 

IDE

Eclipse

Plugin - Subclipse

Plugin - FlexBuilder

Plugin - PHPEclipse

Plugin - Mylyn

 

 

Testing environment

Backend - JUnit

Frontend - FlexUnit

Frontend - FlexMonkey, run with FlexMonkeyLauncher, just put it in the same library as the swf-file. Record the steps, save them as test cases.

Testing with mock objects in frontend and backend

 

Code coverage

Backend - Java Code Coverage - Cobertura

Frontend - FlexCover (I am not using this, as it doesn’t really make sense to me with Flex development)

 

Performance testing

Backend - Java (JProbe or similar)

JMeter - double click “ApacheJMeter.jar”

 

Frontend - Flex Profiler (still need to set this up)

 

 

Compilation, dependencies and deployment environment

 

Maven2 with Flex-Mojos

 

 

Continuous Integration server

Continuum

 

I have set up Maven to generate several reports about the code style, changes, etc.

 

Maven links:

—————–

 

Improving site reporting

 

http://www.javaworld.com/javaworld/jw-02-2006/jw-0227-maven.html?page=1

 

 

Maven configuration

—————————-

To restart tomcat from within Maven on a Mac, add the following:

 

<settings xmlns=”http://maven.apache.org/POM/4.0.0″

   xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

   xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0

                      http://maven.apache.org/xsd/settings-1.0.0.xsd”>

  <servers>

<server>

<id>tomcatserver</id>

<username>root</username>

<password>admin</password>

</server>

</servers>

</settings>

 

to a file called: settings.xml and put it in: ~/.m2

 

For compilation of Adobe with Maven. Install the following in your local repository:

—————————————————————————————————————

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=playerglobal -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/libs/player/10/playerglobal.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=flex -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/libs/flex.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=rpc -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/libs/rpc.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=datavisualization -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/libs/datavisualization.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=framework-rb -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/locale/en_US/framework_rb.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=rpc-rb -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/locale/en_US/rpc_rb.swc”

 

mvn install:install-file -DgroupId=com.adobe.flex.sdk -DartifactId=datavisualization-rb -Dversion=3.2.0 -Dpackaging=swc -Dfile=”/Applications/Development/Adobe Flex Builder 3 Plug-in/sdks/3.2.0/frameworks/locale/en_US/datavisualization_rb.swc”

 

Frameworks

—————–

 

Frontend

Technology - Flex

Frameworks - Mate (IoC pattern)

 

Backend

Technology - Java

 

Frameworks - Spring (IoC pattern)

- DAO (separate data access layer from service layer)

- DTO (improve performance)

 

- Transaction Management (still to be decided)

Continuous Integration with Flex

December 6th, 2008

Being involved in a large scale application lately I have explored a little in getting a proper continuous integration environment setup for Flex.

We will probably be using Mate to keep things decoupled. Mate uses IoC - Inversion of Control, also called dependency injection, which gives the cleanest views I have yet seen in Flex. Furthermore is it extremely non-obtrusive and is based on Flex own events. This means that we can easily integrate other frameworks/design patterns, should we find the need for that.

With Mate it is easy to Mock all services, which greatly improves testability and helps in the development phase, since the application can run without the need for server side code.

Anyways, back to the subject on hand. My goal with implementing ideas from Continuous Integration in Flex I am so far using the following:

  • Maven - for keeping control of dependencies and for full compilation of everything and deployment of the application with one command
  • Fluint (similar to FlexUnit) - unit testing of Flex code
  • FlexCover - code coverage
  • SVN - for source control
  • Trac - for keeping track of issues
  • Of course this application will also have a backend and the great thing with Maven is that it can compile both the frontend and the backend.

    Mac and MySQL problems

    September 11th, 2008

    I have XAMPP installed for easy deployment of PHP applications.

    I ran into a problem when trying the Akelos PHP framework. When creating a new application I got the following error:

    Can’t connect to local MySQL server through socket ‘/Applications/xampp/xamppfiles/var/mysql/mysql.sock’

    To solve this I had to do the following:

    cd /var
    sudo mkdir mysql
    sudo ln -s /Applications/xampp/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
    sudo killall mysqld
    sudo ./mampp start

    Which links the mysql socket to the Xampp installation and kills the instance of the mysql running before launching xampp.

    Simple database manager for Mac

    September 11th, 2008

    Just a good link to a great small application to manage your databases on a Mac.

    Sequel Pro is open source and free to use.

    Don’t forget to add the correct path to mysql.sock when connecting to your local databases. In my case it was located here: /Applications/xampp/xamppfiles/var/mysql/mysql.sock

    Hey Mate

    September 8th, 2008

    Lately I have tested frameworks for Flex/Flash development.

    I started out porting a project management application from my old Flash MVC implementation to a PureMVC Flex implementation. I liked the decoupling and use of Events that PureMVC promotes, but still think that it is a little cumbersome to use and requires too many classes.

    I continued my testing by using Cairngorm to build a small money management application. It fast became clear to me that I preferred the PureMVC framework.

    Currently I am analyzing Mate and my first impressions are VERY good. I love the way it uses IoC and the completely decoupled view from the controller. It is by far the least intrusive framework I have seen.

    I highly recommend taking a look at this presentation of Mate:

    Grails will be my “silver bullet” for now

    August 26th, 2008

    Yes, I know. There exist no silver bullet technology/framework that will solve all our problems in a easy, agile, scalable, maintainable and just downright perfect way. But for now Grails is for me “”The search is over”.

    More than the “coding by convention”, MVC framework, etc., the important arguments for me:
    - open-source
    - based on Java
    - scaffolding for rapid development
    - easily integration with both Hibernate and Spring
    - integration with Flex (through REST or Blazeds/Livecycle)

    So, my first Grails application is almost done and will be featured shortly..

    P.S. The search is only over until the next breakthrough in rapid web development framework appears..

    Technologies, oh so many technologies..

    August 21st, 2008

    In the last weeks I have been studying a lot of the latest frameworks and technologies for rapid web development, while staying close to the technologies I command and like.

    After a couple of days I was swimming in a number of different things I wanted to learn, or at least get up to date with. To avoid drowning I needed an overview and to start focusing. So I started laying out the things I wanted to master, trying to make sure I covered the areas I wanted to cover:

    Front-end: Flash/Flex, HTML and AJAX
    Back-end: Java, PHP

    Basically, PHP is a scripting language that I have come to like, for the easy rapid development. But I also need Java for serious applications and proper organized solutions.

    Anyways, I came up with the following diagram (obviously subject to change).

    Technology overview

    Technology overview

    Getting Flash trace output on Mac

    August 19th, 2008

    1. Install Flash debug player

    2. Edit mm.cfg

    For example:

    ErrorReportingEnable=1
    TraceOutputFileEnable=1
    MaxWarnings=500

    TraceOutputFileName=Users:Macintosh HD:kimhansen:Desktop:flashlog.txt

    (Note: the traceOutputFileName doesn’t work for me..yet)

    So I use:

    tail -f /Users/kimhansen/Library/Preferences/Macromedia/Flash\ Player/Logs/flashlog.txt

    which works

    PureMVC -> Cairngorm

    August 9th, 2008

    Well, I have just finished implementing a relatively big project using PureMVC and now Adobe launches full support for Cairngorm.

    I guess I jumped on the wrong horse, as there now are advantages with Cairngorm over PureMVC that are too strong:

    Investment for the future - companies will look for Cairngorm developers, not PureMVC developers.

    Full support from Adobe, means a flood of tutorials, serious testing of framework, big real life implementations, etc. etc.

    Flex documentation

    July 30th, 2008

    Having started learning Flex the last couple of weeks, I am impressed by the sheer amount of information available.

    I will keep a list of the most useful things for my own reference here:

    Adobe Developer Connection

    Adobe video training

    Flex.org

    Flex Examples

    Adobe Labs - Flex

    FlexUnit

    Flex 3 Style Explorer