Thursday, March 29, 2012

Incredibly Fast JSF Component Development

Why is a JSF components development so painful?

It would be really great if I could develop full-blown JSF components wrapping some JavaScript UI widget as fast as I'm developing plain HTML, wouldn't it?

Just two words: fast turnaround!

Every tool and every framework which tries to simplify a process should have a strategy to allow a fast turnaround. It is lowering a learning curve and saves developers many invaluable hours. And mainly it makes working with the a tool a pleasure!



RichFaces CDK


The CDK project is sample of such a powerful tool - it allows you to write just two pieces -
  • a Java component interface,
  • a HTML renderer (with Facelets-like syntax),
and then it takes these definitions and
  • generates all the boilerplate code automatically including
    • all the Java code,
    • configurations (faces-config.xml and *.taglib.xml),
    • and a VDL documentation.
Brian Leathem has written series of articles introducing how easy can JSF component development be when using RichFaces CDK.

But besides it is the powerful tool, you can also achieve a really fast development turnaround using CDK- just by using proper tools!


Quick Turnaround with RichFaces CDK


There is guide which covers how to setup your tooling to start with a development.

It covers setting up the component and demo project in JBoss Tools (on top of Eclipse IDE) and how to automatically trigger build when you change CDK resources.

And to make the deployment phase as quick as possible?

We are using JRebel to hot-deploy built resources into JBoss AS 7, which is itself f&@#ng fast.

That's it!

You can just save & refresh the page!

The pictures used in the blog are only illustrative, taken by various authors and published under Creative Commons license. The references: the toolkit by Ryan Hyde and the trains by Joel Down

Monday, March 19, 2012

Graphene CR3 Released & How To Migrate from Ajocado?


The project Ajocado has been renamed to Graphene.

The first release under the new name waits for you in Maven repositories.

Migration Path

Fortunately, the migration to new name in your project is very smooth, you can even continue to use original APIs.

Java Classes

The packages of the Java classes have not been renamed, the only change is addition of three new interfaces/utilities and deprecation of the old ones:

Ajocado -> Graphene
AjaxSelenium -> GrapheneSelenium
AjocadoConfiguration -> GrapheneConfiguration
AjocadoContext -> GrapheneSeleniumContextM
AjocadoConfigurationContext -> GrapheneConfigurationContext

The original names has been deprecated, but it doesn't prevent to use current tests as they are - the deprecated classes will continue to be part of the project.

Configuration

The simple change in the arquillian.xml descriptor is needed, you just need to change ajocado to graphene:

<extension qualifier="graphene">
    ...
</extension>

Maven Artifacts

The most significant change underwent dependency system, so let me talk a more little bit about that:

In Ajocado CR2, there was only one dependency necessary to import all the JUnit/TestNG and all Arquillian dependencies.

In Graphene CR3, you need to manage several dependencies - however it makes your usage of dependencies little more cleaner, since you know exactly what dependencies are imported.

At first, you need to import JUnit/TestNG dependency:

Test Framework

<!-- JUnit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.8.2</version>
    <scope>test</scope>
</dependency>

<!-- TestNG -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>5.14.6</version>
    <scope>test</scope>
</dependency>


Additionally, you need to choose between using Graphene as standalone or use Arquillian integration with containers:

Standalone Usage

In this mode, you don't use integration with containers, you need to manage the container and deployment at own:

<!-- Arquillian JUnit Standalone -->
<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-standalone</artifactId>
    <version>1.0.0.CR7</version>
    <scope>test</scope>
</dependency>

or

<!-- Arquillian TestNG Standalone -->
<dependency>
    <groupId>org.jboss.arquillian.testng</groupId>
    <artifactId>arquillian-testng-standalone</artifactId>
    <version>1.0.0.CR7</version>
    <scope>test</scope>
</dependency>


Container usage

In the container mode, you need to provide deployable archive  (@Deployment) and the whole lifecycle of the container and deployment will be managed by Arquillian:

<!-- Arquillian JUnit Container -->
<dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-container</artifactId>
    <version>1.0.0.CR7</version>
    <scope>test</scope>
</dependency>

or

<!-- Arquillian TestNG Container -->
<dependency>
    <groupId>org.jboss.arquillian.testng</groupId>
    <artifactId>arquillian-testng-container</artifactId>
    <version>1.0.0.CR7</version>
    <scope>test</scope>
</dependency>

Graphene Dependency Chain

And finally it's necessary to import Arquillian Graphene dependency chain, which includes all other necessary dependencies (Graphene, Drone, Selenium):

<!-- Graphene dependency chain -->
<dependency>
    <groupId>org.jboss.arquillian.graphene</groupId>
    <artifactId>arquillian-graphene</artifactId>
    <version>1.0.0.CR3</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>

What's next?

We are preparing to release Final later soon, the same as other dependencies in Arquillian ecosystem.

Thanks all the people who helped to test migration (Jan Papousek, Karel Piwko), so it is now pretty smooth.


More project information

Home page
Documentation
Issue tracker

Goodbye, Ajocado - Welcome, Graphene!

Goodbye, Ajocado

Wait, the Ajocado project is not leaving us!
It is just undergoing rename. Why such a change?

Ajocado was everytime proud member of Arquillian family, however its name didn't tell very well what's its purpose in the true alien world - the name didn't fit the story.

Moreover, we have experienced many troubles explaining how Ajocado should be even pronounced.

I must admit it was unlucky choice.

Choosing the new name...

The project is like a diamond - very strong in its basis:
  • a strongly-typed, chaining API
  • efficient jQuery-based locators
  • proven to handle AJAX successfully
But on the other hand, diamonds can't be simply manufactured.

Let's look what more could Ajocado offer us:
  • rapid test development
  • readability
  • high-level abstractions
What can be as strong as diamond, but be much more flexible?

Welcome, Graphene!

Graphene is stronger and stiffer than diamond, yet can be stretched by a quarter of its length, like rubber.
Let me introduce the Graphene - the strong and flexible UI automation tool - the old/new member of the alien crew, on the way to save the world!

What's next?

The rename is already done, waiting in maven repositories as Graphene 1.0.0.CR3.

And what about migration? It's pretty straight-forward, as you can see in my next post.

Thank you all who participated in choosing new name, renaming and migration testing (Vlasta Elias, Dan Allen, Jan Papousek, Karel Piwko)!



More project information

Home page
Documentation
Issue tracker

Tuesday, March 13, 2012

Great times at JDC 2012, Egypt


I’m finally back from Cairo, where I was invited as speaker on Java Developer Conference 2012.

If I should think of just one word explaining the conference, I would need to say: a passion.

You could seen the passion from everywhere: discussions, an audience, follow-up questions, organizers.

As I have written in last post, I had three sessions there - you can read more about them or view the slides at Lanyard:





The only what would I change is timing of sessions, because then me and Koen’s session had not conflict and Arquillian would take even more attention.


I have spent lot of time in the JBoss booth and the venue, discussing precious projects!



After the conference closing, the good beer and the nice mood over the discussion about various, mainly JBoss-related and philosophical questions with Koen made my Sunday's waking up really hectic - I arranged the trip over the pyramids for 9:00. Although the clock in the room was showing 6:25, it was nearly 9:30.

But the morning’s difficulties were quickly shaded with all the great views on pyramids - there were so nice and as Koen expressed it exactly: mind-blowing. I really need to give another thanks to the our tour guide - Mahmud for taking us all - me, Jonaas and Richard - to the pyramids.


At overall, I would be really happy to speak at JDC again next year as well as discover other beauties of Egypt!


Monday, March 5, 2012

Speaking at JDC'12 in Cairo, Egypt


I'm speaking at JAVA Developer Conference 2012 held at March 9-10th in Cairo, Egypt.

I will give there 3 talks on my favorite topics: a web development with JBoss technologies and a testing.

The Gear You Need To Go Mobile With Java Enterprise
In the first talk, I'm going to cover what could the Java enterprise offer you in days of a rising mobile platform.

A Rapid JSF Component Development with RichFaces CDK
The second talk introduces RichFaces Component Development Kit as the tool to cover the space where JSF2 falls short - custom component development.

Arquillian: Effective Tests from the Client to the Server
The last talk is about the latest movements in the space of a testing revolution started when Arquillian decided to save the earth. I will focus specifically on testing an integration of the client and the server.


My JBoss fellow, Koen Aers, will be also presenting there and he covers lot of interesting stuff: JBoss Tools, Forge and Arquillian (yeah, Ike invades Egypt!). Let's checkout his and other sessions.

The event haven't started yet, but it's already looking like great event, I'm looking forward to see you there!