tag:blogger.com,1999:blog-38625950542027954382024-03-15T18:09:44.957-07:00Rike AnsikterThe RichFaces - component library for JSF - and its testing.Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.comBlogger22125tag:blogger.com,1999:blog-3862595054202795438.post-67060282288838610472012-08-30T12:50:00.001-07:002012-08-30T13:18:09.050-07:00Incremental build with RichFaces CDK<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
To whom of us using RichFaces CDK and being unsatisfied with <b>a build time</b>, our day just came!<br />
<br />
CDK got an <b>incremental build feature</b>, which caches information collected during a Library compilation and store it on a hard drive.<br />
<br />
Once you trigger a build for a second time, the last modification time of all sources is compared to last modification time of cache file.<br />
<br />
When CDK recognizes that any source has changed, it will re-compile it and the collected data will be applied on Library model again, effectively rewriting old data.<br />
<h2 style="text-align: left;">
How to Configure Incremental Build</h2>
How to configure incremental build in your CDK project? It's pretty simple: <b>you don't need to do anything</b>.<br />
<br />
Incremental build is <b>turned on by default</b> to make your life easier and to save your precious time.<br />
<br />
<br />
I recommend you to configure <a href="https://github.com/richfaces/sandbox/tree/develop/hot-deployment">the fast CDK turnaround using JRebel</a> - together with the incremental build, nothing will beat you in the <a href="http://www.bleathem.ca/blog/2011/11/richfaces-4-cdk-jqeury-ui-tabs.html">rich JSF components development time</a>.<br />
<h2 style="text-align: left;">
Troubleshooting</h2>
When using incremental build at current implementation, be aware that in some cases when you do <b>structural changes</b> (e.g. renaming methods), you may get to a point where the incrementally <b>generated sources will not be valid</b> - sometimes it won't make any trouble (attribute renaming), sometimes sources generated by CDK might not be even compilable at all.<br />
<br />
In this case, you just need to recompile the sources from scratch, either with additional <span style="font-family: Courier New, Courier, monospace;">maven-cdk-plugin</span> configuration<br />
<br />
<pre class="brush: plain">$ mvn cdk:generate -Dcdk.recompile=true</pre>
<br />
<br />
or using <a href="https://github.com/richfaces/sandbox/tree/develop/hot-deployment">command line interface</a>:<br />
<br />
<pre class="brush: plain">$ bash run.sh --force-recompile</pre>
<br />
However in most cases, incremental build will work just fine. :-)<br />
<h2>
Improvement</h2>
<div>
Using incremental build, I have achieved build-time improvement from <b>10 545</b> <b>ms</b> to <b>1 622 ms </b>in <a href="https://github.com/richfaces/sandbox/tree/develop/bootstrap">Bootstrap sandbox project</a>.</div>
<div>
<br /></div>
<div>
Such an improvement will allow us to re-factor RichFaces component suite to be developed just from one maven module and simplify a build a lot.</div>
<br />
<h2 style="text-align: left;">
Enjoy JSF component development</h2>
</div>
Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-60483616649780746092012-08-03T12:41:00.000-07:002012-08-07T01:29:41.030-07:00JSF meets Skinning Awesomeness of LESS<div dir="ltr" style="text-align: left;" trbidi="on">
A strength of JSF is in how it enables you to quickly write applications, providing you with a plethora of components abstracting complex functions.<br />
<br />
<h2 style="text-align: left;">
Skinning, Styling & CSS</h2>
<br />
<br />
But when it comes to skinning and styling those components, JSF is not very helpful. But let’s not malign JSF here - it's not the fault of JSF.<br />
<br />
Rather, we should blame CSS, which lacks the dynamicity that would allow the strong skinning features.<br />
<br />
<br />
<h2 style="text-align: left;">
CSS Pre-Processors to the Rescue</h2>
<br />
That's exactly where technologies like <b><a href="http://lesscss.org/">LESS</a></b> and <b><a href="http://sass-lang.com/">SASS</a></b> come in. They are processors which provide an alternative syntax similar to CSS, that basically allow you to do magic with your style-sheets and how they are are structured - <b>variables, mixins, functions, etc</b>.<br />
<br />
As the <a href="http://www.jboss.org/richfaces/">RichFaces</a> team is currently working on leveraging <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>, we want to embrace its beauties completely, and thus adopted its ability to style components in a simple and reusable way, while also enabling style extensions.<br />
<br />
Now, you can see this magic in the <a href="http://bootstrap-richfaces.rhcloud.com/">RichFaces Bootstrap showcase</a>.<br />
<br />
What is this magic and how you can achieve it? Let's see in this demo:<br />
<br />
<br />
<iframe allowfullscreen="allowfullscreen" frameborder="0" height="300" mozallowfullscreen="mozallowfullscreen" src="http://player.vimeo.com/video/46676086" webkitallowfullscreen="webkitallowfullscreen" width="380"></iframe> <br />
<a href="http://vimeo.com/46676086">Incredibly fast styling with JSF and LESS</a> from <a href="http://vimeo.com/lukasfryc">Lukas Fryc</a> on <a href="http://vimeo.com/">Vimeo</a>.<br />
<br />
<br />
You can clone the Bootstrap showcase on GitHub repository:<br />
<br />
<a href="https://github.com/richfaces/sandbox">https://github.com/richfaces/sandbox</a><br />
<br />
<h2 style="text-align: left;">
How does it work?</h2>
When the project is imported to the IDE, you can achieve <b>instant turnaround</b> without need to reload (or even re-deploy) anything - you just turn on the <b>Instant LESS</b> functionality using a bookmark with the following URL and the <b><a href="https://github.com/cloudhead/less.js">client-side LESS compiler</a></b> will take care of the rest:<br />
<br />
<pre class="brush: plain">javascript:less.instant.toggle();
</pre>
<br />
<br />
Your browser will now constantly watch for changes in the application resources.<br />
<br />
We use <a href="http://zeroturnaround.com/software/jrebel/"><b>JRebel</b></a> to ensure resources are pushed to the server immediately after we save them in the IDE. This isn't necessary if you use an <b>expanded WAR</b>, but we load LESS resources from JAR projects and that's where servers usually fall short. Luckily JRebel comes to save our butt, making possible<b> the hot-reloading of resources</b> within a JAR that are served using the JSF Resource Handler.<br />
<br />
<h2 style="text-align: left;">
Production Mode</h2>
The above method works well while in the <b>Development</b> stage of a project. But with that approach, LESS compiles resources in the browser and thus would slow down your application.<br />
<br />
In <b>Production</b> project stage is where <b>built-time compilation</b> comes into play. We use the popular project <b><a href="http://code.google.com/p/wro4j/">wro4j</a></b> - a pre-processor, minifier and optimizer for many alternative syntaxes for web languages. Specifically we are using the <a href="http://code.google.com/p/wro4j/wiki/MavenPlugin">wro4j-maven-plugin</a> and <a href="https://github.com/jbosstools/m2e-wro4j">M2E connector for this Maven plugin</a> (written by our fellow Fred Bricon, who wrote <a href="https://community.jboss.org/en/tools/blog/2012/01/17/css-and-js-minification-using-eclipse-maven-and-wro4j">a blog about usage of this plugin</a>).<br />
<br />
Let's check the Production Mode out, it is also as awesome as the Development Mode and its instant turnaround feature!</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com4tag:blogger.com,1999:blog-3862595054202795438.post-65186246359587925822012-05-14T01:12:00.001-07:002012-05-14T03:27:21.624-07:00In the foothills of Alps - wrap-up of ConFess 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Last week, I have been in Austria at <b><a href="http://2012.con-fess.com/en/" target="_blank">ConFess conference</a></b>.<br />
<br />
From my perspective, the conference underwent two significant changes: the venue was moved to Leogang, Austria and at second I was speaking there. :-)<br />
<br />
For the first point, I really loved the place - I'm the big fan of hiking and alpinism, so I really enjoyed the moments when we were discussing outside the conference rooms, breathing the fresh air and admiring the beauties of surrounding nature.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd8Q8pHNOPYcasWx9JkDvE3O-7fGoODgZILLQlXc2Mu9HbX4HxCsXX2YC5InT_IluQufNC9BMIC7ZX1DvqYG_VTyqPbpRscF8qZ44A5IfSJayqpekiyMxyqvZriK8Ytdf3HUkjwZDxA4HW/s1600/IMG_0688.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="199" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjd8Q8pHNOPYcasWx9JkDvE3O-7fGoODgZILLQlXc2Mu9HbX4HxCsXX2YC5InT_IluQufNC9BMIC7ZX1DvqYG_VTyqPbpRscF8qZ44A5IfSJayqpekiyMxyqvZriK8Ytdf3HUkjwZDxA4HW/s320/IMG_0688.JPG" width="320" /></a></div>
<br />
<br />
At second it was really pleasure to speak at ConFess, as it is the first conference where I've ever been, and I like returning there.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.slideshare.net/lfryc/going-mobile-with-richfaces"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2xJmBJ8vj7S1QEVIunaYbXoN84mB_yciN759HBCmI1tu53eeoSC1iq7i_WFtcVJ6h20Zz7m2jUWWIMh5oqqwv9N-Rvrf2UsfnhiF3IWficY1LGDSE4fRE_WGXurRybltSHE02BeTNmLWS/s200/going-mobile.png" width="200" /></a></div>
<br />
<br />
My first talk was about latest movements in world of HTML5, what developers needs to consider and how JSF and RichFaces fit that story.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.slideshare.net/lfryc/designing-topclass-test-suites-for-web-applications"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjZ6igBjxAIpLycmbliVr87SODIFg6Ext6VZgQEN_aorilgIBukTHjduPRzyJfNJGyVVQCp3-LBNG40Xo5-yYGRhcpmAMbsAMQmIju_6VOIIA4R0lCPfpqXDlBiAiJGxqEldTPAHrzvvlf/s200/designing-top-class-test-suites.png" width="200" /></a></div>
<br />
<br />
Second talk was structured as comprehensive guide to designing test suites for Java EE applications. I have revealed some of latest movements at planet Arquillian (like<a href="https://community.jboss.org/message/734599"> JSFUnit.NG</a> or <a href="http://blog.it-crowd.com.pl/2012/04/arquillian-meets-jrebel.html">JRebel extension</a>).<br />
<br />
<blockquote class="tr_bq" style="text-align: center;">
<span style="font-size: x-small;">Thanks to Jan Papousek who captured the photo.</span></blockquote>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com1tag:blogger.com,1999:blog-3862595054202795438.post-43471592313766496762012-04-11T06:17:00.001-07:002012-04-12T00:00:00.304-07:00Graphene 1.0.0.Final Released<div dir="ltr" style="text-align: left;" trbidi="on">
The Arquillian Graphene, the project focusing on <b>making a real-browser automation a breeze</b>, is now reaching first Final release.<br />
<br />
The Graphene is joining rest of the <b>Arquillian party</b>, building on top of Arquillian framework integration and Drone extension, which <a href="http://arquillian.org/blog/2012/04/10/arquillian-first-stable-release/">reached their stable version yesterday</a>.<br />
<h2 style="text-align: left;">
The Mission</h2>
<div>
The project was started to address simplification of covering AJAX-enabled applications with browser automation tests.</div>
<div>
<br /></div>
<div>
While Selenium project is focusing on unified API, integration with variety of browsers, Graphene project is addressing the real-world testing challenges:</div>
<div>
<ul style="text-align: left;">
<li><b>rapid development</b></li>
<ul>
<li>straight-forward</li>
<li>readable API</li>
<li>fast turnaround</li>
</ul>
<li><b>object-oriented</b></li>
<ul>
<li>type-safe API</li>
<li>dependency injection of thread-local context</li>
</ul>
<li><b>instabilities</b> and <b>speed of execution</b> in continuous integration</li>
<ul>
<li>jQuery selectors</li>
<li>request guards</li>
</ul>
</ul>
<h2 style="text-align: left;">
Availability</h2>
</div>
<div>
The Graphene bits are available in JBoss Maven repository, dual-licensed under LGPL v2.1 (backward-compatibility) and ASL v2.0 (which uses rest of the Arquillian sub-projects).<br />
<br />
For those who are already using the framework with Maven, you can simply increase the version to <span style="font-family: 'Courier New', Courier, monospace;">1.0.0.Final</span>.</div>
<div>
<br /></div>
<div>
You can start with the tests using our <a href="https://docs.jboss.org/author/display/ARQGRA/Getting+Started">Getting StartJBoss Maven repositoryed guide</a>.</div>
<h2 style="text-align: left;">
The Future</h2>
<div>
Right now we are heavily working on making the new version of Graphene 2 on the road.</div>
<div>
<br /></div>
<div>
Selenium 2 with its <b>WebDriver API</b> made huge progress with API <b>accessibility and readability</b> - it's already pleasure to work with this API in Java world.</div>
<div>
<br /></div>
<div>
However still there are <b>many lacks we are going to address with Graphene 2</b>, building on top of concepts brought in Graphene 1 and adding new features, which opens world of new possibilities:</div>
<div>
<ul style="text-align: left;">
<li>dependency injection of thread-local context</li>
<li>fast development turnaround</li>
<li>cross-cutting concerns (command interception)</li>
<li>request guards</li>
<li>page extensions</li>
<li>component objects</li>
<ul>
<li>extension of page objects concept</li>
</ul>
<li>JavaScript test execution from within Selenium test</li>
</ul>
<div>
If you enjoy testing and you are unsatisfied with the current browser automation tooling, <b>it's perfect time to step in</b> and help us to <b>bring the future</b>!</div>
</div>
<div>
<br /></div>
<h2 style="text-align: left;">
The Project Info</h2>
<div>
Source code: <a href="https://github.com/arquillian/arquillian-graphene">https://github.com/arquillian/arquillian-graphene</a></div>
<div>
Documentation: <a href="https://docs.jboss.org/author/display/ARQGRA/Home">https://docs.jboss.org/author/display/ARQGRA/Home</a></div>
<div>
Issue tracker: <a href="https://issues.jboss.org/browse/ARQGRA">https://issues.jboss.org/browse/ARQGRA</a></div>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-8397158760958749942012-04-04T04:08:00.000-07:002012-04-04T04:08:03.732-07:00Full-Fledged Debugging for Mobile Browsers<div dir="ltr" style="text-align: left;" trbidi="on">
A debugging of desktop applications is very common task in the world of web development. We might say the tooling here is highly developed and you can find everything you require and pretty easily. You can just use all those Firebugs, Chrome Web Inspectors, IE Developers Tools, etc.<br />
<br />
Not so in world of mobile devices!<br />
<br />
<h3 style="text-align: left;">
Hard Time Debugging Web Apps on Mobiles</h3>
The debugging applications on mobile were always problem - the mobile safari for iPhone/iPad offers you at least error console, so you might know when something is going wrong. The Android built-in browser does not even provide you such tool!<br />
<br />
<h3 style="text-align: left;">
WebKit Web Inspector</h3>
But the WebKit based browsers has solution to this - they offers WebKit Web Inspector, which you might be familiar with from using Chrome/Safari.<br />
<br />
Fortunately, WebKit functionality has arrived to mobile browsers yet!<br />
<br />
<h3 style="text-align: left;">
Inspector for Safari / iPhone</h3>
From little bit of search, I have found Safari was enabled to <a href="http://www.webkit.org/blog/1620/webkit-remote-debugging/">use remote debugging bridge</a> year ago!<br />
<br />
<h3 style="text-align: left;">
Inspector for Chrome Beta / Android</h3>
But as Ubuntu/Android user, I wasn't able to use such a comfort. Until now!<br />
<br />
I have upgraded my HTC to Android 4 yesterday and the Chrome Beta was the first application I installed there (it isn't available for previous Android releases).<br />
<br />
Today I have dived into RichFaces issue which occurred on mobiles. What a pain it could be when trying to find the cause, since mobile browsers doesn't even provide you the exact line where JavaScript error has occurred.<br />
<br />
And guess what? Chrome Beta already allows the same like Safari - WebKit Web Inspector through the USB debugging bridge.<br />
<br />
<h3 style="text-align: left;">
How To...</h3>
The process is quite straight-forward:<br />
<br />
<ul style="text-align: left;">
<li><a href="http://developer.android.com/guide/developing/device.html">setup the USB debugging</a></li>
<ul>
<li>let's start from step 2 - Turn on "USB Debugging" on your device.</li>
<li>for Ubuntu users, one additional step is required which involves registration device into udev system (described in the link above)</li>
</ul>
<li><a href="https://developers.google.com/chrome/mobile/docs/debugging">enable USB web debugging in Chrome Beta</a> </li>
<ul>
<li>involving installation of Android SDK</li>
</ul>
</ul>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-21054389727370265512012-03-29T10:58:00.000-07:002012-05-15T10:31:57.192-07:00Incredibly Fast JSF Component Development<div dir="ltr" style="text-align: left;" trbidi="on">
Why is a JSF components development so painful?<br />
<br />
It would be really great if I could <b>develop full-blown JSF components</b> wrapping some JavaScript UI widget as fast as I'm developing plain HTML, wouldn't it?<br />
<br />
Just two words: <b>fast turnaround</b>!<br />
<br />
Every tool and every framework which tries to simplify a process should have a strategy to allow a fast turnaround. It is lowering a <b>learning curve</b> and saves developers <b>many invaluable hours</b>. And mainly it makes working with the a tool a <b>pleasure</b>!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv1KtvpIEGV4utPplwwHzBaRI6uO8BvLdSxIUSL_z8H8DMiEUlJQYCU2pdpi4S3NiXanCcFUK4ky0m8v54Of9YcT5ME4qAHPjOOS4sJJbTcJKVfdetH2-r3uaHx_yEo3DPr4qah1NLyMDF/s1600/4689159475_c1b94da93d.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="160" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgv1KtvpIEGV4utPplwwHzBaRI6uO8BvLdSxIUSL_z8H8DMiEUlJQYCU2pdpi4S3NiXanCcFUK4ky0m8v54Of9YcT5ME4qAHPjOOS4sJJbTcJKVfdetH2-r3uaHx_yEo3DPr4qah1NLyMDF/s320/4689159475_c1b94da93d.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<h3 style="text-align: left;">
RichFaces CDK</h3>
<div>
<br /></div>
The CDK project is sample of such a powerful tool - it allows you to write just two pieces -<br />
<ul style="text-align: left;">
<li>a Java component <b>interface</b>,</li>
<li>a HTML <b>renderer</b> (with Facelets-like syntax),</li>
</ul>
<div>
and then it takes these definitions and</div>
<ul style="text-align: left;">
<li><b>generates all the boilerplate</b> <b>code</b> automatically including</li>
<ul>
<li>all the Java code,</li>
<li>configurations (faces-config.xml and *.taglib.xml),</li>
<li>and a VDL documentation.</li>
</ul>
</ul>
<div>
Brian Leathem has written <b>series of articles</b> introducing <a href="http://blog.bleathem.ca/search/label/CDK">how easy can JSF component development be when using RichFaces CDK</a>.</div>
<div>
<br /></div>
<div>
But besides it is the powerful tool, you can also achieve a <b>really fast development</b> turnaround using CDK- just by using proper tools!</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidwyx2LwMIF8lMy7mop9FT1A5tIHepAoI_ofglfGmi0wL0859VxUqOT9jWoKejfF9oe2Np0RoAICUHf9w4WzQQZoXJ6hrTaVc_uOmD89N_3VmwX8n_2DwXyv3cyoZtNaT9qm2DtxATogVt/s1600/4344137529_15a658f496.jpg" imageanchor="1" style="font-size: medium; font-weight: normal; margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidwyx2LwMIF8lMy7mop9FT1A5tIHepAoI_ofglfGmi0wL0859VxUqOT9jWoKejfF9oe2Np0RoAICUHf9w4WzQQZoXJ6hrTaVc_uOmD89N_3VmwX8n_2DwXyv3cyoZtNaT9qm2DtxATogVt/s320/4344137529_15a658f496.jpg" width="320" /></a></div>
<h3 style="text-align: left;">
</h3>
<h3 style="text-align: left;">
<a href="https://github.com/richfaces/sandbox/tree/develop/hot-deployment">Quick Turnaround with RichFaces CDK</a></h3>
<div>
<br /></div>
<div>
There is <a href="https://github.com/richfaces/sandbox/tree/develop/hot-deployment"><span style="font-size: large;">guide</span></a> which covers how to setup <b>your tooling</b> to start with a development.</div>
<div>
<br /></div>
<div>
It covers setting up the component and demo project in JBoss Tools (on top of Eclipse IDE) and how to <b>automatically trigger build</b> when you change CDK resources.</div>
<div>
<br /></div>
<div>
And to make the deployment phase as quick as possible?</div>
<div>
<br /></div>
<div>
We are using JRebel to <b>hot-deploy built resources</b> into JBoss AS 7, which is itself f&@#ng fast.</div>
<div>
<br /></div>
<div>
That's it!</div>
<div>
<br /></div>
<div>
You can just <b>save & refresh </b>the page!</div>
<div>
<br /></div>
<blockquote class="tr_bq">
<span style="font-size: x-small;">The pictures used in the blog are only illustrative, taken by various authors and published under Creative Commons license. The references: <a href="http://www.flickr.com/photos/breatheindigital/4689159475/">the toolkit</a> by Ryan Hyde and <a href="http://www.flickr.com/photos/getdown/4344137529/">the trains</a> by Joel Down</span></blockquote>
<div>
</div>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com2tag:blogger.com,1999:blog-3862595054202795438.post-64188944044866552862012-03-19T05:54:00.004-07:002012-03-19T08:34:12.152-07:00Graphene CR3 Released & How To Migrate from Ajocado?<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div>
The project Ajocado has been renamed to Graphene.<br />
<br />
The first release under the new name waits for you in Maven repositories.</div>
<div>
<br /></div>
<div>
<span style="font-size: x-large;">Migration Path</span></div>
<div>
<br /></div>
<div>
Fortunately, the migration to new name in your project is very smooth, you can even continue to use original APIs.</div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Java Classes</span></div>
<div>
<br /></div>
<div>
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:</div>
<div>
<br /></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">Ajocado -> </span><b style="font-family: 'Courier New', Courier, monospace;">Graphene</b></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">AjaxSelenium -> <b>GrapheneSelenium</b></span><br />
<span style="font-family: 'Courier New', Courier, monospace;">AjocadoConfiguration -> </span><b style="font-family: 'Courier New', Courier, monospace;">GrapheneConfiguration</b><span style="font-family: 'Courier New', Courier, monospace;"><b><br /></b></span></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">AjocadoContext -> </span><b style="font-family: 'Courier New', Courier, monospace;">GrapheneSeleniumContextM</b></div>
<div>
<span style="font-family: 'Courier New', Courier, monospace;">AjocadoConfigurationContext -> <b>GrapheneConfigurationContext</b></span></div>
<div>
<br /></div>
<div>
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.</div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Configuration</span></div>
<div>
<br /></div>
<div>
The simple change in the<span style="font-family: 'Courier New', Courier, monospace;"> arquillian.xml</span> descriptor is needed, you just need to change <span style="font-family: 'Courier New', Courier, monospace;">ajocado</span> to <span style="font-family: 'Courier New', Courier, monospace;">graphene</span>:</div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><extension qualifier="graphene">
...
</extension></pre>
</div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Maven Artifacts</span></div>
<div>
<br /></div>
<div>
The most significant change underwent dependency system, so let me talk a more little bit about that:</div>
<div>
<br /></div>
<div>
In Ajocado CR2, there was only one dependency necessary to import all the JUnit/TestNG and all Arquillian dependencies.</div>
<div>
<br /></div>
<div>
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.</div>
<div>
<br /></div>
<div>
At first, you need to import JUnit/TestNG dependency:</div>
<div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Test Framework</span></div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency></pre>
</div>
<div>
<br />
<pre class="brush: xml"><!-- TestNG -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.6</version>
<scope>test</scope>
</dependency></pre>
<br />
<br /></div>
Additionally, you need to choose between using Graphene as standalone or use Arquillian integration with containers:<br />
<br />
<span style="font-size: large;">Standalone Usage</span></div>
<div>
<br /></div>
<div>
In this mode, you don't use integration with containers, you need to manage the container and deployment at own:</div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><!-- 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></pre>
</div>
<div>
<br /></div>
<div>
or</div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><!-- 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></pre>
</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Container usage</span></div>
<div>
<br /></div>
<div>
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:</div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><!-- 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></pre>
</div>
<div>
<br /></div>
<div>
or</div>
<div>
<br /></div>
<div>
<pre class="brush: xml"><!-- 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></pre>
</div>
<div>
<br /></div>
<div>
<span style="font-size: large;">Graphene Dependency Chain</span></div>
<div>
<br /></div>
<div>
And finally it's necessary to import Arquillian Graphene dependency chain, which includes all other necessary dependencies (Graphene, Drone, Selenium):</div>
<div>
<br /></div>
<div>
<div>
<pre class="brush: xml"><!-- 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></pre>
</div>
<div>
<br /></div>
</div>
<div>
<span style="font-size: x-large;">What's next?</span></div>
<div>
<br /></div>
<div>
We are preparing to release Final later soon, the same as other dependencies in Arquillian ecosystem.<br />
<br /></div>
<div>
Thanks all the people who helped to test migration (Jan Papousek, Karel Piwko), so it is now pretty smooth.<br />
<br />
<br />
<span style="font-size: x-large;">More project information</span><br />
<br />
<a href="https://community.jboss.org/wiki/ArquillianGraphene">Home page</a><br />
<a href="https://docs.jboss.org/author/display/ARQGRA">Documentation</a><br />
<a href="https://issues.jboss.org/browse/ARQGRA">Issue tracker</a></div>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-34118211531590388002012-03-19T05:52:00.000-07:002012-03-19T06:09:27.083-07:00Goodbye, Ajocado - Welcome, Graphene!<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<span style="font-size: x-large;">Goodbye, Ajocado</span></div>
<div>
<br /></div>
<div>
Wait, the Ajocado project is not leaving us!<br />
It is just undergoing rename. Why such a change?</div>
<div>
<br /></div>
<div>
<b>Ajocado</b> was everytime proud member of <b>Arquillian</b> 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.</div>
<div>
<br /></div>
<div>
Moreover, we have experienced many troubles explaining how Ajocado should be even pronounced.<br />
<br />
I must admit it was unlucky choice.</div>
<div>
<br /></div>
<div>
<span style="font-size: x-large;">Choosing the new name...</span></div>
<div>
<br />
The project is like a diamond - very strong in its basis:</div>
<div>
<ul style="text-align: left;">
<li>a strongly-typed, chaining API</li>
<li>efficient jQuery-based locators</li>
<li>proven to handle AJAX successfully</li>
</ul>
</div>
<div>
But on the other hand, diamonds can't be simply manufactured.<br />
<br />
Let's look what more could Ajocado offer us:<br />
<ul style="text-align: left;">
<li>rapid test development</li>
<li>readability</li>
<li>high-level abstractions</li>
</ul>
<div>
What can be as strong as diamond, but be much more flexible?</div>
<div>
<br /></div>
<div>
<span style="font-size: x-large;">Welcome, Graphene!</span></div>
<br />
<blockquote class="tr_bq">
Graphene is stronger and stiffer than diamond, yet can be stretched by a quarter of its length, like rubber.</blockquote>
</div>
<div>
Let me introduce the Graphene - the <b>strong</b> and <b>flexible</b> UI automation tool - the old/new member of the alien crew, on the way to save the world!</div>
<div>
<br /></div>
<div>
<span style="font-size: x-large;">What's next?</span></div>
<div>
<br /></div>
<div>
The rename is already done, waiting in maven repositories as Graphene 1.0.0.CR3.</div>
<div>
<br /></div>
<div>
And what about migration? It's pretty straight-forward, as you can see in my <a href="http://rik-ansikter.blogspot.com/2012/03/graphene-cr3-released-how-to-migrate.html">next post</a>.</div>
<div>
<br /></div>
<div>
Thank you all who participated in choosing new name, renaming and migration testing (Vlasta Elias, Dan Allen, Jan Papousek, Karel Piwko)!<br />
<br />
<span style="font-size: x-large;"><br /></span><br />
<span style="font-size: x-large;">More project information</span><br />
<br />
<a href="https://community.jboss.org/wiki/ArquillianGraphene">Home page</a><br />
<a href="https://docs.jboss.org/author/display/ARQGRA">Documentation</a><br />
<a href="https://issues.jboss.org/browse/ARQGRA">Issue tracker</a></div>
</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-63014157459569626722012-03-13T11:02:00.000-07:002012-03-16T01:01:04.061-07:00Great times at JDC 2012, Egypt<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
I’m finally back from Cairo, where I was invited as speaker on <a href="http://jdc2012.egjug.org/">Java Developer Conference 2012</a>.<br />
<br />
If I should think of just one word explaining the conference, I would need to say: <b>a passion</b>.<br />
<br />
You could seen the passion from everywhere: discussions, an audience, follow-up questions, organizers.<br />
<br />
As I have written in last post, I had three sessions there - you can read more about them or view the slides at <a href="http://lanyrd.com/profile/lfryc/">Lanyard</a>:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://lanyrd.com/2012/jdc2012/sqkfz/"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghdbERSndIMHIJcKrDQxx-buOvN-YPzvn0q9EDJRGvO5TadB2jNfu_MG05HROW1FvWFBewpaijUe9tKAv_km0Qg9VHlpoPE0Df_P5DttQNlt4ZZbjak3C9eVz1LH0AlVL5i_t7WgO-_Unk/s320/talk-aerogear.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://lanyrd.com/2012/jdc2012/sqkgb/"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhntBLtgF-0XoPxppgaL5WoIUlHsb0n-jgu5H32UKyQGAvLM7hSo-I3uL7se9zHkAh8O8-k93Gjm0XnSplrbmZ06Q53OAswDCwSojnVP-2jwpAdNIN30xVUuK-O8_pjgYAZoeNTx9x9dAKE/s320/talk-cdk.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://lanyrd.com/2012/jdc2012/sqkgc/"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWHxey2Xsd4_nLBN3GJJx_wYjsmlxVEVraB90h89Zc9CC58IyviTwPmKA0etIDIYSrzgOA2pbqiW_q6I6ls70d5ViaUGaXQ8b2AhSyBb1GrPymuv7M2C5U0DWU6y9YKkybUVp-9f6eUIXd/s320/talk-arq.png" width="320" /></a></div>
<span style="font-size: large;"><br /></span><br />
<div class="separator" style="clear: both; text-align: left;">
The only what would I change is timing of sessions, because then me and <a href="http://lanyrd.com/profile/koentsje/">Koen’s</a> session had not conflict and Arquillian would take even more attention.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUqlCbfuXLNRkuFlBnVdVEQAzqUrPXfjuCvnY9hAPP3tSnZAkdgM4zmsa1XuO9zgwhqldX3dOoE-PGdtpxIMD8B-fbcvEtyrJfteDsG5Bwrv5uuruBbS2X42d_CawElWgWAWskXXbroDvH/s1600/AnjHDS2CQAAhSFk.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUqlCbfuXLNRkuFlBnVdVEQAzqUrPXfjuCvnY9hAPP3tSnZAkdgM4zmsa1XuO9zgwhqldX3dOoE-PGdtpxIMD8B-fbcvEtyrJfteDsG5Bwrv5uuruBbS2X42d_CawElWgWAWskXXbroDvH/s320/AnjHDS2CQAAhSFk.jpg" width="240" /></a></div>
<br />
I have spent lot of time in the JBoss booth and the venue, discussing precious projects!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj00mm85tFD8l-kHjzULDKr6dPzxreUh89f5oU-7061cmHpBt5c456crgW7CArsTnNmhl2kCXHwwMZOfix05galh9dTb8tvwz0zygZZxwSiFh7PxXaKwpErqLERO_n4areShVuUYPsDK2cX/s1600/423289_364760050223304_346353575397285_1088615_1734292757_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj00mm85tFD8l-kHjzULDKr6dPzxreUh89f5oU-7061cmHpBt5c456crgW7CArsTnNmhl2kCXHwwMZOfix05galh9dTb8tvwz0zygZZxwSiFh7PxXaKwpErqLERO_n4areShVuUYPsDK2cX/s320/423289_364760050223304_346353575397285_1088615_1734292757_n.jpg" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgloaQKCinw7E6Z32URZA9KbtlGGdxARkRmiOWZnJq0yNYvUi7fJYaqYjzpnUzhpIWGOOZiaa1rIATSARyMRfPz-rVgCEMmxNTfpncmoMSNOilay3HqFZdE7QBm4eznVKDPWmjmlR3_kcCl/s1600/425642_364712346894741_346353575397285_1088405_1799333775_n.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgloaQKCinw7E6Z32URZA9KbtlGGdxARkRmiOWZnJq0yNYvUi7fJYaqYjzpnUzhpIWGOOZiaa1rIATSARyMRfPz-rVgCEMmxNTfpncmoMSNOilay3HqFZdE7QBm4eznVKDPWmjmlR3_kcCl/s320/425642_364712346894741_346353575397285_1088405_1799333775_n.jpg" width="320" /></a></div>
<br />
After the conference closing, the good beer and the nice mood over the discussion about various, mainly JBoss-related and philosophical questions with <a href="http://lanyrd.com/profile/koentsje/">Koen</a> 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.<br />
<br />
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, <a href="http://lanyrd.com/profile/joonaslehtinen/">Jonaas</a> and <a href="http://lanyrd.com/profile/crichardson/">Richard</a> - to the pyramids.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir5cPhxOdVgBUrH_8ekK320zZTN8TK1ed7WnWFDbwDDcQ4KjkFSWVGijvkfpVonPje7cp5cM52ixbVWSFKUEvCbGswOczwUizyL2Fu_txS5ndRe6jSiA7TaLA5WsCF-NA3Qp4k9QzvS8xh/s1600/IMG_6356a.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir5cPhxOdVgBUrH_8ekK320zZTN8TK1ed7WnWFDbwDDcQ4KjkFSWVGijvkfpVonPje7cp5cM52ixbVWSFKUEvCbGswOczwUizyL2Fu_txS5ndRe6jSiA7TaLA5WsCF-NA3Qp4k9QzvS8xh/s320/IMG_6356a.JPG" width="320" /></a></div>
<br />
At overall, I would be really happy to speak at JDC again next year as well as discover other beauties of Egypt!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinD7XtrxGYxliKNQhzx-hkqXBO6geqRRyj0p2pZ0pP9o5V1ZR3TmHQwbr9UhjlcNo0EUVA1jKtPF-tMRlfohqSV3Mxkad8k8woqS_p5rwnsjvOmiex_uiHR5QPXMLWPD5c0n-jtQzxiubF/s1600/IMG_6384a.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinD7XtrxGYxliKNQhzx-hkqXBO6geqRRyj0p2pZ0pP9o5V1ZR3TmHQwbr9UhjlcNo0EUVA1jKtPF-tMRlfohqSV3Mxkad8k8woqS_p5rwnsjvOmiex_uiHR5QPXMLWPD5c0n-jtQzxiubF/s320/IMG_6384a.JPG" width="320" /></a></div>
<br /></div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com1tag:blogger.com,1999:blog-3862595054202795438.post-80398713819602086122012-03-05T01:13:00.000-08:002012-03-12T08:48:26.949-07:00Speaking at JDC'12 in Cairo, Egypt<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
I'm speaking at <a href="http://jdc2012.egjug.org/">JAVA Developer Conference 2012</a> held at March 9-10th in Cairo, Egypt.<br />
<br />
I will give there 3 talks on my favorite topics: a web development with JBoss technologies and a testing.<br />
<br />
<a href="http://jdc2012.egjug.org/session/gear_you_need_go_mobile_java_enterprise"><span style="font-size: large;">The Gear You Need To Go Mobile With Java Enterprise</span></a><br />
In the first talk, I'm going to cover what could the Java enterprise offer you in days of a rising mobile platform.<br />
<br />
<a href="http://jdc2012.egjug.org/session/rapid_jsf_component_development_richfaces_cdk"><span style="font-size: large;">A Rapid JSF Component Development with RichFaces CDK</span></a><br />
The second talk introduces RichFaces Component Development Kit as the tool to cover the space where JSF2 falls short - custom component development.<br />
<br />
<a href="http://jdc2012.egjug.org/session/arquillian_helping_developers_and_qa_get_along_and_get_apps_covered"><span style="font-size: large;">Arquillian: Effective Tests from the Client to the Server</span></a><br />
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.<br />
<br />
<br />
My JBoss fellow, Koen Aers, will be also presenting there and he covers lot of interesting stuff: <b>JBoss Tools</b>,<b> Forge </b>and<b> Arquillian</b> (yeah, Ike invades Egypt!). Let's <a href="http://jdc2012.egjug.org/sessions">checkout his and other sessions</a>.<br />
<br />
The event haven't started yet, but it's already looking like great event, I'm looking forward to see you there!</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-63851114863050598012012-02-24T05:47:00.004-08:002012-02-24T05:49:09.392-08:00Wrap-up: Arquillian Hackfest @ Developer Conference 2012 Brno<br />
Thank <b>all participants for contributing</b> to discussions on Arquillian HackFest!<br />
<br />
The <b>10 people has attended</b> and shared their ideas on selected topics,<br />
and others came to see us on video stream and IRC channel!<br />
<br />
<br />
<a href="https://plus.google.com/109501071933862146039/posts/dyo3hU9smcj" target="_blank">The initial idea for this Hackfest</a> has arisen when we were discussing the topics we would like to cover in conference days, just after <b>Arquillian SPI talk from Aslak</b>.<br />
<br />
<br />
Although we wasn't able to cover all declared topics,<br />
we focused on the ones which were most related to incoming Arquillians,<br />
the <b>notes and white-boards</b> can be find here:<br />
<br />
<b><a href="https://github.com/arquillian/arquillian-organization/wiki/Future:-gwt" target="_blank">Future: GWT</a></b><br />
<br />
<b><a href="https://github.com/arquillian/arquillian-organization/wiki/Future:-javascript" target="_blank">Future: JavaScript</a></b><br />
<br />
<b><a href="https://github.com/arquillian/arquillian-organization/wiki/Future:-performance-testing" target="_blank">Future: Performance testing</a></b><br />
<br />
<b>Future: JSFUnit.NG</b><br />
( no notes here, it was really short session - after Arquillian SPI talks, it didn't left much more to discuss - thanks Aslak! )<br />
<br />
<br />
It was pleasure to see so much ideas flowing,<b> let's grab them and equip Ike with even more mighty weapons</b> for fighting with bugs. ;-)Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-29072777719548383512012-02-13T10:25:00.000-08:002012-03-27T06:28:14.481-07:00Re-routing JSF resource requests with RichFaces Resource Mapping<div dir="ltr" style="text-align: left;" trbidi="on">
<blockquote class="tr_bq">
<b>Note:</b> The implementation contains <a href="https://issues.jboss.org/browse/RF-12093">issue</a>, thus the samples from this blog needs to be slightly modified, <a href="http://rik-ansikter.blogspot.com/2012/02/re-routing-jsf-resource-requests-with.html?showComment=1332793326704#c6043193679485093247">details in this comment</a>. The fix will be available with RichFaces 4.2.1.CR1.</blockquote>
<br />
RichFaces resource mapping can save your life when you need to serve a different resource (JS, CSS, image) file than the one originally requested. It works in the stage of determination of the resource request path.<br />
<br />
Specifically in all following situations, it may be really handy:<br />
<ul>
<li>providing alternative versions of a resource</li>
<li>map several resources to one</li>
<li>using external resources</li>
<li>moving resources to servers with static content</li>
</ul>
<div>
Before diving deeper into the situations above, let's look at how resources typically works in JSF.</div>
<div>
<br /></div>
<span style="font-size: large;">Resource loading in the picture</span><br />
<br />
Component libraries bundle resource dependencies (CSS stylesheets, JavaScript sources, images) in the distribution archives (JARs) and application-specific resources are bundled in WAR - the situation is outlined on the following picture:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzBi7AMN4rDU1EfXTNVjYhXxxyZJdjndzpkvhxN2QOI9-qFQS1JJqRoZ7GrPii_AM6kHt0Tayq_puDwVRzRESvARM-wF2UpRLbPnyYGpuGk_4hi3ali_HIPm3IdzoNYDQJUCSdeXXlqw9/s1600/plain.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzBi7AMN4rDU1EfXTNVjYhXxxyZJdjndzpkvhxN2QOI9-qFQS1JJqRoZ7GrPii_AM6kHt0Tayq_puDwVRzRESvARM-wF2UpRLbPnyYGpuGk_4hi3ali_HIPm3IdzoNYDQJUCSdeXXlqw9/s400/plain.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Component libraries (JARs) and application web archive (WAR)<br />
and resource dependencies (green)</td></tr>
</tbody></table>
<br />
<br />
Let's look at all of mentioned situations one by one:<br />
<br />
<span style="font-size: x-large;">Providing alternative file</span><br />
<br />
For example, your application requests <span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span> resource, but you don’t want to use default one, you want to provide alternative, maybe patched version to solve some issues. So you provide RichFaces the mapping using following configuration.<br />
<br />
Create the file <span style="font-family: 'Courier New', Courier, monospace;">META-INF/richfaces/static-resource-mappings.properties</span> on the classpath of your project and configure one mapping:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">jquery.js=jquery-alternative-version.js
</span><br />
<span style="font-family: 'Courier New', Courier, monospace;"><br /></span><br />
All requests for <span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span> will then be served as requests for <span style="font-family: 'Courier New', Courier, monospace;">jquery-alternative-version.js</span>.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI4TgVSTQIZAeIFRd7JG85uriZHprvRFAr252evf78rTPbWJR4E12qx5NA2BQkIrOiG7tLQzMCY7QU0zvBWBDscClj1JCjNpZIAqog4ZArSNJ-wc5c98yf_DWK9iGuAr2eRKWlYjdCj7oo/s1600/alternate.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="280" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgI4TgVSTQIZAeIFRd7JG85uriZHprvRFAr252evf78rTPbWJR4E12qx5NA2BQkIrOiG7tLQzMCY7QU0zvBWBDscClj1JCjNpZIAqog4ZArSNJ-wc5c98yf_DWK9iGuAr2eRKWlYjdCj7oo/s320/alternate.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span> mapped to <span style="font-family: 'Courier New', Courier, monospace;">jquery-alternate.js</span></td></tr>
</tbody></table>
<br />
<blockquote class="tr_bq">
<b>Warning:</b> Resource mapping requires resource servlet for its work - it is automatically registered in Servlets 3.0 environments (JBoss AS 6 and 7, Tomcat 7, GlassFish 3, etc.), but you will need to register that manually in Servlets 2.5 or lower environments - see <a href="http://docs.jboss.org/richfaces/latest_4_X/Developer_Guide/en-US/html/chap-Developer_Guide-Advanced_features.html#sect-Developer_Guide-Advanced_features-Configuring_ResourceServlet" target="_blank">RichFaces Developer Guide</a> for details of how configure it.</blockquote>
<br />
<blockquote class="tr_bq">
<b>Note:</b> This mapping file needs to be placed in one of following locations:
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{MAVEN_WAR_PROJECT}/src/main/resources/META-INF/richfaces/</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{JAR}/META-INF/richfaces/</span> <br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{WAR}/WEB-INF/classes/META-INF/richfaces/</span></blockquote>
<br />
<blockquote class="tr_bq">
<b>Note:</b> <span style="font-family: 'Courier New', Courier, monospace;">jquery-alternative-version.js</span> needs to be placed in your project on one of following locations (JSF resource:
<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{MAVEN_WAR_PROJECT}/src/main/webapp/resources</span> /<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{MAVEN_JAR_PROJECT}/src/main/resources/</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{JAR}/META-INF/resources/</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">{WAR}/resources/</span></blockquote>
<span style="font-size: large;">Another example</span><br />
<br />
Or you can similarly map <span style="font-family: 'Courier New', Courier, monospace;">jsf.js</span> resource:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">javax.faces\:jsf.js=patched-jsf.js
</span><br />
<blockquote class="tr_bq">
<b>Note:</b> notice the backslash before the : (it is the escape sequence, required in the properties file)</blockquote>
<br />
<span style="font-size: x-large;">Map several resources to one</span><br />
<br />
Another requirement comes when you are using several component libraries in one project - oh crap, and they all are based on jQuery and each of them uses another version!<br />
<br />
One of solutions here (except using <span style="font-family: 'Courier New', Courier, monospace;">jQuery.noConflict()</span>) is map all requests for different <span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span> versions to one. Let’s define following mapping:<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"># RichFaces bundled jQuery (following line is not necessary)</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">jquery.js=jquery.js</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"># PrimeFaces bundled jQuery</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">primefaces\:jquery/jquery.js=jquery.js</span><br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;"># Another project bundled jQuery</span><br />
<span style="font-family: 'Courier New', Courier, monospace;">another\:jquery.js=jquery.js
</span><br />
<span style="font-family: inherit;"><br /></span><br />
<span style="font-family: inherit;">Okay, now all these libraries use only one version of jQuery - the RichFaces one. ;-)</span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSIMh4_F8cG_wjljaZ12Yqjr3NcTUQVpAKrcjDDEM2JyTG2v-Do2wcp6iDG2eCZjxEkXFrUHlpsoTS6GC07GZH6k0_BmQElpOhMM10et3NvrNpfC0RN1amPvDdKGmyBk4y_QOjShpbA1x3/s1600/several-resources-to-one.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="283" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhSIMh4_F8cG_wjljaZ12Yqjr3NcTUQVpAKrcjDDEM2JyTG2v-Do2wcp6iDG2eCZjxEkXFrUHlpsoTS6GC07GZH6k0_BmQElpOhMM10et3NvrNpfC0RN1amPvDdKGmyBk4y_QOjShpbA1x3/s320/several-resources-to-one.png" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: 'Courier New', Courier, monospace;">another:jquery.js</span> mapped to <span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span></td></tr>
</tbody></table>
<div style="text-align: center;">
<br /></div>
<br />
<span style="font-size: x-large;">Using external resources</span><br />
<br />
But resource mapping isn't used only for mapping requests to serve local resources, but external HTTP resources can be served as well.<br />
<br />
Let’s show-case this on sample of mapping requests of jQuery library to <a href="http://docs.jquery.com/Downloading_jQuery#CDN_Hosted_jQuery" target="_blank">CDN</a> [1].<br />
<br />
<span style="font-family: 'Courier New', Courier, monospace;">jquery.js=http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
</span><br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWMdHiN5eEQNhccpEhRcKY5BXjjeOnCSe50D4hKqdwz7n56bD2q3GeHNxY7Jxr6r8XHhlMy5ca73FenPh_FAKOGi0wYwYgiOTXpSJmsT5ilDzZBDhUX_6kMgqQY1P9hS3uUBueW-o1AS3u/s1600/cdn.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="172" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWMdHiN5eEQNhccpEhRcKY5BXjjeOnCSe50D4hKqdwz7n56bD2q3GeHNxY7Jxr6r8XHhlMy5ca73FenPh_FAKOGi0wYwYgiOTXpSJmsT5ilDzZBDhUX_6kMgqQY1P9hS3uUBueW-o1AS3u/s400/cdn.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: 'Courier New', Courier, monospace;">jquery.js</span> mapped to CDN resource</td></tr>
</tbody></table>
<br />
<br />
<span style="font-size: x-large;">Moving resources to servers with static content</span><br />
<br />
With RichFaces, you can even move all your resources to a server which serves static requests (like Apache Httpd) to lighten your application server. Just map all your resources to HTTP locations.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_UCszV5NDV5jhy5_EqIERw3k1AR58cC6C6gGL1RvDoBuHkaUR-cVg9Ml650wAUqRDjMcZXP3QyKxRNtqr-63kTs5YcHMVKkhHWiGVb3KZqdsRYK6TnCUkZJqJ7Hnu-Jc9YIoHa2vIKgE5/s1600/static-server.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_UCszV5NDV5jhy5_EqIERw3k1AR58cC6C6gGL1RvDoBuHkaUR-cVg9Ml650wAUqRDjMcZXP3QyKxRNtqr-63kTs5YcHMVKkhHWiGVb3KZqdsRYK6TnCUkZJqJ7Hnu-Jc9YIoHa2vIKgE5/s400/static-server.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">All application resources are mapped to static server.</td></tr>
</tbody></table>
<br />
<br />
<br />
That's it, RichFaces Resource Mapping really can save your life! ;-)</div>Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com14tag:blogger.com,1999:blog-3862595054202795438.post-45085219492070512672012-02-09T09:44:00.000-08:002012-02-09T13:57:04.608-08:00Optimizing Resource Loading with RichFaces 4.2HTTP connection is an expensive commodity. But if you will look on a traditional rich JSF application, there are many resources for components which need to be loaded, thus many connections need to be established.<br />
<br />
The high number of HTTP requests significantly affects application load time and thus overall performance. This applies especially for high-latency network connections like geographically distant places and for mobile networks.<br />
<br />
Here you can see profile of loading RichFaces page. You can view sequence of requests made by browser to load all the page dependencies.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl_LFh4rG9RAWGsjdjGmFeNXM4HKt9oQW2ixrN9d_zoER53325JHfYSh2IFRpqRJGAld6BDfOHNOmaFwvdENq9rFVqr2VMF2wz_3X8b5BaC8q-OgILsKde0NiRL1m1FnQ2hVAxLY6gWWDQ/s1600/ro-blog-1.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="253" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgl_LFh4rG9RAWGsjdjGmFeNXM4HKt9oQW2ixrN9d_zoER53325JHfYSh2IFRpqRJGAld6BDfOHNOmaFwvdENq9rFVqr2VMF2wz_3X8b5BaC8q-OgILsKde0NiRL1m1FnQ2hVAxLY6gWWDQ/s400/ro-blog-1.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">JavaScript dependencies</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhregvjEP5tVdKLLEzo9_JcddFQfQApYp44JhY7cgF6YtjuPakaMAFrvqe1Yd5IwrIqiwQHjKC2eohrMaJrRZfVNYUbu9-DVmc5VAjc6h-q48n8zq95_QKNjuiGSpFAWJd9q-iiNrTCau_f/s1600/ro-blog-2.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="117" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhregvjEP5tVdKLLEzo9_JcddFQfQApYp44JhY7cgF6YtjuPakaMAFrvqe1Yd5IwrIqiwQHjKC2eohrMaJrRZfVNYUbu9-DVmc5VAjc6h-q48n8zq95_QKNjuiGSpFAWJd9q-iiNrTCau_f/s400/ro-blog-2.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">CSS dependencies</td></tr>
</tbody></table>
<br />
When you will look into page source, you will see these resource dependencies defined in the head of the page:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkLgIANpTOVZdLOxGM-IOakMo6ZNec01yT08Iqv_ksxCsN407_oSrAog2WaWk1-WTxyqySiDf74sErCDDiorkGkW92LoDJXmYWdEMlaodvp5xNi4FWDvMlIJkGnY0tTq37erj_T6ovGyTS/s1600/ro-blog-3.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgkLgIANpTOVZdLOxGM-IOakMo6ZNec01yT08Iqv_ksxCsN407_oSrAog2WaWk1-WTxyqySiDf74sErCDDiorkGkW92LoDJXmYWdEMlaodvp5xNi4FWDvMlIJkGnY0tTq37erj_T6ovGyTS/s400/ro-blog-3.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: 'Courier New', Courier, monospace;"><head></span> section will all the dependency links</td></tr>
</tbody></table>
<br />
<br />
Simple optimization of resource loading comes in form of <b>aggregating several requests into one</b>, thus lightening the load on both the server and the network.<br />
<br />
<span style="font-size: x-large;">The RichFaces Way</span><br />
<br />
RichFaces offers you the simplest solution available - all RichFaces resources packaged in one file for each resource type - one JavaScript package (<span style="font-family: 'Courier New', Courier, monospace;">packed.js</span>), one CSS package (<span style="font-family: 'Courier New', Courier, monospace;">packed.css</span>).<br />
<br />
The only thing you need to do is turn the packaging feature on.<br />
<br />
<span style="font-size: x-large;">Enabling resource optimization</span><br />
<br />
Open the <span style="font-family: 'Courier New', Courier, monospace;">web.xml</span> file in your project and add following lines:<br />
<br />
<pre class="brush: xml"><context-param>
<param-name>org.richfaces.resourceOptimization.enabled</param-name>
<param-value>true</param-value>
</context-param>
</pre>
<blockquote class="tr_bq">
<b>Notes: </b>Resource optimization was introduced in RichFaces 3.x as resource loading strategies.<br />
<br />
It was reintroduced in 4.1, but for 4.2, its configuration was slightly changed to be more clear and concise. This blog reflects changes committed with RichFaces 4.2.0.CR1. Read more about changes in <a href="http://blog.bleathem.ca/2012/02/richfaces-420cr1-release-announcement.html" target="_blank">release blog</a>.</blockquote>
<br />
Now, deploy and open your application. When you will open page source, you can see that number of page resources (<span style="font-family: 'Courier New', Courier, monospace;"><script></span> and <span style="font-family: 'Courier New', Courier, monospace;"><link></span> elements in the head) was significantly decreased:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPnSzjL1HNHDzqXqLGaR3MUQlKYBj_jkKNNkZJPe6Up0eCRPy00AVnbt06VVpP9Ag72rEf-v3n9tJg-lQTUx4XAyH3WDuw9IlRi95sJPvjsT0Em9dES5IdwTSrca8kolp1wyzVbrGEtjeT/s1600/ro-blog-6.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPnSzjL1HNHDzqXqLGaR3MUQlKYBj_jkKNNkZJPe6Up0eCRPy00AVnbt06VVpP9Ag72rEf-v3n9tJg-lQTUx4XAyH3WDuw9IlRi95sJPvjsT0Em9dES5IdwTSrca8kolp1wyzVbrGEtjeT/s400/ro-blog-6.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span style="font-family: 'Courier New', Courier, monospace;"><head></span> section with links to optimized resource dependencies</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
Also the page load profiles looks much better:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT9rWcf3GekdmRPCyMAVgRkdKU_pP-qHNnFc1N4Tx_HulHbaWj5mzduEJ5fE4BDvGZ9v2yyEMojD6uz4x4XBKtoWrl8XsAttKeiT6XzVACxST4Shjai6n7YeKnLkM8CtP_KHoMjJqVOGid/s1600/ro-blog-4.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="63" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiT9rWcf3GekdmRPCyMAVgRkdKU_pP-qHNnFc1N4Tx_HulHbaWj5mzduEJ5fE4BDvGZ9v2yyEMojD6uz4x4XBKtoWrl8XsAttKeiT6XzVACxST4Shjai6n7YeKnLkM8CtP_KHoMjJqVOGid/s400/ro-blog-4.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Optimized JavaScript resources</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYOjcn-frDE_vgYOiaEcR3ZYNBeT09GnkgeD9qH7nQheXWVmJLd_FbB_yHDZ9ZtHahVVbcSuZeF-P9ZWq_DBgF7KGASvBucKTFSgoxARnpvzBvvg2vyVL25cUIQ8281filPebhwLSMpkeU/s1600/ro-blog-5.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="62" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYOjcn-frDE_vgYOiaEcR3ZYNBeT09GnkgeD9qH7nQheXWVmJLd_FbB_yHDZ9ZtHahVVbcSuZeF-P9ZWq_DBgF7KGASvBucKTFSgoxARnpvzBvvg2vyVL25cUIQ8281filPebhwLSMpkeU/s400/ro-blog-5.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Optimized CSS resources</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<br />
<span style="font-size: x-large;">Packaging and Compression</span><br />
<br />
Resource optimization itself is composed from two features: packaging and compression.<br />
<br />
Packaging phase <b>aggregates several resources into one</b>, while compression do <b>JavaScript/CSS compression and obfuscation </b>(powered by YUI compressor).<br />
<br />
By default, both packaging and compression are applied on RichFaces resources (in production stage).<br />
<br />
However resource optimization is also controlled by the stage of the project. Why?<br />
<br />
<span style="font-size: x-large;">Development mode</span><br />
<br />
Packaging is not convenient in development project stage.<br />
<br />
When you are developing application, some problems may occur in form of JavaScript errors or wrong look because of styling issues. In these cases it’s handy to debug these JavaScript or CSS resources in uncompressed state.<br />
<br />
The state of the project is controlled with <span style="font-family: 'Courier New', Courier, monospace;">web.xml</span> switch:<br />
<br />
<pre class="brush: xml"><context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
</pre>
<br />
It will force load uncompressed, but packaged resources - great for debugging the app!<br />
<br />
<span style="font-size: x-large;">Troubleshooting</span><br />
<br />
When you will have any issues, be sure to look into<br />
<br />
<a href="https://community.jboss.org/wiki/Troubleshooting-ResourceOptimization" target="_blank">Troubleshooting - Resource Optimization article</a><br />
<br />
<br />
<span style="font-size: x-large;">Summary</span><br />
<br />
As you can see, with RichFaces Resource Optimization, you can achieve<b> decrease of number of resource requests</b>. These resources are also cached by the browsers, so after first page, client get <b>perfect responsiveness</b>.<br />
<br />
On the other hand, you are <b>increasing the size of resources</b> which are necessary to be loaded on first request, since all of the RichFaces component resources are bundled in one file.<br />
<br />
You need to choose between fast start of the app and responsiveness of the app after first request.<br />
<br />
What's the best option for your application, it’s up to you! ;-)<br />
<br />
<span style="font-size: x-large;">Future Improvements?</span><br />
<br />
We have several ideas how to improve resource loading if it is really critical for your application:<br />
<br />
<ul>
<li>several smaller files packaged for certain occasions (core, tables, panels, etc.)</li>
<li>provide you maven plugin which will create custom packages just to fit your application needs during the application build!</li>
</ul>
<br />
<br />
If you would like to implement any of these features, or have any other ideas for enhancements, be sure to let us know!<br />
<br />Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com10tag:blogger.com,1999:blog-3862595054202795438.post-16051480859127800932012-02-08T08:03:00.000-08:002012-02-09T15:49:08.088-08:004 simple steps for RichFaces Push with 4.2<br />
RichFaces Push is a pretty useful component, since it enables you do a server-side push technique (pushing content from a server to a client asynchronously). What makes this component so attractive when there are plenty of other ways to achieve this?<br />
<br />
RichFaces is enabling application developers to build on top of push <b>without any additional complexity</b>.<br />
<br />
It is enough to use only one interface (which can even be injected using CDI) on the server side. And you need only one component on the client side: <span style="font-family: 'Courier New', Courier, monospace;"><a4j:push></span>.<br />
<br />
In this blog, I’m not going to show all possibilities of how to use the RichFaces Push - instead, I will show you, how to configure this component to work on your favorite container including small sample page and bean. Why?<br />
<br />
We have <b>simplified Push drastically</b> along the way from 4.0 to 4.1 and we are continuing in 4.2 to make the process of setting up a project with Push as simple as possible! That’s why I’m sharing our progress with you.<br />
<br />
<span style="font-size: x-large;">Let’s start...</span><br />
<br />
We will start with<b> SimpleApp maven archetype </b>- it doesn’t have Push configured. It assumes that you have following dependencies installed:<br />
<ul>
<li>Maven 3.0.3+</li>
<li>JDK 1.6</li>
<li>your favorite editor</li>
<li>your favorite servlet container or application server</li>
</ul>
<br />
<span style="font-size: x-large;">Creating the project stub</span><br />
<br />
Okay, let’s create the new app based on the SimpleApp archetype:<br />
<br />
<pre class="brush: plain">mvn archetype:generate -DarchetypeGroupId=org.richfaces.archetypes -DarchetypeArtifactId=richfaces-archetype-simpleapp -DgroupId=my.domain -DartifactId=simplepush -Dversion=1.0-SNAPSHOT -Dpackage=my.domain -DarchetypeVersion=4.2.0.CR1
</pre>
<br />
<br />
<blockquote class="tr_bq">
Note: <a href="http://docs.jboss.org/richfaces/latest_4_X/Developer_Guide/en-US/html/chap-Developer_Guide-Getting_started_with_RichFaces.html#sect-Component_Reference-Using_RichFaces_with_Maven-Using_the_RichFaces_project_archetype" target="_blank">RichFaces Developer Guide</a> may help you when you get stuck with setting up environment:</blockquote>
<br />
<br />
We have created a stub for our application, now you can try to deploy it on your favorite container and verify basic functionality:<br />
<br />
<a href="http://localhost:8080/simplepush/" target="_blank">http://localhost:8080/simplepush/</a><br />
<br />
You should see one ajaxified input and when typing, you should see appropriately updated output.<br />
<br />
<span style="font-size: x-large;">4 simple steps for Push</span><br />
<br />
What are the modifications we will undertake next?<br />
<ul>
<li>install Atmosphere libraries</li>
<li>register a servlet (if necessary)</li>
<li>add a managed bean with an action triggering a push event</li>
<li>add an <span style="font-family: 'Courier New', Courier, monospace;">a4j:push</span> component to the a page</li>
</ul>
<br />
<span style="font-size: x-large;">Installing Atmosphere libraries</span><br />
<br />
Atmosphere is the only runtime dependency for RichFaces Push. Atmosphere enables integration with various containers and interoperability between browsers and push techniques (websockets, long-polling).<br />
<br />
In order to install Atmosphere in your project, add following lines into your <span style="font-family: 'Courier New', Courier, monospace;">pom.xml</span>, in the section <span style="font-family: 'Courier New', Courier, monospace;"><dependencies></span>:<br />
<br />
<pre class="brush: xml"><dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
</dependency>
</pre>
<br />
<blockquote class="tr_bq">
<b>Note:</b> version of the dependency is automatically managed by importing the <span style="font-family: 'Courier New', Courier, monospace;">richfaces-bom</span>, that’s why you don’t need to specify <span style="font-family: 'Courier New', Courier, monospace;"><dependency><version></span> here.</blockquote>
<br />
<span style="font-size: x-large;">Registering PushServlet</span><br />
<br />
RichFaces Push requires <span style="font-family: 'Courier New', Courier, monospace;">PushServlet</span> registered for web application in order to connect to a container and listen for push requests.<br />
<br />
In <b>Servlets 3.0 and higher environments</b> (JBoss AS 6 and 7, Tomcat 7, GlassFish 3, etc.), the servlet will be registered automatically by including RichFaces Core libraries on classpath.<br />
<br />
However in <b>Servlets 2.5 and lower</b>, servlet needs to be registered manually in <span style="font-family: 'Courier New', Courier, monospace;">web.xml</span>:<br />
<br />
<pre class="brush: xml"><!-- Push Servlet - listens for user sessions -->
<servlet>
<servlet-name>Push Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Push Servlet</servlet-name>
<url-pattern>/__richfaces_push</url-pattern>
</servlet-mapping>
<!-- setups servlet-mapping in RichFaces configuration -->
<context-param>
<param-name>org.richfaces.push.handlerMapping</param-name>
<param-value>/__richfaces_push</param-value>
</context-param>
</pre>
<br />
<span style="font-size: x-large;">Adding action to the managed bean</span><br />
<br />
Let’s open and edit <span style="font-family: 'Courier New', Courier, monospace;">RichBean.java</span> under <span style="font-family: 'Courier New', Courier, monospace;">src/main/java</span> in package you have defined. Add following methods:<br />
<br />
<pre class="brush: java">public Date getDate() {
return new Date();
}
public void push() throws MessageException {
TopicKey topicKey = new TopicKey("sampleAddress");
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, "empty message");
System.out.println("push event");
}
</pre>
<br />
<span style="font-size: x-large;">Adding component to the page</span><br />
<br />
Open and edit <span style="font-family: 'Courier New', Courier, monospace;">index.xhtml</span> file under <span style="font-family: 'Courier New', Courier, monospace;">src/main/webapp</span> directory.<br />
<br />
Replace contents inside of <span style="font-family: 'Courier New', Courier, monospace;"><h:form></span> with following snippet:<br />
<br />
<pre class="brush: xml"><a4j:commandButton value="Push!" action="#{richBean.push}" />
<a4j:push address="sampleAddress">
<a4j:ajax event="dataavailable" render="outputDate" />
</a4j:push>
<a4j:outputPanel id="outputDate">
Date: #{richBean.date}
</a4j:outputPanel>
</pre>
<br />
<span style="font-size: x-large;">Accessing sample</span><br />
<br />
When opening <a href="http://localhost:8080/simplepush/" target="_blank">http://localhost:8080/simplepush/</a> again, you should see one button and output with the date.<br />
<br />
When clicking on the button, the date should be updated.<br />
But it’s not simple AJAX!<br />
<br />
In the background, <span style="font-family: 'Courier New', Courier, monospace;"><a4j:push></span> opens long-lived session to the server. When you hit button, a server action method publishes the message and RichFaces sends it to all clients which are subscribed to listen on given address topic (determined by the <span style="font-family: 'Courier New', Courier, monospace;">TopicKey</span>). When clients receive that message, an event is fired in order to trigger an AJAX update of the date output.<br />
<br />
An advantage over the traditional poll technique is that clients are updated without the necessity of periodically connecting to the server - it off-loads server and provides immediate client updates.<br />
<br />
<blockquote class="tr_bq">
Note: I know, this sample is quite artificial, because real-world applications won’t use a4j:push and updated area on the same page, but the purpose of the blog was mainly show you configuration of the RichFaces Push.</blockquote>
<br />
<span style="font-size: x-large;">Troubleshooting</span><br />
<br />
If anything didn’t work for you, perhaps you just used the wrong environment and/or you need to configure something additionally, just look at <a href="https://community.jboss.org/wiki/StartingWithRichFacesPushOnVariousServletContainers" target="_blank">Starting with RichFaces Push on Various Containers</a> article.<br />
<br />
<br />
<span style="font-size: x-large;">Summary</span><br />
<br />
It was necessary to only<b> add Atmosphere libraries</b> to the project generated from SimpleApp archetype, we have made sure that the <b>push servlet is registered</b> and we have setup <b>page and bean</b> with action simply - just enough for showcasing Push component.<br />
<br />
Pretty simple, isn’t it?<br />
<br />
Who knows what I will cover next time regarding the Push technology in RichFaces? :-)<br />
<br />
Hmm, just stay tuned!Lukáš Fryčhttp://www.blogger.com/profile/15031892769510032712noreply@blogger.com7tag:blogger.com,1999:blog-3862595054202795438.post-89975267588554411062011-10-19T04:03:00.000-07:002011-10-19T05:11:06.290-07:00Arquillian Ajocado 1.0.0.CR2 Released<b>RichFaces-Selenium</b> 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əʊ/.<div><br /></div><div>And... <b>Arquillian Ajocado 1.0.0.CR2</b> has been released!</div><div><br /></div><div><span class="Apple-style-span" style="font-size:180%;">Introducing Ajocado</span></div><div><br /></div><div>Ajocado (formerly known as <span style="font-weight: bold;">RichFaces-Selenium</span>) has obviously exceeded the initiative which it has been formerly intended for</div><div><br /></div><div>RichFaces-Selenium has been integrated with <b>Arquillian</b> and its very own <b>Drone</b> extension to enable advanced lifecycle management which these projects offers.</div><div><br /></div><div>The move is really significant, because it is now obvious that project has developed to full-featured wrapper for Selenium 1.x API.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:180%;">Where it is deployed already?</span></div><div><br /></div><div>Ajocado is now used by some other teams across <span style="font-weight: bold;">JBoss Quality Assurance department</span>, namely for testing of <span style="font-weight: bold;">Seam</span>, <span style="font-weight: bold;">Portal</span>, <span style="font-weight: bold;">Spring</span>, <span style="font-weight: bold;">GWT</span> and <span style="font-weight: bold;">Struts</span> (<a href="http://www.jboss.com/products/wfk/"><span style="font-weight: bold;">Web Framework Kit</span></a>) and it is considered to be used for automation of functional test suites of other projects.</div><div><br /></div><div>But from the stand-point from team, where initial ideas had grown - RichFaces - Ajocado is the project which<a href="http://relation.to/18902.lace"> enabled automation of its functional test suite</a> (counting 2350 unique tests) for this UI component suite.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:180%;">Why it matters?</span></div><div><br /></div><div>Why the new wrapper for Selenium 1.x matters? You can read more in introduction in <a href="https://docs.jboss.org/author/display/ARQAJO/Home">Ajocado project documentation</a>:</div><br /><span style="font-family:courier new;"></span><blockquote style="font-family:trebuchet ms;">Ajocado project is designed as enhancement of Selenium project focused on <span style="font-weight: bold;">rapid development</span> and <span style="font-weight: bold;">usability</span> in Java environment.<br /><ul><li>API is <span style="font-weight: bold;">straightforward</span> and enforces tester to write <span style="font-weight: bold;">Ajax-enabled</span> tests,</li><li>internals enables <span style="font-weight: bold;">JQuery location strategy</span>, which improves performance of the tests,</li><li>brings concepts for on-the-fly injection of own <span style="font-weight: bold;">selenium extensions</span> and also <span style="font-weight: bold;">extensions to page code</span> (enabling advanced testing features)</li><li>allows <span style="font-weight: bold;">command interception</span> and <span style="font-weight: bold;">request interception</span>,</li><li>it brings <span style="font-weight: bold;">type-safe</span> equivalent of Selenium version 1.x, enabling auto-completion and rapid development style,</li><li>integrates with <span style="font-weight: bold;">Arquillian</span> using <span style="font-weight: bold;">Arquillian Drone</span> extension.</li></ul>With all the concepts above, Ajocado brings new power to space of enterprise Java-based testing.</blockquote><br /><div><span style="font-size:180%;"><br /></span></div><div><span class="Apple-style-span" style="font-size:180%;">Release Candidate 2</span></div><div><span class="Apple-style-span"><br /></span></div><div>Second release candidate was lead in spirit of stabilization, component upgrades and finishing documentation - you may also want to review <a href="https://issues.jboss.org/secure/ReleaseNote.jspa?projectId=12311170&version=12318054">complete release notes</a>.<br /><br /><span style="font-size:180%;">Future</span><br /><br />We would like to introduce support for <span style="font-weight: bold;">Selenium 2 API</span> and migrate more cool features which can be seen not only in RichFaces test suite... just stay tuned. ;-)<br /></div><div><br /></div><div><br /></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-84645144608290042232011-09-20T10:52:00.000-07:002011-09-21T07:54:43.311-07:00Improvements of RichFaces Editor in Milestone2I have blogged about RichFaces Editor component recently which has been available since RichFaces 4.1.0.Milestone1.<div><br /></div><div>In scope of Milestone2, Editor has been improved with several pretty new and cool features:</div><div><ul><li><b>@lang</b> - support for localization</li><li><b>@config</b> - fine-grained configuration</li><li><b>@ondirty</b> - event handler for live changes in editor's content</li><li><b>@skin</b> - switches between CKEditor skins</li><li>created <b>new skin 'richfaces'</b></li><li><b>resource optimization</b> (editor does not load any unnecessary resources)</li></ul><div><span class="Apple-style-span" ><b>Skinnability</b></span></div></div><div><br /></div><div>rich:editor now bundles <b>'richfaces' skin</b> for CKEditor, which makes it's appearance close to other components from RichFaces suite, including all of controls and popups.</div><div><br /></div><div>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.</div><div><br /></div><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvl37M8Am5Ck9jCBR9gkWPq33T_Vs4bWZV7wyQhMTTAMWLh6LHePRCcm3-DXu1fDbF6-T_xTOgP6qHJJkHHj6tY7oTkMvWaiacfAyfih8M-g38T1fGKkKFM32o2M9h7EFH1hJB5sbGT5gy/s1600/Screenshot.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvl37M8Am5Ck9jCBR9gkWPq33T_Vs4bWZV7wyQhMTTAMWLh6LHePRCcm3-DXu1fDbF6-T_xTOgP6qHJJkHHj6tY7oTkMvWaiacfAyfih8M-g38T1fGKkKFM32o2M9h7EFH1hJB5sbGT5gy/s400/Screenshot.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5654506456131970562" style="cursor: pointer; width: 400px; height: 191px; " /></a></div><div><br /></div><div><span class="Apple-style-span" ><b>Configuration</b></span></div><div><br /></div><div>Most valuable for customization of Editor is <b>@config attribute</b> which provides fine-grained configuration of editor. Alternatively, you can use facet with name "config", which is even better for detailed customization.</div><div><br /></div><div>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 <a href="https://github.com/richfaces/dev-examples/blob/develop/input-demo/src/main/webapp/examples/editor.xhtml">developer sample</a>. For all available options, you can consult <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Available_Configuration_Options">CKEditor's configuration documentation</a>.</div><div><br /></div><div>@config attribute is certainly able to expand <b>EL expressions</b>, so you can made your editor configuration dynamic.</div><div><br /></div><div><span class="Apple-style-span" ><b>Dirtiness</b></span></div><div><br /></div><div>Another feature which makes CKEditor integration unique is <b>"dirty" event</b> (@ondirty event handler) which is fired when you change editor content with any available action.</div><div><br /></div><div>Using this flag, you can easily implement auto-saving (with queue attached) or update periodically display of another client with edited value.</div><div><br /></div><div>Enjoy the tweaked implementation and let us know on <a href="http://community.jboss.org/en/richfaces">RichFaces forums</a>!</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-79547300759590106242011-09-20T01:45:00.000-07:002011-09-20T02:12:46.889-07:001-day conference in Vienna - Slides and Wrap upLast event I have attended was a great success.<div><br /></div><div>I have made two talks there for which I would like to share slides with you:</div><div><ul><li><b>RichFaces 4 rolling to Mobile Era</b> (<a href="http://www.slideshare.net/lfryc/richfaces-4-rolling-to-mobile-era">Slides</a> | <a href="http://lanyrd.com/2011/jsf-and-richfaces-workshop-conference/sgzmd/">Lanyard</a>)</li><li><b>Testing JSF with Arquillian and Selenium</b> (<a href="http://www.slideshare.net/lfryc/testing-jsf-with-arquillian-and-selenium">Slides</a> | <a href="http://lanyrd.com/2011/jsf-and-richfaces-workshop-conference/sgzmf/">Lanyard</a>)</li></ul><div>I had got very valuable feedback from attendees on both sessions, thank you!</div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3862595054202795438.post-60750783352092902192011-08-31T12:54:00.000-07:002011-08-31T13:18:14.805-07:00Talking on RichFaces@mobiles and on JSF testing in Vienna<div style="background-color: transparent; "><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">I would like to invite you on <b><a href="http://www.objective.de/en/newspress/uniqa-workshop/">JSF and RichFaces workshop UNIQA</a></b> held at September 7-9th in Vienna, Austria.</span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">
<br /></span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"> While first two days will be <a href="http://mkblog.exadel.com/2011/08/jsfrichfaces-workshop-plus-1-day-conference-in-vienna-austria-sept-7-9/">Max Katz covering thoroughly JSF and RichFaces</a>, last conference day will be dedicated to topics related to RichFaces.</span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">
<br /></span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"> I will be presenting on what can <b><span class="Apple-style-span" >RichFaces offer in upcoming mobile era</span></b> </span><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">and what are current <b><span class="Apple-style-span" >state-of-art techniques in testing JSF applications</span></b> </span><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">with Arquillian, Selenium and JSFUnit.</span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">
<br /></span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"> You can also see <a href="http://www.objective.de/en/newspress/uniqa-workshop/programm/">detailed program</a> and you can watch the <a href="http://lanyrd.com/2011/jsf-and-richfaces-workshop-conference/">event on Lanyard</a>.</span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;">
<br /></span></div><div style="background-color: transparent; "><span class="Apple-style-span" style="font-size: 15px; white-space: pre-wrap;"> Looking forward to meet you there!</span></div></div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-3862595054202795438.post-23077298630279625842011-08-18T14:00:00.000-07:002011-08-22T09:31:52.024-07:00Push Improvements in RichFaces 4.1The lot of improvements has been done in <span style="font-weight: bold;">4.1.0.Milestone1</span> and specifically Push component has been tweaked a much under the hood.
<br />
<br />Push component itself is very important for <span style="font-weight: bold;">interactive enterprise applications</span> and we are trying to design its API as much clean as possible.
<br />
<br />RichFaces team, and Nick Belaevski namely, did great job to<span style="font-weight: bold;"> decouple Push from JMS</span> to avoid unnecessary overhead with connecting to messaging provider.
<br />
<br />On the client-side, changes have been done to support <span style="font-weight: bold;">WebSockets</span> 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.
<br />
<br />Specifically for <span style="font-weight: bold;">4.0.0.Final</span> 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 <span style="font-weight: bold;">PushServlet</span>, 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.
<br />
<br />On the server-side, we have introduced option for <span style="font-weight: bold;">disabling Push and JMS</span> 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:
<br />
<br /><code><pre><context-param>
<br /> <param-name>org.richfaces.push.jms.disable</param-name>
<br /> <param-value>true</param-value>
<br /></context-param></pre></code>
<br />
<br />If you would like to <span style="font-weight: bold;">try Push</span>, you may be pleased that it is now in <span style="font-weight: bold;">RichFaces Showcase</span>, however be aware that it can't be seen in <a href="http://richfaces-showcase.appspot.com/">demo hosted on GAE</a> since this hosting doesn't support JMS. You will need to deploy it at own, and in such case I strongly recommend you <a href="http://rik-ansikter.blogspot.com/2011/07/richfaces-heading-to-jboss-as7-era.html">my previous blog</a>.
<br />
<br />And what you may expect in near future? We are working on<span style="font-weight: bold;"> integration with <a href="http://www.adam-bien.com/roller/abien/entry/java_ee_6_observer_with">CDI Events</a></span> feature<span style="font-weight: bold;"></span>, 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.
<br />
<br />But there were also <span style="font-weight: bold;">issues</span> which we had to overcome - one of them is <a href="https://issues.jboss.org/browse/RF-11064">issue with Atmosphere and JBoss Web</a> which will be addressed also in M2.
<br />
<br />To overcome this issue, you can temporary switch to using blocking I/O approach:
<br />
<br /><code><pre><context-param>
<br /> <param-name>org.atmosphere.useBlocking</param-name>
<br /> <param-value>true</param-value>
<br /></context-param></pre></code>
<br />
<br />And off-course, if you have <span style="font-weight: bold;">ideas how to make Push more user-friendly</span> than it already is, give us know in <a href="http://community.jboss.org/en/richfaces">RichFaces community discussions</a>. We will be pleased to hear from you!
<br />Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3862595054202795438.post-79318474710949319122011-08-15T14:00:00.000-07:002011-08-15T14:00:04.191-07:00Editor for RichFaces 4.1You have been requesting and we now answer: RichFaces gets pretty new Editor component, which was lacking from 4.0.0.Final release.
<br />
<br />This component can be found in upcoming <span style="font-weight: bold;">4.1.0.Milestone1</span> 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.
<br />
<br />Editor component is using <a href="http://ckeditor.com/">CKEditor</a> implementation internally and it is able to switch between two configurations of toolbar set: <span style="font-weight: bold;">basic</span> and <span style="font-weight: bold;">full</span>.
<br />
<br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivOvlgeXJaEUWFWrA4v8S5uJbnas2YMWuutQtyuaJaTH7_LkkERsWcO9WRr2mLn7UMyVqJuN8d-oiwkRVCtlS8ei_pROnebUt4lUODihOLIcwPAl4HR__rzmEvtieJhRYvtaUjOn-JnW1o/s1600/Screenshot-23.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 275px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivOvlgeXJaEUWFWrA4v8S5uJbnas2YMWuutQtyuaJaTH7_LkkERsWcO9WRr2mLn7UMyVqJuN8d-oiwkRVCtlS8ei_pROnebUt4lUODihOLIcwPAl4HR__rzmEvtieJhRYvtaUjOn-JnW1o/s400/Screenshot-23.png" alt="" id="BLOGGER_PHOTO_ID_5640099601474847346" border="0" /></a>
<br />
<br />It also integrates nicely with rest of JSF 2, thus you can bind e.g. <span style="font-weight: bold;">behavior for event</span> denoting the editor content has been changed:
<br /><code>
<br /><pre><rich:editor toolbar="full" value="#{article.text}">
<br /> <a4j:ajax event="change" action="#{article.save}" />
<br /></rich:editor>
<br /></pre></code>
<br />It is important to note that Editor uses <span style="font-weight: bold;">resource handling servlet</span> 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.
<br />
<br />However in Servlet 2.5 and older environments, it is necessary to register this servlet manually in web.xml:
<br /><code>
<br /><pre><servlet>
<br /> <servlet-name>Resource Servlet</servlet-name>
<br /> <servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<br /> <load-on-startup>1</load-on-startup>
<br /></servlet>
<br />
<br /><servlet-mapping>
<br /> <servlet-name>Resource Servlet</servlet-name>
<br /> <url-pattern>/org.richfaces.resources/*</url-pattern>
<br /></servlet-mapping>
<br /></pre></code>
<br />I would appreciate <a href="http://community.jboss.org/en/richfaces">your feedback on forums</a>, how this component stands.
<br />
<br />You can also watch <a href="http://community.jboss.org/wiki/RF4Editor">what is being planned for future</a>.Unknownnoreply@blogger.comtag:blogger.com,1999:blog-3862595054202795438.post-23821897873112005392011-07-19T09:18:00.000-07:002011-07-20T03:47:06.258-07:00RichFaces Heading to JBoss AS7 Era<span><span><div>I’m very excited to show RichFaces users how easy (and productive) life can be when running on JBoss Application Server 7!</div><div><br /></div><div>It’s not necessary to enumerate all the features of JBoss AS7 (there are <a href="http://www.jboss.org/as7/articles.html">others that have already done so</a>), but it’s at least worth mentioning that AS7 is extremely light-weight - and that’s the UI that developers are interested in!</div><div><br /><br /></div><div style="color: rgb(102, 204, 204);"><span class="Apple-style-span" style="font-size:180%;">Light-weight containers - Java EE features ready web developers?</span></div><div><br /></div><div>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 <a href="http://bit.ly/jbossas7-vs-firefox">AS7 fighting in the wild</a>.</div><div><br /></div><div>What’s so great about AS7 and why should you use it? Let’s start with some <b>benchmarks of real deployment</b>:</div><div><br /></div><div><b>AS7</b> - 10.907s - <b>11s</b></div><div><b>AS6</b> - 31.248s - <b>31s</b></div><div><b>Tomcat 7</b> - 17.313s - <b>17s</b></div><div><b>Tomcat 6</b> - 7.065s - <b>7s</b></div><div><br /></div><div><br /></div><div>This certainly looks promising.</div><div><br /></div><div>Just note that these results are measured from the startup of the RichFaces Showcase application, which currently employs several hot features of the <b>Java EE stack: CDI, JPA, JMS and JSF</b>.</div><div><br /></div><div>You can imagine the difference in <b>web development experience</b> on AS7 and other application servers.</div><div><br /></div><div>Still don’t believe me? Just check out the guide below on how to deploy RichFaces Showcase yourself.</div><div><br /><br /></div><div style="color: rgb(102, 204, 204);"><span class="Apple-style-span" style="font-size:180%;">RichFaces 4 running on AS7 here and now</span></div><div><br /></div><div>We have prepared <b>two demonstration applications targeting AS7</b> to show how easy it is to get RichFaces running.</div><div><br /></div><div>We’ll first touch the <b>Showcase</b> application (since you can deploy it as it is: just clone, build and run) and then go discover <b>Tweetstream</b> application, which is really nice sample of tweet tracking for both mobile and desktop browsers.</div><div><br /><br /></div><div style="color: rgb(102, 204, 204);"><span class="Apple-style-span" style="font-size:180%;">Showcase on AS7</span></div><div style="color: rgb(51, 204, 255);"><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Clone the project from the Git repository</span></div><div><b><span class="Apple-style-span" style="font-size:130%;"><br /></span></b></div></span></span>You need to clone the project from <a href="https://github.com/richfaces/showcase">RichFaces Showcase repository</a>, move into that directory, and then reset to a specific reference point (i.e. a specific commit) like so:<span><span><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ git clone git://github.com/richfaces/showcase.git</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ cd showcase</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ git checkout -b blog-demo 54b8211b9bfc065dda32c8809cd9a4e2b7c90b71</span></div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Build the project</span></div><div><span class="Apple-style-span" style="font-size:130%;"><b><br /></b></span><span><span><span><span>At first, make sure you have properly setup Maven for development with JBoss repositories (check out <a href="http://community.jboss.org/wiki/MavenGettingStarted-Users">Maven Getting Started</a>, paragraph "Configuring Maven to use the JBoss Repository").<br /><br /></span></span></span></span></div></span></span><span class="Apple-style-span" style="font-family:'courier new';">$ mvn clean package -Pjbas7 --update-snapshots</span><span><span><div><br /></div><div>The Maven build will take some time, but once complete, you will have a WAR file deployable on AS7.<br /></div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Download and unpack AS7 distribution</span></div><div><br /></div><div>Now you need the actual server, so go to the <a href="http://www.jboss.org/jbossas/downloads">JBoss AS download page</a> and obtain the latest AS7 <a href="http://download.jboss.org/jbossas/7.0/jboss-as-7.0.0.Final/jboss-as-7.0.0.Final.zip">distribution archive</a> (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 <a href="https://docs.jboss.org/author/display/AS7/Getting+started+with+JBoss+AS">Getting started</a> with AS7.</div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Deploy Showcase to AS7</span></div><div><br /></div><div>Take the WAR file from the Maven build (which is located at <span class="Apple-style-span" style="font-family:'courier new';">showcase/target/richfaces-showcase-jbas7.war</span>), copy it to the “<span class="Apple-style-span" style="font-family:'courier new';">deployments</span>” directory, and finally rename it <span class="Apple-style-span" style="font-family:'courier new';">showcase.war</span> (<span class="Apple-style-span" style="font-family:'courier new';">jboss-7.0.0/standalone/deployments/showcase.war</span>).</div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Start AS7</span></div><div><br /></div><div>Enter the <span class="Apple-style-span" style="font-family:'courier new';">jboss-7.0.0/bin</span> directory and run</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ ./standalone.sh --server-config standalone-preview.xml</span></div><div><br /></div><div>If deployment is successful, you should see “<span class="Apple-style-span" style="font-family:'courier new';">registering web context: /showcase</span>” and “<span class="Apple-style-span" style="font-family:'courier new';">Deployed "showcase.war</span>" on last few lines of the server console.</div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Enter the Showcase application</span></div><div><br /></div><div>Start your browser and point it at: <a href="http://localhost:8080/showcase/">http://localhost:8080/showcase/</a> .</div><div>Et voilà! You have successfully deployed the RichFaces Showcase application!</div><div><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMyP_GKMJXIq69zkOsID5uaoR6ShjKtS54IVPzPkBZ8WJUC16FJ9Mt_hBf25JAnaBEfsoH4aEkVLEqx4Rkh6SGM8gUFXctDFO8UgzO39cUNftj7-FxMxPZ05MMTgU2rCC-KYT6EYWf4_O/s1600/Screenshot-18.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNMyP_GKMJXIq69zkOsID5uaoR6ShjKtS54IVPzPkBZ8WJUC16FJ9Mt_hBf25JAnaBEfsoH4aEkVLEqx4Rkh6SGM8gUFXctDFO8UgzO39cUNftj7-FxMxPZ05MMTgU2rCC-KYT6EYWf4_O/s400/Screenshot-18.png" alt="" id="BLOGGER_PHOTO_ID_5631115830284615074" border="0" /></a><br /><br /><br /></div><div style="color: rgb(102, 204, 204);"><span class="Apple-style-span" style="font-size:180%;">Diving Deep into Showcase and AS7 Specific Requirements</span></div><div><br /></div><div><br /></div><div>Showcase deployment was easy enough; now we'll go through the behind the scenes configuration of both Showcase and AS7.</div><div><br /></div><div>First, we needed to deploy in Preview configuration (which was denoted by using <b>--server-config standalone-preview.xml</b> 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.</div><div><br /></div><div>I have said that Showcase is using several Java EE 6 technologies: <b>JSF, CDI, JPA and JMS</b>. That means AS7 needs to load and configure each of the appropriate modules for these technologies.</div><div><br /></div><div>For both JSF and CDI, it is enough to create two configuration files, <a href="https://github.com/richfaces/showcase/blob/54b8211b9bfc065dda32c8809cd9a4e2b7c90b71/src/main/webapp/WEB-INF/faces-config.xml">faces-config.xml</a> and <a href="https://github.com/richfaces/showcase/blob/54b8211b9bfc065dda32c8809cd9a4e2b7c90b71/src/main/webapp/WEB-INF/beans.xml">beans.xml</a>, to load the appropriate modules. For JPA, it is necessary to create <a href="https://github.com/richfaces/showcase/blob/54b8211b9bfc065dda32c8809cd9a4e2b7c90b71/src/main/resources-jbas7/META-INF/persistence.xml">persistence.xml</a> with a proper configuration. Showcase uses ExampleDS as the data source, which is deployed out-of-the-box on AS7 for sample applications.</div><div><br /></div><div>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 <a href="http://community.jboss.org/wiki/DetypedDescriptionOfTheAS7ManagementModel">Java API for DMR</a> 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 <a href="https://github.com/richfaces/showcase/blob/54b8211b9bfc065dda32c8809cd9a4e2b7c90b71/src/main/java/org/richfaces/demo/push/provider/AS7MessagingProviderManagement.java">JMS provider management script</a> shows:<br /><br /><span style="font-family:courier new;">public void createTopic(String topicName, String jndiName) throws Exception {</span><br /><span style="font-family:courier new;"> ...</span><br /><span style="font-family:courier new;"> operation = new ModelNode();</span><br /><span style="font-family:courier new;"> operation.get("operation").set("add");</span><br /><span style="font-family:courier new;"> operation.get("address").add("subsystem", "messaging");</span><br /><span style="font-family:courier new;"> operation.get("address").add("jms-topic", topicName);</span><br /><span style="font-family:courier new;"> operation.get("entries").add(jndiName);</span><br /><span style="font-family:courier new;"> client.executeAsync(operation, null);</span><br /><span style="font-family:courier new;"> ...</span><br /><span style="font-family:courier new;">}</span><br /><br /></div><div>RichFaces Push needs to be configured for using of <b>blocking I/O approach</b> of managing requests on AS7. You need to configure org.atmosphere.useBlocking=true in <a href="https://github.com/richfaces/showcase/blob/54b8211b9bfc065dda32c8809cd9a4e2b7c90b71/src/main/webapp-jee6/WEB-INF/web.xml#L72">web.xml</a>.</div><div><br /></div><div>These tweaks are necessary to get Showcase working on AS7 without having to perform any custom server management operations before the application is deployed.</div><div><br /></div><div>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.</div><div><br /><br /></div><div style="color: rgb(102, 204, 204);"><span class="Apple-style-span" style="font-size:180%;">Tweetstream on AS7</span></div><div><br /></div><div><br /></div><div>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 <a href="http://relation.to/Bloggers/RichFacesAndTheMobileWebForTheJBossWorld2011Keynote">RichFaces And The Mobile Web...</a> and <a href="http://www.jroller.com/wesleyhales/entry/runtime_type_detection_and_usage">Runtime Type Detection and Usage with Weld</a>.</div><div><br /></div><div>Connection to twitter is driven through <b>OAuth credentials and associated security tokens</b>. These credentials are pre-filled in properties file using <b>fake twitter account created for demonstration purpose</b>, but I encourage you to change them - Twitter won’t allow two consumers (like the Tweetstream application) to connect using the same application account.</div><div><br /></div><div>To run Tweetstream, you should follow the same steps you used in the Showcase example above, but additionally you need to <b>setup</b> <b>Twitter OAuth credentials</b> and also <b>setup JMS</b>. We will also inspect<b> another way to deploy WAR files</b>.</div><div><br /></div><div>The following section assumes that you have already <b>downloaded and unpacked AS7</b> (using the Showcase instructions above).</div><div style="color: rgb(102, 255, 255);"><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Clone the Project from the Git Repository</span></div><div><br /></div><div>You need to clone project from <a href="https://github.com/richfaces/tweetstream">RichFaces Tweetstream repository</a>, move into that directory, and then reset to a specific reference point (i.e. a specific commit) like so:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ git clone git://github.com/richfaces/tweetstream.git</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ cd tweetstream</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ git checkout -b blog-demo ccae090ef0c59c9275fb011aa426a88f53544fe1</span></div><div style="color: rgb(102, 255, 255);"><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Change the Twitter4j Credentials (optional)</span></div><div><br /></div><div>This is really not that hard, but it does require some effort. Because these steps change from time to time you should refer to <a href="http://twitter4j.org/en/configuration.html">http://twitter4j.org/en/configuration.html</a> and <a href="https://dev.twitter.com/pages/auth">https://dev.twitter.com/pages/auth</a> for up-to-date details.</div><div><br /></div><div>Once you have access to the values in <span class="Apple-style-span" style="font-family:'courier new';">tweetstream/src/main/resources/twitter4j.properties</span> : </div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">oauth.consumerKey=**************************</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">oauth.consumerSecret=**************************</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">oauth.accessToken=**************************</span></div><div><span class="Apple-style-span" style="font-family:'courier new';">oauth.accessTokenSecret=**************************</span></div><div><br /></div><div>Update with these your own values.</div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Change Keywords that Tweetstream Tracks (optional)</span></div><div><br /></div><div>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:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">tweetstream/src/main/resources/twittertracks.properties</span></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-family:'courier new';"><br /></span></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Build the Project</span></div><div><br /><span><span><span><span><span><span>Before starting a build, make sure you have properly setup Maven for development with JBoss repositories (check out <a href="http://community.jboss.org/wiki/MavenGettingStarted-Users">Maven Getting Started</a>, paragraph "Configuring Maven to use the JBoss Repository").<br /><br /></span></span></span></span></span></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ mvn clean package --update-snapshots</span></div><div><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Start AS7</span></div><div><br /></div><div>Without deploying the application, start the server by entering the<span class="Apple-style-span" style="font-family:'courier new';"> jboss-7.0.0/bin</span> directory and running:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ ./standalone.sh --server-config standalone-preview.xml</span></div><div style="color: rgb(102, 255, 255);"><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Create the JMS Topic on AS7</span></div><div><br /></div><div>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:</div><div><br /></div><div style="font-weight: bold;"><span style="font-size:85%;">Using the Web Console</span></div><div>Navigate to <a href="http://localhost:9990/console/">http://localhost:9990/console/</a> in your browser. In the management console, select <span class="Apple-style-span" style="font-family:'courier new';">Messaging > Messaging Provider</span>, look for <span class="Apple-style-span" style="font-family:'courier new';">Subresources</span>, and switch to the <span class="Apple-style-span" style="font-family:'courier new';">Topics</span> tab. Hit the <span class="Apple-style-span" style="font-family:'courier new';">Add</span> button (on the right) and in the popup titled “<span class="Apple-style-span" style="font-family:'courier new';">Create JMS Topic</span>”, enter “<span class="Apple-style-span" style="font-family:'courier new';">twitter</span>” as the name and “<span class="Apple-style-span" style="font-family:'courier new';">topic/twitter</span>” as the JNDI.</div><div><br /></div><div><span class="Apple-style-span" style="font-size:85%;"><b>Command-line interface</b></span></div><div>To start the command line interface, ensure AS7 is running and enter the jboss-7.0.0 directory. From this directory, follow these steps:</div><div><br /></div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ <b>./jboss-admin.sh</b></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">[disconnected /] <b>connect</b></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">[standalone@localhost:9999 /] <b>add-jms-topic --name=twitter --entries=topic/twitter</b></span></div><div><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpqslbjzTS__54koFAry0xgJ2EYa0Oa827EiYxeKv_XmuDvRM_54CmNzDfXMI34ZgN4IgnXTdXxUXZYEVbcHF_2KEql0pFS4RtFZCyq6mPRc2F_IPpSG-dAw7eDqAB08zeW9ayAa0nNlhN/s1600/Screenshot-20.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 238px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpqslbjzTS__54koFAry0xgJ2EYa0Oa827EiYxeKv_XmuDvRM_54CmNzDfXMI34ZgN4IgnXTdXxUXZYEVbcHF_2KEql0pFS4RtFZCyq6mPRc2F_IPpSG-dAw7eDqAB08zeW9ayAa0nNlhN/s400/Screenshot-20.png" alt="" id="BLOGGER_PHOTO_ID_5631115959117155314" border="0" /></a><br /><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Deploy Tweetstream to AS7</span></div><div><br /></div><div>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.</div><div><span style="font-size:85%;"><br /></span></div><div><span class="Apple-style-span" style="font-size:85%;"><b>Using the Web Console</b></span></div><div>Enter the console again (<a href="http://localhost:9990/console/">http://localhost:9990/console/</a>) and select <span class="Apple-style-span" style="font-family:'courier new';">Deployments > Manage Deployments</span> and hit the <span class="Apple-style-span" style="font-family:'courier new';">Add Content</span> button (on the right). In the popup, Choose a WAR file to deploy and hit <span class="Apple-style-span" style="font-family:'courier new';">Next</span> button. Leave the default values in the next popup screen and hit the <span class="Apple-style-span" style="font-family:'courier new';">Finish</span> button. The popup will disappear and you will see your WAR in the list of deployed resources. Hit the <span class="Apple-style-span" style="font-family:'courier new';">Enable</span> button for <span class="Apple-style-span" style="font-family:'courier new';">tweetstream.war</span>. You should see a green ball indicating successful deployment.</div><div><span style="font-size:85%;"><br /></span></div><div><span style="font-size:85%;"><b>Using the Command Line Interface</b></span></div><div>Start the command line interface again and follow these steps:</div><div><br /></div><div><span class="Apple-style-span" style="font-family:'courier new';">$ <b>./jboss-admin.sh</b></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">[disconnected /] <b>connect</b></span></div><div><span class="Apple-style-span" style="font-family:'courier new';">[standalone@localhost:9999 /] <b>deploy /path_to_tweetstream/target/tweetstream.war</b> </span></div><div><span class="Apple-style-span" style="font-family:'courier new';">'tweetstream.war' deployed successfully.</span></div><div><br /></div><div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkEC0pG8CWn6T6KLBioGPSOad1u80jeLZFQuGeAn-IIzvJsxZ6zx9-LdOsEb2PFRBmkgtwAeNW5BZaf9cDWD9m-Nd-OtQPQQ7D9whZjFw9ydAg0RF8rXZ09y4vOtX9UZOChHQ20ueoY4I0/s1600/Screenshot-19.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 224px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkEC0pG8CWn6T6KLBioGPSOad1u80jeLZFQuGeAn-IIzvJsxZ6zx9-LdOsEb2PFRBmkgtwAeNW5BZaf9cDWD9m-Nd-OtQPQQ7D9whZjFw9ydAg0RF8rXZ09y4vOtX9UZOChHQ20ueoY4I0/s400/Screenshot-19.png" alt="" id="BLOGGER_PHOTO_ID_5631116023812325106" border="0" /></a><br /><br /></div><div style="color: rgb(102, 255, 255);"><span class="Apple-style-span" style="font-size:130%;">Enjoy the Tweetstream application!</span></div><div><br /></div><div>Enter <a href="http://localhost:8080/tweetstream/">http://localhost:8080/tweetstream/</a> 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.</div><div><br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcG0dnuZJQ-GMbwiAU5BiijJeZm67m0tb8a-RAV7OrpfBgXLnSFTEJEKWFg3M463zyPWezYDOy9akIPtUE40RqtaUhXPT0dMwKAT7vuk7KkBUxb6QWaq3mfIAqZCcOzye1H32cqevLShEN/s1600/Screenshot-19.png"><img style="cursor:pointer; cursor:hand;width: 400px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcG0dnuZJQ-GMbwiAU5BiijJeZm67m0tb8a-RAV7OrpfBgXLnSFTEJEKWFg3M463zyPWezYDOy9akIPtUE40RqtaUhXPT0dMwKAT7vuk7KkBUxb6QWaq3mfIAqZCcOzye1H32cqevLShEN/s400/Screenshot-19.png" alt="" id="BLOGGER_PHOTO_ID_5631115900869300738" border="0" /></a><br /><br /></div><div><br /></div><div>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!</div></span></span><div><div></div></div>Unknownnoreply@blogger.com7tag:blogger.com,1999:blog-3862595054202795438.post-18701839461347201872010-03-21T23:26:00.000-07:002010-03-23T02:42:34.961-07:00New Richfaces Selenium Library for Automated functional testing of RichFaces 3.3.x<span style="COLOR: rgb(51,204,255);font-size:130%;">Motivation</span><br /><p></p><p style="MARGIN-BOTTOM: 0mm">We needed this library because we wanted to have stable automated tests against different browsers and on different platforms for <a href="http://www.jboss.org/richfaces">RichFaces</a> functional testing. It encapsulates good functionalities for <span style="FONT-WEIGHT: bold">testing AJAX behaviours</span> and is ready for testing Firefox and Internet Explorer. Its' first implementation is used for testing RichFaces 3.3.X in <span style="FONT-WEIGHT: bold">403 unique tests</span> for in over 76 test cases for each <a href="http://www.jboss.org/richfaces">RichFaces</a> component.</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,204,255);font-size:130%;">Internet Explorer ready</span><br /></p><p style="MARGIN-BOTTOM: 0mm">What makes this project unique is its own implementation of<span style="FONT-WEIGHT: bold"> own HttpCommandProcessor</span> which enables functionality in Internet Explorer – it handles known <span style="FONT-WEIGHT: bold">Permission denied</span> exceptions in Selenium when you are trying to access JavaScript from TestRunner window before the page is loaded. This is caused by security model of Internet Explorer and really harden usage of selenium functions in Internet Explorer in comparison to Firefox.</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,204,255);font-size:130%;">JQuery Selectors over the XPath</span><br /></p><p style="MARGIN-BOTTOM: 0mm">The support for <span style="FONT-WEIGHT: bold">JQuery Selectors as location strategy</span> isn't unique but it is complete and nice to have to support multiple browsers for test. This makes test suite run with Internet Explorer more reliable. This browser has at the moment very slow Xpath evaluator and that's why test cases written in this language suffer in execution speed. Implementation of JQuery Selectors to our test cases was simple, but we had to rewritte all of the locators to JQuery Selector syntax. It actually reduced execution time from 4:30hr to 1:30hr and made lots of test cases pass. It enabled to have same test suites for Firefox and Internet Explorer.</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,204,255);font-size:130%;">Testing Dragable</span><br /></p><p style="MARGIN-BOTTOM: 0mm">Also the Drag class is important – it encapsulates <span style="FONT-WEIGHT: bold">sequence of commands to drag one object to target object</span> and enables testing of behaviour of dragged object in each phase of dragging sequence. Nice for testing <a href="http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf">Drag-and-Drop support</a> in <a href="http://www.jboss.org/richfaces">RichFaces</a>.</p><p style="MARGIN-BOTTOM: 0mm; COLOR: rgb(51,204,255)"><span style="font-size:130%;">Waiting-improved</span></p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,102,255);font-size:100%;">Waiting for satisfying conditions</span><br /></p><p style="MARGIN-BOTTOM: 0mm">The last big feature which needs to be mentioned is <a href="http://anonsvn.jboss.org/repos/qa/richfaces-selenium/tags/1.0.0.GA/src/main/java/org/jboss/test/selenium/waiting/Wait.java">Wait class</a>. It is similar to Wait class from Selenium 1.0, but it has much more readable and customizable syntax, for example:</p><p style="MARGIN-BOTTOM: 0mm; FONT-FAMILY: courier new">Wait.dontFail().timeout(5000).interval(500).until(new Condition() { … })</p><p style="MARGIN-BOTTOM: 0mm">or</p><p style="MARGIN-BOTTOM: 0mm; FONT-FAMILY: courier new">Waiting waitForModelUpdate = Wait.timeout(30000).interval(2000);</p><p style="MARGIN-BOTTOM: 0mm; FONT-FAMILY: courier new">waitForModelUpdate.failWith(“Causes {0}”, someObjectToFormat).until(new Condition() { … });</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,102,255);font-size:100%;">Customizable behaviour of failure</span><br /></p><p style="MARGIN-BOTTOM: 0mm">It wasn't something what we could not implement with Selenium's Wait class (except the <span style="font-family:courier new;">dontFail/failWith</span> handling the resulting exception when waiting timeouts).</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,102,255);font-size:100%;">Wait for change conditions</span><br /></p><p style="MARGIN-BOTTOM: 0mm">Pretty usable is also addition of <span style="font-family:courier new;">waitForChange(...)</span> and <span style="font-family:courier new;">waitForChangeAndReturn(...)</span> methods. Its purpose is also quite self-describing. Sample followes:</p><p style="MARGIN-BOTTOM: 0mm; FONT-FAMILY: courier new">waitForModelUpdate.waitForChange(“phase 2”, new Retrieve<string>() { String retrieve() { selenium.getText(locator); });</string></p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,204,255);font-size:130%;">Maven-based integration</span><br /></p><p style="MARGIN-BOTTOM: 0mm">What I'm really proud of is Maven configuration for Selenium tests (it isn't a part of the library yet, but we are planning so). For better overview, take a look at <a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/functional-test/README.html">readme doc</a> or <a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/functional-test/pom.xml">POM</a>. It enables us to have <span style="FONT-WEIGHT: bold">same configuration for Windows and Linux</span> Hudson machines incl. <span style="FONT-WEIGHT: bold">various browsers</span> (Firefox and IE) and <span style="FONT-WEIGHT: bold">various containers</span> (JBossAS and Tomcat). It contains selenium-maven-plugin, cargo deployer and maven-surefire-plugin executing test suite. Really nice is the <span style="FONT-WEIGHT: bold">debugging feature</span> (look for Debugging in <a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/functional-test/README.html">readme.html</a>) when you are running the SeleniumServer on one host, container on another host and you are running test suite in debugging mode from your preferred IDE.</p><p style="MARGIN-BOTTOM: 0mm"><span style="COLOR: rgb(51,204,255);font-size:130%;">Stay warmed...</span><br /></p><p style="MARGIN-BOTTOM: 0mm">Please keep an eye on this blog space. We are planning new version of richfaces-selenium library introducing <span style="FONT-WEIGHT: bold">type-safety</span> and <span style="FONT-WEIGHT: bold">commonness</span> to<span style="FONT-WEIGHT: bold"> full-featured AJAX testing</span>!<br /></p><p style="MARGIN-BOTTOM: 0mm; COLOR: rgb(255,0,0)"><span style="COLOR: rgb(255,0,0);font-size:130%;"><span style="COLOR: rgb(51,204,255)">How to start?</span><br /></span></p><p style="MARGIN-BOTTOM: 0mm"><a href="http://anonsvn.jboss.org/repos/qa/richfaces-selenium/">Source code of richfaces-selenium library<br /></a></p><p style="MARGIN-BOTTOM: 0mm"><a href="http://livedemo.exadel.com/richfaces-demo/index.jsp">RichFaces LiveDemo</a> and <a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/functional-test/">it's test-suite<br /><span style="font-size:85%;"></span></a><span style="font-size:85%;"><a href="http://anonsvn.jboss.org/repos/richfaces/branches/community/3.3.X/samples/richfaces-demo/functional-test/src/test/java/org/jboss/richfaces/integrationTest/dataTable/EditTableWithModalPanelTestCase.java">(example of test case - Editable Table with Modal Panel)</a></span><br /></p>Unknownnoreply@blogger.com17