agile

Agile usually refers to an entity that possesses agility. read more at WikiPedia

  • Agile Product Ownership in a Nutshell

    This is basically a 1 day product ownership course compressed into 15 minute animated presentation. There's obviously more to product ownership than this, so see this is a high level summary.

    This gives a really great overview of Agile using simple-to-understand language! I like like this video a lot. Enjoy

    Download the complete drawing here:
    https://dl.dropbox.com/u/1018963/Arti...
    Downloadable version of the video here:
    https://dl.dropbox.com/u/1018963/Vide.

  • Agile Scrum anti patterns

    Really worth reading if you are experiencing Agile Scrum development.

    800px-Scrum_process.svg 

    I do think AGILE and SCRUM has its place.  It is just that I believe this place is running projects under 5 people and delivery durations of less than 6 months. At that level, employing the right people with the right skills and motivation frequently guarantees that MAGIC will occur. The new media industry proves this everyday, irrespective of approach /method used. Good people always have the potential to overcome deficiencies with methods /approaches and poor management. I have seen it time and time again.

    From AGILE /SCRUM Fails to get to grips with Human Psychology.
    Posted by Kevin Brady on Thu 17th August 2006 at 03:10 PM, Filed in Software Dev Methodologies,  Key Articles

    This is what I would call 

    anti patterns for Scrum

    I think you can learn a lot more from these anti scrum pattern failures than from success stories. The path to success is narrower than you may think!, and you can be on a parallel road leading to a failure. Take also time to read all the comments, some are really interesting.

    What is the most interesting is this article was written in 2006!

    AGILE /SCRUM Fails to get to grips with Human Psychology.

  • Agile Testing Poster

    Agile testing is a software testing practice that follows the principles of agile software development. Agile testing is built upon the philosophy that testers need to adapt to rapid deployment cycles and changes in testing patterns. Providing and getting feedback early, fast and regularly is one of the testers main task.

    AgileTestingPoster

    From http://bbv.ch/images/bbv/pdf/downloads/poster/bbv12_poster_agile_testing_1.0_web.pdf

    You can order a print version at http://www.bbv.ch/de/posterbestellung.html

    Find more at http://bbv.ch/de/unternehmen/publikationen.html

  • Atlassian just acquired GreenHopper

    greenhoppertaskboard

    Atlassian just acquired GreenHopper, a popular JIRA plugin with over 800 customers.

    GreenHopper is a JIRA plug-in that adds a broad collection of agile project management capabilities to JIRA, and extends JIRA as a powerful platform for agile development teams. GreenHopper simplifies the planning and organization of tasks, workflows and reporting for agile teams.

    It introduce in JIRA

    • Card management:  Visualise issues, tasks and user stories as graphical "cards", color-coded and dynamically editable.

    • Planning Board: Quickly create, assemble, sort and prioritize project tasks with drag-and-drop simplicity.

    • Task Board: Track progress through simple, graphical views of remaining tasks across projects and teams.

    • Chart Board: Customizable dashboard, dynamic burn down and burn up charts.

    Learn all about GreenHopper at www.atlassian.com/greenhopper. Unfortunately it is not a free extension… ($700 to $1150 to add to JIRA)

  • Avoid infamous change - restart - wait - check development lifecycle!

    Stop waiting for build & deploy make code changes. Write code and refresh your browser!

    Use DCEVM and add java fields, methods, classes and use them without restarting your application server, it's a modification of the HotSpot VM that allows unlimited class redefinition at run-time. You can add/remove fields and methods and change the super types of a class at run-time. The features of DCEVM are likely to be integrated in a future update of Java 8 as part of JEP 159.

    View code changes instantly and increases team velocity!

              DCEVM                  JVM Hot Swap         
    Changes to method bodies  yes yes
    Adding/removing Methods  yes  no
    Adding/removing constructors  yes  no
    Adding/removing fields  yes  no
    Adding/removing classes  yes  no
    Adding/removing annotations  yes  no
    Changing static field value  yes  no
    Adding/removing enum values  yes  no
    Modifying interfaces  yes  no
    Replacing superclass  yes  no
    Adding/removing implemented interfaces  no  no
    Initializes new instance fields  yes  no

     

  • Better readability of source code

    I just activated the mambots Geshi (standard in Mambo 4.5.2 ) on my Homepage, now all code in my pages (between <pre> and </pre> ) will be automaticaly highlighted and colored. More than 38 languages are now supported on my homepage!

    actionscript - ada - apache - asm - asp - bash - c - c_mac - caddcl - cadlisp - cpp - csharp - css - delphi - html4strict - java - javascript - lisp - lua - mpasm - nsis - objc - oobas - oracle8 - pascal - perl - php-brief - php - python - qbasic - smarty - sql - vb - vbnet - visualfoxpro - xml

    I will post later post an update for Mambo 4.5.2, instead of Geshi 1.0.4 You will soon be able to use Geshi 1.0.7 and an extended Mambot for Your personal use.

    Enjoy ;-)

    private long startStatistics() {
    		long before = System.currentTimeMillis();
    		if (logger.isDebugEnabled()) {
    			logger.debug("Start conversion " );
    		}
    		return before;
    	}
    
    
  • Checkstyle

    Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard.
    It automates the process of checking Java code to spare humans of this boring (but important) task. This
    makes it ideal for projects that want to enforce a coding standard. Checkstyle is highly configurable and can
    be made to support almost any coding standard. An example configuration file is supplied supporting the
    Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions.

    From http://checkstyle.sourceforge.net/

    Some facts about checkstyle:

    Languages

     
    Java 71%
     
    XML 26%
     
    Other  
      XSL Transformation 2%
      CSS 1%
      HTML <1%
      Emacs Lisp <1%
      MetaFont <1%

    Project Cost

    This calculator estimates how much it would cost to hire a team to write this project from scratch.
    Include
    Codebase 68,028 LOC
    Effort (est.) 16 Person Years
    Avg. Salary $/year
    $897,876
  • Code generation from XSD with JAXB and Maven

    apache_maven

    What you will learn in this small post

    • How to create JAXB proxies at build time using maven-jaxb2-plugin in a continuous build environment (TeamCity / Bamboo)
    • How to generate from an XSD file (XML-Schema-Definitions) Java code.

    Requirements

    • We will use JAXB2 (see JSR 222 and JAXB 2.x).
    • We use Maven 2.2.1, the latest available version

    Settings things up

    The only difficulties is to add to your Maven proxy (Archiva, artifactory) the Maven repository of Sun. The example below use an inline repositories definition in pom.xml. So it work out of the box.

    <repositories>
        <repository>
          <id>maven2-repository.dev.java.net</id>
          <name>Java.net Maven 2 Repository</name>
          <url>http://download.java.net/maven/2</url>
        </repository>
      </repositories>

    and the special Sun Maven plugin repository

      <pluginRepositories>
        <pluginRepository>
          <id>maven2-repository.dev.java.net</id>
          <url>http://download.java.net/maven/2</url>
        </pluginRepository>
      </pluginRepositories>

    Here is how your pom should look like

    <project 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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.waltercedric.maven.examples</groupId>
      <artifactId>jaxb</artifactId>
      <version>0.1.0-SNAPSHOT</version>
      <packaging>jar</packaging>
      <name>jaxb</name>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.7.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.6</source>
              <target>1.6</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.sun.xml.bind</groupId>
          <artifactId>jaxb-impl</artifactId>
          <version>2.1.12</version>
        </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.7</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <repositories>
        <repository>
          <id>maven2-repository.dev.java.net</id>
          <name>Java.net Maven 2 Repository</name>
          <url>http://download.java.net/maven/2</url>
        </repository>
      </repositories>  
    <pluginRepositories> <pluginRepository> <id>maven2-repository.dev.java.net</id> <name>Java.net Maven 2 Repository</name> <url>http://download.java.net/maven/2</url> </pluginRepository> </pluginRepositories>
    </
    project>

    All you have to do now is to place your XSD shema in src/main/resources and run mvn package

    The JAXB proxies will be created in target\generated-sources\xjc\generated so you can use them in src/main/java and src/test/java

  • Continuous Build for Joomla

    Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. This article is a quick overview of Continuous Integration summarizing the technique and its current usage. Martin Fowler about continuous integration

    Things get clearer in my mind...I will use a set of Open Sources software to reach this ambitious goal.

    Brainstorming

    Maintain a Single Source Repository.

    Either Subversion running locally on windows/Linux, but I will stay with www.joomlaCode.org at the beginning

    Automate the Build

    • I am currently evaluation Maven for PHP but already have ANT script to build components and plugin for Joomla 1.5 (they are not generic enough at the moment)

    Make Your Build Self-Testing

    • PHP UNIT tests if available with be run at this stage using PHP command line.
    • Seleniumto automate components testing across many platforms, as it runs in many browsers and operating systems, and can be controlled by many programming languages and testing frameworks.
    • Some standard utilities to perform standard Joomla! processes: login, logout for Apache ANT or Selenium
    • I will develop either a ANT plugin or a set of Selenium test cases for deploying and removing
      • component: install, publish, remove
      • plugin: install, publish, remove
    • All these utilities will be available under GPL v3 and as such free to reuse, and improve.

    Everyone Commits Every Day

    • This is reserved to developer having a www.joomlaCode.org account and part of the development team.

    Every Commit Should Build the Mainline on an Integration Machine

    I will use TeamCity continuous build server as it is free for personal use (limited to 20 concurrent build), run on Windows and Linux but require a java VM to run (may not be wanted in a PHP environment). Anyway with ANT, it will be possible to use another build server like Cruise Control or PHP Under Control.

    Keep the Build Fast

    That is an objective :-)

    Test in a Clone of the Production Environment

    Joomla! Build farm

    • I can imagine a set of Joomla instances, ideally 5 of each version, aka Joomla! 1.5.3 to Joomla! 1.5.8 and Joomla! 1.0.10 to 1.0.15
    • Joomla instances will be recreated at build time (files and databases), that mean Joomla! will get newly installed and removed in case of successful build
    • All Joomla! instances will be running with XAMPP, ideally on port not available to the outside world for security reasons

    Make it Easy for Anyone to Get the Latest Executable

    Successful build (Artifacts) are only available if build is successful. Team City provide this with less effort (configuration)

    Everyone can see what's happening

    • A guest account will be available or a free public area with limited access to see the result of builds.
    • RSS feeds, emails and Instant messaging (Jabber) out of the box for end users or developers!

    Automate Deployment

    That will be, auto publish to some demo site in a configurable way. At the moment, at http://demo.waltercedric.com and http://demo2.waltercedric.com for me :-)

    Final words

    • I will provide a ready to use package for Windows and Linux and all scripts, so anybody will be able to run it also on your own.
    • Critical part will be documented in my WIKI at http://wiki.waltercedric.com direct link HERE

    It seem that nobody is providing such a package as I am after only one day at the top of search results in Google "continuous build joomla"

  • Continuous build for Joomla! part1/x

    Automatic installation of Joomla! runtime environments

    Main ideas

    Build is scalable

    Distributed build management optimize hardware resources utilization by parallelizing product builds within the build agents grid. With build chains support, it is even possible to break down a single build procedure into several parts to run them on different build agents — both in sequence and in parallel — using the same set of sources in all of them.

    I want to be able to test my components against many versions of Joomla!

    All versions of Joomla! are in subversion as zip files in an own SVN repository

    For example:

    • ${JOOMLA15_VCS_ROOT}  is svn:\\localhost\joomla1.5\trunk
    • ${JOOMLA10_VCS_ROOT}  is svn:\\localhost\joomla1.0\trunk

    These repository ${JOOMLAxx_VCS_ROOT} are connected to all build as supplementary VCS root in TeamCity and thus content get checked out as part of the build in the build temporary directory of one agent. ($AGENT_BUILD_DIR)

    joomla1.5\trunk
                                Joomla_1.5.4-Stable-Full_Package.zip
                                Joomla_1.5.5-Stable-Full_Package.zip
                                Joomla_1.5.6-Stable-Full_Package.zip
                                Joomla_1.5.7-Stable-Full_Package.zip
                                Joomla_1.5.8-Stable-Full_Package.zip

    So after the checkout, the file system will look like

    ($AGENT_BUILD_DIR)\                     

                                     Joomla_1.5.4-Stable-Full_Package.zip
                                Joomla_1.5.5-Stable-Full_Package.zip
                                Joomla_1.5.6-Stable-Full_Package.zip
                                Joomla_1.5.7-Stable-Full_Package.zip
                                Joomla_1.5.8-Stable-Full_Package.zip

    If you don't want to provide support a a specific version of Joomla! just remove it from the trunk! or add new ones on purpose. That's easy.

    Ant tasks/Maven MOJO

    • Are responsible for unpacking all these zip files to the build temporary agent directory. ($AGENT_BUILD_DIR).
    • Filenames are found with a configurable regular expression,
    • All settings will be committed in \joomla1.5\trunk\build.deploy.properties

    Another ant script/task will for each zip,

    • Start a Selenium test cases that will create a virtual user that use the regular Joomla! installer and drive installation till the end.
    • All settings which have to be Joomla! and build independent will be randomly generated, preferably UUID for password and database name for example.
    • Login and Admin password may be the same (admin:admin) at the beginning but can also be generated and written to a file on disk in ($BUILD_DIR)/{joomlarootversion}/build.install.properties.
    • Directory installation ($BUILD_DIR)/{joomlarootversion}/installation will be renamed to ($BUILD_DIR)/{joomlarootversion}/installation.old or simply deleted
    • Selenium/PHP Unit test that are committed in \joomla1.5\trunk\Installation.Checks will perform basic checks (login, logout, navigate) to ensure that installation of Joomla! has been successful.
      If everything succeed, we will have a set of Joomla! versions ready for our components regression testing.

    Remarks:

    • No build temporary directory. ($AGENT_BUILD_DIR) will be deleted by Ant or Maven but by the build server itself. This will let developer look at the issues on file system and in database.
    • New scripts may be developed to extract from the build server or Joomla! farm easily the non running Joomla! instance files + database) so developers can install the broken setup locally.

    Automatic deployment of Joomla! components

    Your component is typically shared and many developer committed regularly in a different VCS root... For SecurityImages 5.x.y, subversion root may be  svn:\\localhost\securityimages5\trunk

    This VCS root is also attached to the build and get check out at build time by TeamCity.

    Packaging

    if a build.xml is present in {VCS_ROOT}\build.xml then it is executed prior to any further operations, purpose of build.xml is to produce a component binary distribution (zip or tar.gz) that can be then installed to ALL Joomla install in the agent root directory.

    Deployment

    if a deploy.xml is present in {VCS_ROOT}\deploy.xml then it is executed, purpose of deploy.xml is to deploy one or many component binary distribution (zip or tar.gz) to ALL Joomla install in the agent root directory.

    Why one or many component?

    I want to be able to track also component dependencies issues.

    Lets say that SecurityImages does not play well with VirtueMart, I may want to test also that combination across Joomla! instances, that's why VirtueMart may have to be deployed with SecurityImages or not.

    prerequisites:

    • Running SVN server, see HERE for installing it on windows
    • Installed JVM, latest JDK 1.6u10
    • Running TeamCity server
    • Running XAMPP with HTTP root directory at TeamCity agent root directory.
    • Apache ANT with additional library for more control (if, case, for loop)

    This articles will be available in my WIKI soon http://wiki.waltercedric.com/index.php?title=ContinuousBuildforJoomla so any reader or developer can participate to the discussion, next step is to implement the above and that will e documented as well :-)

  • Continuous build of Apache projects

    Apache foundation is using Hudson for continuous build (and also JBOSS)

    Hudson monitors executions of repeated jobs, such as building a software project or jobs run by cron.
    Among those things, current Hudson focuses on the following two jobs:

    1. Building/testing software projects continuously, just like CruiseControl or DamageControl.
      In a nutshell, Hudson provides an easy-to-use so-called continuous integration system,
      making it easier for developers to integrate changes to the project, and making it easier
      for users to obtain a fresh build. The automated, continuous build increases the productivity.
    2. Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those
      that are run on a remote machine. For example, with cron, all you receive is regular e-mails that
      capture the output, and it is up to you to look at them diligently and notice when it broke.
      Hudson keeps those outputs and makes it easy for you to notice when something is wrong.

    This is a public build and test server for various Apache Projects.

     


     

    An Eclipse plugin is also available the online WIKI is HERE

    If you are shopping for a build server, and you are not on a budget, I can recommend you the
    excellent Team City from JetBrains. Maven integration is also good, but wont probably never reach the level
    of Hudson as it is made by Apache and tailored for their frameworks needs.

  • Continuous build server for Joomla!

    continuous.server.toolbox.for.php Starting from now on, in order to

    • Increase quality of my components and other (JoomlaComment :-))
    • Reduce time between releases,
    • Avoid subtle or recurrent issues

    I will set up a continuous integration  build server at 

    http://continuousbuildserver.waltercedric.com

    Continuous integration describes a set of software engineering practices that speed up the delivery of software by decreasing integration times.

    • Maintain a code repository, the code will stay at JoomlaCode.org subversion
    • Automate the build, with Maven for PHP/Ant and either teamcity or phpundercontrol.org
    • Make my build self-testing with PHP Unit and Selenium IDE
    • Everyone commits every day,
    • Every commit (to mainline) will be built with the help of triggers,
    • The build will be fast,
    • Test are done in production environment, by deploying code to  old and new version of Joomla! 1.0 and 1.5 "not web accessible" (for obvious security reasons),
    • It will be easy to get the latest deliverables by visiting http://continuousbuildserver.waltercedric.com
    • Everyone will see the results of the latest build by visiting http://continuousbuildserver.waltercedric.com
    • Deliverables will be automatically deployed.

    In short (for all non developer), this program will

    • Monitor any changes of code
    • Trigger a build,
    • Deploy the build to different versions of Joomla! 1.5 (5 versions should be enough)
    • Run a set of tests against these Joomla! versions and
    • Make the result available to all of you.

    Soon as there is enough test cases, it will be safe to download any new release from there.

  • Continuous build with Apache Maven

    apache_maven

    Maven is a software tool for Java project management and build automation created by Jason van Zyl in 2002. It is similar in functionality to the Apache Ant tool (and to a lesser extent, PHP's PEAR and Perl's CPAN), but has a simpler build configuration model, based on an XML format. Maven is hosted by the Apache Software Foundation, where it was formerly part of the Jakarta Project.

    Maven uses a construct known as a Project Object Model (POM) to describe the software project
    being built, its dependencies on other external modules and components, and the build order.
    It comes with pre-defined targets for performing certain well defined tasks such as compilation
    of code and its packaging.

    A key feature of Maven is that it is network-ready.The core engine can dynamically download
    plug-ins from a repository
    , the same repository that provides access to many versions of different
    Open Source Java projects, from Apache and other organizations and developers. This repository
    and its reorganized successor, the Maven 2 repository, strives to be the de facto distribution
    mechanism for Java applications, but its adoption has been slow. Mavenprovides built in support
    not just for retrieving files from this repository, but to upload artifacts at the end of the build.
    A local cache of downloaded artifacts acts as the primary means of synchronizing the output of
    projects on a local system.

    Mavenis based on a plugin-based architecture that allows it to make use of any application
    controllable through standard input. Theoretically, this would allow anyone to write plugins to
    interface with build tools (compilers, unit test tools, etc.) for any other language.
    from WikiPedia

  • Continuous integration server Bamboo up and running

    atlassian.bamboo.logo My Bamboo continuous integration server is now fully functional and available at  http://bamboo.waltercedric.com/

     

     

     

    Remember Atlassian is providing free license for Open Source Projects:

    Atlassian supports and believes in the Open Source movement -Bamboo utilizes a number of good Open Source components, and Atlassian developers are committers on a large number of Open Source projects.

    To give back to the open source community (and hopefully improve the quality of those projects!),Bamboo is free for any Open Source project to use.

    There are a few requirements for an Open Source license, the main ones being:

    • Established code base
    • Publicly available project website
    • Using an approved open source license
    • YourBamboo instance will be publicly accessible

    My objective is to make Joomla! and all my projects also running in Bamboo (not only in TeamCity as the limit of 20 builds will be rapidly reached)

    Visit it by clicking on the picture

    Very quick Bamboo install how to

    Install a fresh Tomcat 6 runtime,

    Move the war into the ROOT web context of tomcat

    Choose free port for HTTP, AJP, and Tomcat server port  in conf/server.xml

    <Server port="8050" shutdown="SHUTDOWN">
    
    <Connector port="8051" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443"
               enableLookup="false"         
               useBodyEncodingForURI="true" 
    
    <Connector port="8030" protocol="AJP/1.3" redirectPort="8443" />

    Copy mysqldriver.jar into /lib

    Configure the data source into server.xml

    <Host name="localhost"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
            <Resource name="jdbc/BambooDS" auth="Container" type="javax.sql.DataSource"
                username="user"
                password="pwd"
                driverClassName="com.mysql.jdbc.Driver"            
                url="jdbc:mysql://localhost/schema?autoReconnect=true"            
                maxActive="20"
                validationQuery="select 1" />

    Edit /etc/apache/worker.properties

    worker.list=ajp13, teamcity, jira, bamboo
    worker.bamboo.port=8030
    worker.bamboo.host=localhost
    worker.bamboo.type=ajp13

     

    Create a vhost.conf in the subdomains

    # vi /srv/www/vhosts/waltercedric.com/subdomains/bamboo/conf/vhost.conf

    ServerName bamboo.waltercedric.com
    
    ProxyPass /  ajp://bamboo.waltercedric.com:8030/
    <Proxy *>
       Order Allow,Deny
       Allow from all
    </Proxy>
    
    <Directory />
      Options FollowSymLinks
      AllowOverride None
    </Directory>

    To tell plesk to include an overridden vhost.conf, run

    # /usr/local/psa/admin/sbin/websrvmng

    Restart Apache2

    rcapache2 restart

  • ContinuousBuild4Joomla project submitted to JoomlaCode.org

    I will commit soon a first draft (alpha) of what is expected to bring continuous build to any Joomla! component (or event to Joomla! core itself ;-))

    You are free to join the project, all documentation effort stay at the moment in my WIKI

     

  • Defunct Scrum - A collection of everything wrong with Scrum.

    Scrum is an iterative, incremental framework for project management and agile software development.
    Although Scrum was intended for management of software development projects, it can be used to run software maintenance teams, or as a general project/program management approach.

    And now visit the funny Scrum cartoons

    Scrumtoon33 

    Scrumtoon31

    http://defunctscrum.blogspot.com/

    And there is a lot more HERE :-)

  • Deploy to Tomcat 6 using Maven

    apache_maven

     cargo-banner-left
    A ready to use example on how you can deploy your web application to a Tomcat 6 container using Maven Cargo. Cargo is a thin wrapper that allows you to manipulate Java EE containers in a standard way. 

    Cargo provides the following Tools and APIs:

    • A Java API to start/stop/configure Java Containers and deploy modules into them.
    • A Java API to parse/create/merge Java EE Modules
    • Ant tasks, Maven 1, Maven 2 plugins.
    • Intellij IDEA and Netbeans plugins are in the sandbox.

    First you have to decide if your tomcat server run locally or remotely as this influence the way you’ll configure your pom.xml

    Below is an example of a standard architecture

    |---MyApplication
    |           |- ear       (ear)
    |           |- service (jar)
    |           |- client    (jar)
    |           |- web      (war)
    |           |- integration (jar)

    The most interesting Maven module, which will be the subject of this article, and the next one is describing how to automate the deployment of a war to Tomcat and later on running integration tests using Selenium.

    'Integration testing'  is the activity of software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before system testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing. [WikiPedia]

    Deploying to Tomcat running locally

    Locally mean running on your development machine, at localhost 8080 or on any other port. Maven has the concept of a 'phase' which can be thought of a collection of goals. Hence here we are specifying that during the
    ’pre-integration-test’ phase first deploy the web app to the container specific folder and then start the container. Both 'deployer-deploy' and 'start' are cargo specific goals. The code below is already ready for integration testing!

    <!—Example of Configuration –>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <wait>true</wait>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>installed</type>
                        <home>${catalina.home}</home>
                    </container>
                    <configuration>
                        <type>existing</type> 
                        <home>${catalina.home}</home>
                    <properties>
                            <cargo.tomcat.manager.url>https://yourhost/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>ManagerAdminLogin</cargo.remote.username>
                            <cargo.remote.password>ManagerAdminPassword</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>installed</type>
                        <deployables>
                            <deployable>
                                <groupId>com.waltercedric</groupId>
                                <artifactId>myapplication-web</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                            <!--  Only local containers can be started 
                            <goal>start</goal>
                            -->
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                            <!--  Only local containers can be started 
                            <goal>stop</goal>
                            -->
                        </goals>
                    </execution>
                    <execution>
                        <id>verify-deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution> 
                    <execution>
                        <id>clean-undeploy</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                            <!--  Only local containers can be started 
                            <goal>stop</goal>
                            -->
                        </goals>
                    </execution> 
    
                </executions>
            </plugin>
        </plugins>
    </build>

    Deploying to Tomcat running remotely

    The code slightly change:

    • You can NOT start and stop Tomcat running remotely, only deploy and un deploy your web application
    • ‘installed’ is replaced by ‘remote’
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <configuration>
                    <wait>true</wait>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>remote</type> 
                        <properties>
                            <cargo.tomcat.manager.url>https://yourhost/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>ManagerAdminLogin</cargo.remote.username>
                            <cargo.remote.password>ManagerAdminPassword</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>installed</type>
                        <deployables>
                            <deployable>
                                <groupId>com.waltercedric</groupId>
                                <artifactId>myapplication-web</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify-deploy</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution> 
                    <execution>
                        <id>clean-undeploy</id>
                        <phase>pre-clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution> 
                </executions>
            </plugin>
        </plugins>
    </build>

    If you don’t want to let cargo deploy your web application artefact under the default name myapplication-web-0.0.1.SNAPSHOT.war, you can add the following to the deployable section of cargo

    <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <configuration>
            <deployer>
                <deployables>
                    <deployable>
                        <properties>
                            <context>mywebapp</context>
                        </properties>
                    </deployable>
                </deployables>
            </deployer>
        </configuration>
    </plugin>

    So you’ll be able to access your web application with http://localhost/mywebapp instead of http://localhost/myapplication-web-0.0.1.SNAPSHOT

    From now on, any phase higher than ’pre-integration-test’ will trigger the deployment to your web application to any tomcat, jboss or weblogic container. As a reminder, here are the major phase of Maven, You can put many of them just separate by a space in run as - goals

    • validate - validate the project is correct and all necessary information is available
    • generate-sources - generate any source code for inclusion in compilation
    • process-sources - process the source code, for example to filter any values
    • generate-resources - generate resources for inclusion in the package
    • process-resources - copy and process the resources into the destination directory, ready for packaging
    • compile - compile the source code of the project
    • process-classes - post-process the generated files from compilation, for example to do byte code enhancement on Java classes
    • generate-test-sources - generate any test source code for inclusion in compilation
    • process-test-sources - process the test source code, for example to filter any values
    • generate-test-resources - create resources for testing
    • process-test-resources - copy and process the resources into the test destination directory
    • test-compile - compile the test source code into the test destination directory
    • test - run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed
    • prepare-package - perform any operations necessary to prepare a package before the actual packaging.
    • package - take the compiled code and package it in its distributable format, such as a JAR
    • pre-integration-test - perform actions required before integration tests are executed. This may involve things such as setting up the required environment
    • integration-test - process and deploy the package if necessary into an environment where integration tests can be run
    • post-integration-test - perform actions required after integration tests have been executed. This may including cleaning up the environment
    • verify - run any checks to verify the package is valid and meets quality criteria
    • install - install the package into the local repository, for use as a dependency in other projects locally
    • deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects

    I recommend you also to use:

    • Maven profiles (triggered by environment, Linux, Windows, DEV, TEST, PROD)
    • Key value pair for sensitive data (login, password)
    • Key value pair for contextual data (URL’s of management console)

    All of these data can be saved in your Maven settings.xml or given by system variables at build time.

  • Development shift in the way I deliver my latest Joomla! extensions

    agile.development

     

    Starting from now on, I will deliver all my latest (unstable) extensions versions through  my continuous build server. All request or bugs discovery that are requested in my forums and solved will lead to a new build that you will be able to download a lot faster than before.

    Thanks to Maven for PHP, I can now commit, 60 seconds later, unit test run and  the result is a direct download for my extensions snapshots.

     

     

     

     

     

     

    Here is an example with the module mod_related_thumb_items

    Head to http://teamcity.waltercedric.com/teamcity/guestLogin.html?guest=1

    Locate the module or component you are interested in:

    HowTODownloadLatest

    Click on the latest build, must be  Success

    HowTODownloadLatest.01  

    If this build is a direct answer to a support request in my forums, or solve an issue, You should be able to see in changes the commit description, and even which file have been changed after and before the commit.

    http://teamcity.waltercedric.com/teamcity/viewLog.html?buildId=217&buildTypeId=bt3&tab=buildChangesDiv

    HowTODownloadLatest.05

    But Hey! you want to download this latest build now, go to artifact

    HowTODownloadLatest.02

    Staying  on the edge by using RSS

    You can monitor any build by using the RSS icon in your browser toolbar, or example with this module, it would be

    http://teamcity.waltercedric.com/guestAuth/feed.html?buildTypeId=bt20&itemsType=builds&userKey=guest

    This way of downloading the latest extensions do not replace the page http://www.waltercedric.com/joomla-releases-mainmenu-269.html where there is there only stable versions.

    The next step is to make the maven phase “site” work (I have issue with phpdocumentor not found), this will create automatically a internet site in one of my sub-domains ad hide this complexity.

  • Getting started with test-driven development

    In this article, an excerpt from Test-Driven Development: A J2EE Example (Apress, 2004), author Thomas Hammell helps you select the right tools for getting started with test-driven development (TDD)
    ...
    Following the Keep It Simple, Stupid (KISS) and You Aren't Gonna Need It (YAGNI) rules of extreme programming (XP), each tool listed in the following sections fits into the TDD process...
    more Here
  • git-branch-renamer-maven-plugin

    When working with many feature/release/bugix/hotfix branches, it is a bad idea to start changing the pom version as this will create merge conflicts using pull request. this plugin allow you to keep in ALL branches the same pom version for all your projects, for example MASTER-SNAPSHOT the version will be derived from branch name automagically :-)

    You may want to read more first these 2 short articles

    git-branch-renamer-maven-plugin allow you to keep in ALL branches the same pom version for all your projects: for example MASTER-SNAPSHOT and never change it again.

    the project version will be derived from branch name automatically when running in your continuous integration server.

    branch name feature/xxxx

    • <version>xxxx-SNAPSHOT</version> (default)
    • <version>xxxx</version> (release = true)
    • <version>0-xxxx-SNAPSHOT</version> (forceNumericalVersion = true)
    • <version>feature-xxxx-SNAPSHOT</version> (filterOutBranchQualifier = false)

    The project is hosted at Github https://github.com/cedricwalter/git-branch-renamer-maven-plugin 

  • Kent Beck

    Kent Beck "I'm not a great programmer; I'm just a good programmer with great habits." 
  • List conflicting dependencies in the Maven reactor

    apache_maven

    The Maven Dependency Plugin among other things include a dependency:analyze-duplicate

    The dependency plugin provides the capability to manipulate artifacts. It can copy and/or unpack artifacts from local or remote repositories to a specified location.

    This Apache Maven plugin is really feature rich and provide a lot of interesting goals:

  • List of interesting Maven 2 repositories

    apache_maven

    I compiled here a list of the major Apache Maven repositories (read an intro to repositories) for You, You can contact me, or post a comment if you would like to add a missing one to the list.

    And of course mine at http://maven.waltercedric.com

  • Maven and Selenium for integration testing

     apache_maven

    'Integration testing' (sometimes called Integration and Testing, abbreviated I&T) is the activityof software testing in which individual software modules are combined and tested as a group. It occurs after unit testing and before system testing. Integration testing takes as its input modules that have been unit tested, groups them in larger aggregates, applies tests defined in an integration test plan to those aggregates, and delivers as its output the integrated system ready for system testing. [WikiPedia]

     

    I will put Selenium to that JOB. Selenium will allow me to run a set of unit test against a running instance of my application and get a feedback on the quality before delivering the software to a testing team.

    Making any Maven module Selenium enable is really easy, all you have to do is to add to the dependencies section the following

    <dependency>
        <groupId>org.openqa.selenium.client-drivers</groupId>
        <artifactId>selenium-java-client-driver</artifactId>
        <version>0.9.2</version>
        <scope>test</scope>
    </dependency>

    Now you should be able to cut and paste any test cases developed with Selenium IDE into /src/test/java/

    Selenium IDE is a Firefox add-on that records clicks, typing, and other actions to make a test, which you can play back in the browser or export to may different languages: Ruby, Python, Java, PHP, Perl, .Net, JavaScript to name a few. [Learn more]

    The java code is in no way different than regular JUNIT test cases, except that it does not use the latest JUNIT 4.x annotations. You’ll be able to run tests like before (right click Run As Junit)

    package com.waltercedric.maven;
    
    import com.thoughtworks.selenium.SeleneseTestCase; 
    
    public class TestHello extends SeleneseTestCase {
    
      public void setUp() throws Exception {
        setUp(http://localhost/helloworld, "*iexplore");
      }
    
      public void testNew() throws Exception {
        selenium.open("/helloworld/index.xhtml");
        selenium.waitForPageToLoad("30000");
    verifyTrue(selenium.isTextPresent("Are you an existing Customer")); } }

    Some explanations are needed:

    •  
      •  
    • http://localhost/helloworld is the URL of my tomcat container where my web applications will be deployed (port 80)
    • I choose internet explorer as browser as it is nearly always available on any windows pc, Firefox is not far away, use “*firefox” and  firefox.exe has to be in the environment PATH.
    • The Code above assume that a selenium RC server is running at localhost on port 4444, I will show you how to start one later in this post.

    Some remarks about the code above

    You will have to somehow make your own Selenium framework out of the generated code, for obvious reasons,

    • You’ll have soon to support many browser "*iexplore", "*firefox", "*opera" and as such use environment variables or configuration files. I recommend you in that case to use Selenium Grid instead of Selenium RC.
    • You can not let the URL and port of the container fix coded http://localhost/helloworld, this URL may change if you target different runtime. 
    • You may want to reuse some part of the generated code multiple times, in different unit test, (like login/logout stuff), java inheritance, interface, and patterns may arrive sooner or later, even if this is unit test code.

    Selenium test cases or integration tests are meant to be run in phase “integration-test” against a running instance of your application. That is why don’t forget to deploy your application with Maven cargo or run it inside Jetty in Maven phase “pre-integration-test”

    How to use Surefire to run JUnit test in phase “test” and integration tests in phase “integration-test”

    The response is by carefully configuring Surefire and naming your Java packages. The pom.xml below show this trick

    In phase test, test cases with a word integration or selenium are omitted, while in phase “integration-test” they are run.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4.2</version>
        <configuration>
            <argLine> -Xmx512m -DuseSystemClassLoader=true</argLine>
            <skip>false</skip>
            <testFailureIgnore>true</testFailureIgnore>
            <excludes>
                <exclude>**/integration/*</exclude>
                <exclude>**/selenium/*</exclude>
            </excludes>
        </configuration>
        <executions>
            <execution>
                <id>integration-tests</id>
                <phase>integration-test</phase>
                <goals>
                    <goal>test</goal>
                </goals>
                <configuration>
                    <skip>false</skip>
                    <excludes>
                        <exclude>none</exclude>
                    </excludes>
                    <includes>
                        <include>**/integration/*</include>
                        <include>**/selenium/*</include>
                    </includes>
                </configuration>
            </execution>
        </executions>
    </plugin>

    Now it is time to start a selenium server locally or remotely so we can start our newly defined test cases.

    Selenium Remote control

    Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in any programming language against any HTTP website using any mainstream JavaScript-enabled browser.

     

    You can either start a selenium RC server

    • Outside Eclipse, like any java process,
    • Inside Eclipse with a java launcher,
    • Inside Eclipse with Maven and a java launcher.
    • Inside any Maven Phase thank to a plugin XXXXXXXXXXXXX

    I recommend you to install Selenium RC in a dedicated VM (VMWare, Virtual desktop, XEN) and to make it team or enterprise wide. I would always recommend to put Linux at work for such a task, unfortunately Internet Explorer is not running at all on Mac nor Linux.. I recommend you this way to run a shared Selenium server in your infrastructure that can be later access by many continuous build agents.

    Selenium RC is a Java process requiring only 2 jar to properly start, Download and unpack to c:\selenium-server-1.0-beta-2

     

     

     

    Create following in a batch file start.bat, normally all you have to do is to change the first 3 lines

    set JAVA_HOME=c:\jdk1.6
    set FIREFOX_HOME=C:\tools\Firefox3
    set SELENIUM_RC_HOME=c:/selenium-server-1.0-beta-2
    
    set PATH=%PATH%;%FIREFOX_HOME%
    set CLASSPATH=%CLASSPATH%;%SELENIUM_RC_HOME%/selenium-server.jar;%SELENIUM_RC_HOME%/selenium-server-coreless.jar 
    %JAVA_HOME%/bin/java -jar %SELENIUM_RC_HOME%/selenium-server.jar

    If everything run properly, you should see an ugly DOS windows like the one below

     starting.selenium.rc.outside.eclipse

    Pointing the browser to http://localhost:4444 will return an error 403, which is no sign of malfunction, currently Selenium RC has no web GUI.

    seleniumRCtestInBrowser

     

    Start Selenium RC server inside Eclipse

    If you decide to run selenium RC inside Eclipse, you’ll be mainly benefit from:

    • Project sharing and versioning in CVS/SVN,
    • Command line parameters that will start Selenium RC can also be shared,

    Selenium Server in a Maven project/module

    Create a new Maven Project named “SeleniumServer” and copy into its pom.xml the following

    <project 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/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.waltercedric.maven</groupId>
        <artifactId>SeleniumServer</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <dependencies>
            <dependency>
                <groupId>org.seleniumhq.selenium.server</groupId>
                <artifactId>selenium-server-coreless</artifactId>
                <version>1.0-beta-2</version>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium.core</groupId>
                <artifactId>selenium-core</artifactId>
                <version>1.0-beta-2</version>
            </dependency>
        </dependencies>
    </project>

    Create a Java launcher and use org.openqa.selenium.server.SeleniumServer as main class. If you start the launcher, you will see the following in eclipse console

    seleniumRC.started.in.eclipse

     

    Selenium RC is now waiting on port 4444 for Selenium Test case orders.

    You can now run your test case in eclipse like any other test case using Eclipse build in Junit runner.

  • Maven dependencies graph plugin in TeamCity and Eclipse

    apache_maven

    How to add dependencies graph to multi module projects. With this Maven plugin, you’ll be able to visualize Maven modules interdependencies and dependencies in any scope (compile, text, provided, system, runtime)

    depgraph:depgraph Can be used to draw a dependency graph from the project, the mojo is executed in. It traverses all dependencies and creates a graph using Graphviz. It draws a dependency graph just for your project. For a simple POM with no sub modules, it draws a graph of all dependencies (including transitive ones) below it. For a POM with sub modules, goes into each leaf POM and generates a separate graph for it.

     

    Here is an example of output on the plugin itself

    depgraph

     

    Install in all TeamCity Agent Graphwiz

    Graphviz is an open source graph visualization software. It has several main graph layout programs. See the gallery for some sample layouts. It also has web and interactive graphical interfaces, and auxiliary tools, libraries, and language bindings.

    Chance is that you are using Linux, so install is very easy and just a few click away for OpenSuse

    # zypper in graphwiz   

    or for Debian

    # apt-get install graphwiz

    In windows use the binary installer and put the graphwiz/bin in your PATH environment variable!

    Configure your POM

    Ideally put this in your parent pom inside the <build> </build> tag

    <plugin>
            <groupId>ch.elca.el4j.maven.plugins</groupId>
            <artifactId>maven-depgraph-plugin</artifactId>
            <version>1.7</version>
    </plugin>

    More configuration settings can be found HERE, now add either a new plugin repository location in your pom.xml (see below) or better in your artifactory proxy

      <pluginRepository>
        <id>elca-services</id>
        <url>http://el4.elca-services.ch/el4j/maven2repository</url>
        <releases>
         <enabled>true</enabled>
        </releases>
      </pluginRepository>

     

    Configure Teamcity build

    Add in the Maven runner of every TeamCity Build

    addDependenciesGraphGoalsInBuild

     

    Maven goals

    • depgraph:depgraph  Can be used to draw a dependency graph from the project, the mojo is executed in. It traverses all dependencies and creates a graph using Graphviz. It draws a dependency graph just for your project. For a simple POM with no submodules, it draws a graph of all dependencies (including transitive ones) below it. For a POM with submodules, goes into each leaf POM and generates a separate graph for it.
    • depgraph:fullgraph  Can be used to draw a dependency graph from the project, the mojo is executed in. It traverses all dependencies and creates a graph using Graphviz. It draws a graph for all the modules as they are interconnected. Same as depgraph for a simple POM, but for a POM with submodules, generates a combined dependency graph incorporating all modules.

    You may also want to let developer look at modules dependencies graph in TeamCity, so you may want to add to artifact path **/site/images/*.png => dependenciesGraph

    Artifacts are files produced by a build. After finishing a build, TeamCity searches for artifacts in the build's checkout directory according to the specified artifact patterns. Matching files are then uploaded to the server, where they become available for download. More ..

    artifactPath

     

    Configure Eclipse

    Install Graphviz and don’t forget to have it in PATH.

    You can share an eclipse Maven launcher in your parent project, right click on your pom.xml and select run as Maven configuration, specify either depgraph:fullgraph  or depgraph:depgraph   as goals