Wednesday, October 19, 2011

Arquillian Ajocado 1.0.0.CR2 Released

RichFaces-Selenium project was re-factored to new structure, it had underwent peer-reviews and documentation efforts and as what is most important, it has moved under Arquillian project as extension called Ajocado /ˈeɪdʒəˈkɑːdəʊ/.

And... Arquillian Ajocado 1.0.0.CR2 has been released!

Introducing Ajocado

Ajocado (formerly known as RichFaces-Selenium) has obviously exceeded the initiative which it has been formerly intended for

RichFaces-Selenium has been integrated with Arquillian and its very own Drone extension to enable advanced lifecycle management which these projects offers.

The move is really significant, because it is now obvious that project has developed to full-featured wrapper for Selenium 1.x API.

Where it is deployed already?

Ajocado is now used by some other teams across JBoss Quality Assurance department, namely for testing of Seam, Portal, Spring, GWT and Struts (Web Framework Kit) and it is considered to be used for automation of functional test suites of other projects.

But from the stand-point from team, where initial ideas had grown - RichFaces - Ajocado is the project which enabled automation of its functional test suite (counting 2350 unique tests) for this UI component suite.

Why it matters?

Why the new wrapper for Selenium 1.x matters? You can read more in introduction in Ajocado project documentation:

Ajocado project is designed as enhancement of Selenium project focused on rapid development and usability in Java environment.
  • API is straightforward and enforces tester to write Ajax-enabled tests,
  • internals enables JQuery location strategy, which improves performance of the tests,
  • brings concepts for on-the-fly injection of own selenium extensions and also extensions to page code (enabling advanced testing features)
  • allows command interception and request interception,
  • it brings type-safe equivalent of Selenium version 1.x, enabling auto-completion and rapid development style,
  • integrates with Arquillian using Arquillian Drone extension.
With all the concepts above, Ajocado brings new power to space of enterprise Java-based testing.


Release Candidate 2

Second release candidate was lead in spirit of stabilization, component upgrades and finishing documentation - you may also want to review complete release notes.

Future

We would like to introduce support for Selenium 2 API and migrate more cool features which can be seen not only in RichFaces test suite... just stay tuned. ;-)


Tuesday, September 20, 2011

Improvements of RichFaces Editor in Milestone2

I have blogged about RichFaces Editor component recently which has been available since RichFaces 4.1.0.Milestone1.

In scope of Milestone2, Editor has been improved with several pretty new and cool features:
  • @lang - support for localization
  • @config - fine-grained configuration
  • @ondirty - event handler for live changes in editor's content
  • @skin - switches between CKEditor skins
  • created new skin 'richfaces'
  • resource optimization (editor does not load any unnecessary resources)
Skinnability

rich:editor now bundles 'richfaces' skin for CKEditor, which makes it's appearance close to other components from RichFaces suite, including all of controls and popups.

You can still switch to other skins available in default distribution of CKEditor (kama, v2 and office2003) with @skin attribute or you can download and use any other skin.


Configuration

Most valuable for customization of Editor is @config attribute which provides fine-grained configuration of editor. Alternatively, you can use facet with name "config", which is even better for detailed customization.

With this facility, you can configure anything what is possible in CKEditor and you are do it in same way like default CKEditor do, just checkout developer sample. For all available options, you can consult CKEditor's configuration documentation.

@config attribute is certainly able to expand EL expressions, so you can made your editor configuration dynamic.

Dirtiness

Another feature which makes CKEditor integration unique is "dirty" event (@ondirty event handler) which is fired when you change editor content with any available action.

Using this flag, you can easily implement auto-saving (with queue attached) or update periodically display of another client with edited value.

Enjoy the tweaked implementation and let us know on RichFaces forums!

1-day conference in Vienna - Slides and Wrap up

Last event I have attended was a great success.

I have made two talks there for which I would like to share slides with you:
I had got very valuable feedback from attendees on both sessions, thank you!

Wednesday, August 31, 2011

Talking on RichFaces@mobiles and on JSF testing in Vienna

I would like to invite you on JSF and RichFaces workshop UNIQA held at September 7-9th in Vienna, Austria.

While first two days will be Max Katz covering thoroughly JSF and RichFaces, last conference day will be dedicated to topics related to RichFaces.

I will be presenting on what can RichFaces offer in upcoming mobile era and what are current state-of-art techniques in testing JSF applications with Arquillian, Selenium and JSFUnit.

You can also see detailed program and you can watch the event on Lanyard.

Looking forward to meet you there!

Thursday, August 18, 2011

Push Improvements in RichFaces 4.1

The lot of improvements has been done in 4.1.0.Milestone1 and specifically Push component has been tweaked a much under the hood.

Push component itself is very important for interactive enterprise applications and we are trying to design its API as much clean as possible.

RichFaces team, and Nick Belaevski namely, did great job to decouple Push from JMS to avoid unnecessary overhead with connecting to messaging provider.

On the client-side, changes have been done to support WebSockets as light-weight alternative for long-polling HTTP connections (comet). Clients, which supports them, uses WebSockets by default and fall-backs to long-polling when support is not detected.

Specifically for 4.0.0.Final users, which would like to try M1 release, they may register message stating deprecation of PushFilter in the server log. It is not strictly necessary to re-configure, but PushFilter has been replaced by PushServlet, to which it delegates now. Things are even better in Servlets 3.0 environments, when you don’t need register any servlet since that will be done automatically for you.

On the server-side, we have introduced option for disabling Push and JMS integration in cases when you can’t use enterprise messaging or you don't require it. To turn JMS integration off, you just need to provide following contextual parameter in web.xml:

<context-param>

<param-name>org.richfaces.push.jms.disable</param-name>
<param-value>true</param-value>
</context-param>


If you would like to try Push, you may be pleased that it is now in RichFaces Showcase, however be aware that it can't be seen in demo hosted on GAE since this hosting doesn't support JMS. You will need to deploy it at own, and in such case I strongly recommend you my previous blog.

And what you may expect in near future? We are working on integration with CDI Events feature, so your application would be allowed to throw messages to the clients very easily. This feature can be already seen in RichFaces Showcase Push samples - it is not really hard to develop simple integration with CDI.

But there were also issues which we had to overcome - one of them is issue with Atmosphere and JBoss Web which will be addressed also in M2.

To overcome this issue, you can temporary switch to using blocking I/O approach:

<context-param>

<param-name>org.atmosphere.useBlocking</param-name>
<param-value>true</param-value>
</context-param>


And off-course, if you have ideas how to make Push more user-friendly than it already is, give us know in RichFaces community discussions. We will be pleased to hear from you!

Monday, August 15, 2011

Editor for RichFaces 4.1

You have been requesting and we now answer: RichFaces gets pretty new Editor component, which was lacking from 4.0.0.Final release.

This component can be found in upcoming 4.1.0.Milestone1 release and is mostly feature complete with exception of skinning which will fit to rest of component suite - this functionality is targeted for Milestone 2.

Editor component is using CKEditor implementation internally and it is able to switch between two configurations of toolbar set: basic and full.



It also integrates nicely with rest of JSF 2, thus you can bind e.g. behavior for event denoting the editor content has been changed:

<rich:editor toolbar="full" value="#{article.text}">

<a4j:ajax event="change" action="#{article.save}" />
</rich:editor>

It is important to note that Editor uses resource handling servlet for obtaining own resources. You don’t require any additional configuration to set it up when working with Servlet 3.0 - everything will be registered automatically for you.

However in Servlet 2.5 and older environments, it is necessary to register this servlet manually in web.xml:

<servlet>

<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>

I would appreciate your feedback on forums, how this component stands.

You can also watch what is being planned for future.

Tuesday, July 19, 2011

RichFaces Heading to JBoss AS7 Era

I’m very excited to show RichFaces users how easy (and productive) life can be when running on JBoss Application Server 7!

It’s not necessary to enumerate all the features of JBoss AS7 (there are others that have already done so), but it’s at least worth mentioning that AS7 is extremely light-weight - and that’s the UI that developers are interested in!


Light-weight containers - Java EE features ready web developers?

The AS7 core itself starts in no more than 3 seconds. Such a fast start is achieved by an extremely modular architecture where modules are started in parallel. I invite you to see Lincoln’s video showing AS7 fighting in the wild.

What’s so great about AS7 and why should you use it? Let’s start with some benchmarks of real deployment:

AS7 - 10.907s - 11s
AS6 - 31.248s - 31s
Tomcat 7 - 17.313s - 17s
Tomcat 6 - 7.065s - 7s


This certainly looks promising.

Just note that these results are measured from the startup of the RichFaces Showcase application, which currently employs several hot features of the Java EE stack: CDI, JPA, JMS and JSF.

You can imagine the difference in web development experience on AS7 and other application servers.

Still don’t believe me? Just check out the guide below on how to deploy RichFaces Showcase yourself.


RichFaces 4 running on AS7 here and now

We have prepared two demonstration applications targeting AS7 to show how easy it is to get RichFaces running.

We’ll first touch the Showcase application (since you can deploy it as it is: just clone, build and run) and then go discover Tweetstream application, which is really nice sample of tweet tracking for both mobile and desktop browsers.


Showcase on AS7

Clone the project from the Git repository

You need to clone the project from RichFaces Showcase repository, move into that directory, and then reset to a specific reference point (i.e. a specific commit) like so:

$ git clone git://github.com/richfaces/showcase.git
$ cd showcase
$ git checkout -b blog-demo 54b8211b9bfc065dda32c8809cd9a4e2b7c90b71

Build the project

At first, make sure you have properly setup Maven for development with JBoss repositories (check out Maven Getting Started, paragraph "Configuring Maven to use the JBoss Repository").

$ mvn clean package -Pjbas7 --update-snapshots

The Maven build will take some time, but once complete, you will have a WAR file deployable on AS7.

Download and unpack AS7 distribution

Now you need the actual server, so go to the JBoss AS download page and obtain the latest AS7 distribution archive (be sure to grab a distribution which contains everything, not only the Web Profile). Then unpack it and enter the newly-created directory. You may also find useful documentation in Getting started with AS7.

Deploy Showcase to AS7

Take the WAR file from the Maven build (which is located at showcase/target/richfaces-showcase-jbas7.war), copy it to the “deployments” directory, and finally rename it showcase.war (jboss-7.0.0/standalone/deployments/showcase.war).

Start AS7

Enter the jboss-7.0.0/bin directory and run

$ ./standalone.sh --server-config standalone-preview.xml

If deployment is successful, you should see “registering web context: /showcase” and “Deployed "showcase.war" on last few lines of the server console.

Enter the Showcase application

Start your browser and point it at: http://localhost:8080/showcase/ .
Et voilà! You have successfully deployed the RichFaces Showcase application!




Diving Deep into Showcase and AS7 Specific Requirements


Showcase deployment was easy enough; now we'll go through the behind the scenes configuration of both Showcase and AS7.

First, we needed to deploy in Preview configuration (which was denoted by using --server-config standalone-preview.xml switch). That was necessary because AS 7.0.0 is certified to JavaEE 6 Web Profile only. The Preview configuration then contains the sample of what’s going to be in Full Profile and what is baking in 7.1.0, but still needs further work.

I have said that Showcase is using several Java EE 6 technologies: JSF, CDI, JPA and JMS. That means AS7 needs to load and configure each of the appropriate modules for these technologies.

For both JSF and CDI, it is enough to create two configuration files, faces-config.xml and beans.xml, to load the appropriate modules. For JPA, it is necessary to create persistence.xml with a proper configuration. Showcase uses ExampleDS as the data source, which is deployed out-of-the-box on AS7 for sample applications.

In the case of JMS, the situation is a bit different, since it is not possible to initialize it by configuring WAR deployment: RichFaces Push needs to have JMS topics initialized just before the application starts. The Java API for DMR creates topics on the JMS server bundled with AS7 (HornetQ) when an application is being deployed. Using this API, you can manage the server in an elegant way, as the following snippet from the JMS provider management script shows:

public void createTopic(String topicName, String jndiName) throws Exception {
...
operation = new ModelNode();
operation.get("operation").set("add");
operation.get("address").add("subsystem", "messaging");
operation.get("address").add("jms-topic", topicName);
operation.get("entries").add(jndiName);
client.executeAsync(operation, null);
...
}

RichFaces Push needs to be configured for using of blocking I/O approach of managing requests on AS7. You need to configure org.atmosphere.useBlocking=true in web.xml.

These tweaks are necessary to get Showcase working on AS7 without having to perform any custom server management operations before the application is deployed.

Now we’re ready to get looking at a higher level and inspect the Tweetstream application and other options of deployment control and server management.


Tweetstream on AS7


Tweetstream is a RichFaces/JSF2 app that was optimized for mobile device browsers. It was writen by Jay Balunas and Wesley Hales for the JBoss World 2011 Keynote. You may find more information on blogs RichFaces And The Mobile Web... and Runtime Type Detection and Usage with Weld.

Connection to twitter is driven through OAuth credentials and associated security tokens. These credentials are pre-filled in properties file using fake twitter account created for demonstration purpose, but I encourage you to change them - Twitter won’t allow two consumers (like the Tweetstream application) to connect using the same application account.

To run Tweetstream, you should follow the same steps you used in the Showcase example above, but additionally you need to setup Twitter OAuth credentials and also setup JMS. We will also inspect another way to deploy WAR files.

The following section assumes that you have already downloaded and unpacked AS7 (using the Showcase instructions above).

Clone the Project from the Git Repository

You need to clone project from RichFaces Tweetstream repository, move into that directory, and then reset to a specific reference point (i.e. a specific commit) like so:

$ git clone git://github.com/richfaces/tweetstream.git
$ cd tweetstream
$ git checkout -b blog-demo ccae090ef0c59c9275fb011aa426a88f53544fe1

Change the Twitter4j Credentials (optional)

This is really not that hard, but it does require some effort. Because these steps change from time to time you should refer to http://twitter4j.org/en/configuration.html and https://dev.twitter.com/pages/auth for up-to-date details.

Once you have access to the values in tweetstream/src/main/resources/twitter4j.properties :

oauth.consumerKey=**************************
oauth.consumerSecret=**************************
oauth.accessToken=**************************
oauth.accessTokenSecret=**************************

Update with these your own values.

Change Keywords that Tweetstream Tracks (optional)

By default, Tweetstream tracks various JBoss related keywords with twitter4j. If you want to change the tracking list, just enter another keyword (each on its own line) in this file:

tweetstream/src/main/resources/twittertracks.properties

Build the Project

Before starting a build, make sure you have properly setup Maven for development with JBoss repositories (check out Maven Getting Started, paragraph "Configuring Maven to use the JBoss Repository").

$ mvn clean package --update-snapshots

Start AS7

Without deploying the application, start the server by entering the jboss-7.0.0/bin directory and running:

$ ./standalone.sh --server-config standalone-preview.xml

Create the JMS Topic on AS7

To do this, you have two choices: use AS7’s command line admin interface, or use the web console. Both are bundled with AS7 distribution:

Using the Web Console
Navigate to http://localhost:9990/console/ in your browser. In the management console, select Messaging > Messaging Provider, look for Subresources, and switch to the Topics tab. Hit the Add button (on the right) and in the popup titled “Create JMS Topic”, enter “twitter” as the name and “topic/twitter” as the JNDI.

Command-line interface
To start the command line interface, ensure AS7 is running and enter the jboss-7.0.0 directory. From this directory, follow these steps:


$ ./jboss-admin.sh
[disconnected /] connect
[standalone@localhost:9999 /] add-jms-topic --name=twitter --entries=topic/twitter



Deploy Tweetstream to AS7

You can certainly use the deployment way mentioned in the Showcase guide above, but I will show here two different ways to deploy: by using the web console, or using the command line interface.

Using the Web Console
Enter the console again (http://localhost:9990/console/) and select Deployments > Manage Deployments and hit the Add Content button (on the right). In the popup, Choose a WAR file to deploy and hit Next button. Leave the default values in the next popup screen and hit the Finish button. The popup will disappear and you will see your WAR in the list of deployed resources. Hit the Enable button for tweetstream.war. You should see a green ball indicating successful deployment.

Using the Command Line Interface
Start the command line interface again and follow these steps:

$ ./jboss-admin.sh
[disconnected /] connect
[standalone@localhost:9999 /] deploy /path_to_tweetstream/target/tweetstream.war
'tweetstream.war' deployed successfully.



Enjoy the Tweetstream application!

Enter http://localhost:8080/tweetstream/ in your browser. From now on, new tweets are displayed on the left side of the page and the top hashes and tweeters counts are displayed on the right side.





As you can see, AS7 deployment is simple, and multiple means of deployment are provided. Nevertheless, application startup time has been reduced dramatically, finally giving web developers the speed they need!