by Ivan St. Ivanov
The last JavaOne day started with the community keynote. All the conference attendees gathered in the Continental Ballroom of Hilton hotel and cheered Sharat Chander, the conference chair person, who opened the session. He started his talk with the fact that this year 60% of the content at JavaOne was delivered by the community (and just 40% by Oracle). I felt from his words that the Java stewards had really got it: you cannot move Java forward without significant effort from the people who are using it.
Then on the stage came Donald Smith, director of product management at Oracle. He took over from Sharat and tried to cheer up the crowd by asking us to make one of those Mexican waves that you see on the stadiums. He then asked Gary Frost from AMD to talk a little bit about Project Sumatra. In my opinion, the announcement of Project Sumatra is news number one of this conference. Maybe it’s not really news as it will be based on a project that exists even now: Aparapi. But it’s something tremendous for the Java world. Its basic goal is to move the parallelism on the next level: from the cores of the central processor to the GPU. Gary showed us some demos on the performance of applications which require intensive calculations. The Paparapi enabled runs were way much faster than those that just used threads. The goal is that for Java 8 Paparapi’s APIs become even sexier with the introduction of lambdas and in Java 9 it is expected to be inside the JVM.
After that Donald invited for a panel discussion people from Eucalyptus, Twitter (Chris Aniszczyk), Cloudera, Eclipse Foundation (Mike Milinkovich himself) and Perrone Robotics (its CEO Paul Perrone), who represented the different types of participants in the Java ecosystem. What I will take with me from the short question and answer session was that entrepreneurship is not about venture capitalists, but about innovators. And that the more open your innovation is, the better ideas you get.
Then Georges Saab, VP of development at Oracle, welcomed on the scene Martijn Verburg (a.k.a. The Diabolical Developer) from the London Java Community. Martijn explained how this user group was formed: people who were not happy of what they were doing in their day-to-day jobs in the London city gathered and decided that instead of complaining and writing bad tweets, they could do something good. And thus the adopt a JSR and adopt open JDK initiatives were born.
And here came the quote of the day. Martijn said that the queen has told him that “if the presidential elections [in US] don’t work well, she is ready to take [the states] back as a colony.”
After we had Paul Perrone again on the scene to show one of his robots it was time for the biggest surprise of the conference: James Gosling, the father of Java, who left Oracle and never showed up on JavaOne since then, was back on the scene! This provoked great cheer and applause from the crowd (including myself). Welcome back James!
For the rest of the session James talked about the things he has been doing in Liquid Robotics, but the most important part for me was what we heard at the end by Sharat: reach out the youths and inspire them!
This was a talk given by my two new friends from JBoss: Christian Sadilek and Jonathan Fuerth. They are working on a relatively new and quite impressive project: Errai. In a nutshell, it’s a project that lets you write your web applications just in Java, it is based on Google Web Toolkit and brings you such things as CDI and other powerful Java EE APIs on the client side. Its mantras are:
- Declarative works
- Boilerplate sucks
- Code it once
The most important project features (some of them already mentioned) are:
- Unified programming model on the server and on the client
- Java EE 6 APIs (including dependency injection and most importantly CDI’s event model) available on the client
- You can easily do remote calls from the client to the server using RPC and REST
- The objects that travel between the client and the server should be annotated as @Portable and may not have getters and setters
Then the speakers did a demo which showed some of the most impressive Errai features. They renamed one of the API method names using refactoring in the IDE and all the classes that used this method (including those on the client side) were updated accordingly. They then changed the path of the RESTful service endpoints at just one place and it worked out of the box for all the parties involved. But the most impressive thing was the fact that clients could observe server generated events: the speakers added a new entry from one browser session and the other session was updated without any refresh.
At the end Christian and Jonathan talked a little bit about some cool new features of the framework. You can use JPA annotations and entity manager on the client, which will result in persisting your data in HTML5’s local storage. You can use HTML5 design templates for describing your UI in declarative way instead of the standard procedural approach of GWT. Errai takes care for binding your data objects’ fields to the HTML elements they correspond to.
Really interesting session and great work. You should definitely give Errai a try!
Testing JSF apps with Arquillian
This was the final session that I went to at this JavaOne. The speakers were again from JBoss. They are company’s representatives in the JSF expert group: Brian Leathem (project lead of RichFaces) and Lincoln Baxter III (project lead of Forge).
I found this talk as a sequel of the one about Continuous Development. The speakers started with the well known fact that unit tests with mocks are not testing the application in its normal environment, which make them not very useful. And they prepared the audience with a quick HelloWorld-like example of an Arquillian test, which showed how you can unit test your code without mocking what the container does for it.
If you want real test, however, you need to test your UI. And if it is a web application, then libraries like Selenium 2 and Web Driver come to the rescue. Unfortunately in your tests that use those APIs you need to write a lot of boilerplate code: initialize the web driver, start the browser and then shut it down. All this boilerplate is spared for us by an Arquillian extension called Drone (led by another cool JBoss guy whom I met here – Karel Piwko). The way Arquillian brings the container to the test, Drone brings the browser to the test. So there you annotate a WebDriver field of your class with @Drone and the library does all the plumbing code for you. You can additionally configure what kind of browser you want to test against.
The next project from the UI testing stack that was presented was another Arquillian extension: Graphene. It runs on top of Drone and brings much more injection to your test. Common practice in Selenium 2 tests is to make plenty of findElementById calls in order to see or change the content of an HTML element. Good practice used in web testing to make this more type safe is the Page Object pattern: you encapsulate all these calls in one class (called page object) and expose more meaningful methods to the client. So you have getUserName() instead of findElementById(“userName”).getValue(). This pattern is abstracted very well by Graphene, which provides you with such annotations as @PageObject and @WebElement to further relieve you from writing the plumbing code.
Finally we came to the point of testing JSF pages. Brian and Lincoln presented us a third Arquillian extension, suitable for that: Warp. It is a relatively new project and its basic goal is to provide some features that JSFUnit lacks (like making assertions around all the phases of the JSF page lifecycle).
The session ended with some best practices when writing Aruillian tests:
- Use remote target container, which is running, so that Arquillian doesn’t have to start it and stop it for you upon each test
- Reuse browser sessions between tests
- Use ShrinkWrap micro deployment instead of packaging your whole application
My first JavaOne is over. And to be honest, I liked it. Until now I always tried to follow blogs like this in order to get what is really going on at the conference. I still read them, as I can’t visit every session. But now the feeling is different: I don’t just read the reports, I feel like I participated there.
Next year? Well, maybe,… nobody knows! Now it’s time for packing and for the next conference: Java2Days in Sofia.