Testing java ee applications – the server side java symposium

This session was also fast moving and information filled, but it didn’t feel as overwhelming as the Spring session. The presenter included demos of some of the technologies.  He did use the term “unit test” for things that test through the web and database. I would rather these be called integration/functional tests. I wish the testing industry would use one set of definitions. I subscribe to the one where a unit test doesn’t involve the database or the server

Servlet layer

  • Junit – need to build on
  • httpunit – higher level api on http level – the demo shows creating requests and responses using the java api. This technology is preferred over htmlunit because you are usually not generating raw html if you are using a servlet.  [you should be using MVC]
  • htmlunit – higher level api on html level
  • Cactus – in container tests, good for functional testing
  • Selenium – can be used for acceptance testing by users, no coding required
  • Servletunit gives you a simulated container or can mock the request/response objects for simple cases

JSF

  • Jsf 2 project stages help for debugging and testing. This helps because you can easily specify different web.xml settings.
  • Selenium – for simple cases
  • jsfunit – uses cactus, junit, httpnit and htmlunit behind the scenes

Tip: define ids in your jsf tags so not randomly generated. That way you can refer to them

CDI/EJB 3.1

  • Arquillian – lets you say you do not want your whole aoo to be deployed. You use @RunAs(Arquillian.class). Then you can createDeployment() with the classes you want deployed. the ShrinkWrap API lets you add specific classes which lets you test one EJB or injected element.  The demo used embedded glassfish as specified by a Maven profile.  Also lets you inject into the unit test
  • Apace myfaces codi testing is a competing choice
  • For simple cases mock objects are sufficient, not testing production environment [that is why you test logic in unit tests and environment in integration tests which are in container]
  • @RunWith(ResinBeanContainerRunner) starts a very light container. Only supports CDI and EJB 3.1 lite

JPA

  • Embedded database – derby, hsql, java db
  • Embedded container like arquillian
  • Dbunit – helps with data consistency [and setup]
  • ejb3junit, mocks or pure junit again works for simple cases

Web Services

  • Soapui – good for complex cases with either SOAP or REST. Same level as Selenium
  • Can use junit and arquillian if want test to be self contained
  • Can use jersey test framework

java in flux – the server side java symposium

Oh look.  The ten line Oracle disclaimer is back.  At least this talk contains some forward looking statements where it makes sense to have the disclaimer.

Communication
Oracle recognizes they have issues with communicating late/poorly.  They have a culture of saying little and sticking to it.  Whereas Sun had more dialog.  They acknowledge it; will be interesting to see what happens.

Priority

Want to keep Java vibrant to keep making money.  Said will continue move to Open JDK.  Moving JRockit features to OpenJDK.

Other topics

  • Looking at support for multiple cores at the CPU level.  Think parallel collections and lambda/closures will be good candidates for paralleilization
  • Let ideas mature in more experimental languages
  • Reiterated pledge to backward compatibility
  • Covered what’s new in Java 7 at a high level – most I had heard before – the more lightweight garbage collector was new to me
  • Java 8 – more modularization, project lambda(closures), annotations on Java types and more small language enhancements
  • Java 9 – really speculative – forces on platform independence with hardware virtualization, better interoperatibility with non Java languages, improved data integration, improved device support
  • Looking to expand Java FX [surprised]

JEE

  • Want JEE 7 done before Java 8 comes out which is end of 2012
  • Looking at what can do for modularity in JEE 7 before “real” modularity comes out in Java 8
  • Compared Java to .NET.Azure including areas like Cloud and multiple language support where Microsoft doing better
  • Covered the problems it was designed to solve and how it got so big that it isn’t simple anymore. Going back to POJOs, dependency injection. [again making it sound like this stuff just sprung up from developer complaints]
  • Showed timeline from 1998 and J2EE 1.2.
  • Recognized innovation is occurring on the outside and the platform stewards/Oracle need to reuse that to avoid becoming irrelevant
  • Customers win when there is interoperability and vendor choice
  • Companies want to build internal clouds – solutions starting to be built on Java Also noted cloud gives new JEE roles of data center and tenant roles. (in addition to things like deployer) In addition, noted the existing JEE APIs need to become tenant aware. Such as how to discriminate within a table what rows are associated with what tenant in a JPA entity. Maybe in JEE 8

Ibm’s enterprise java for the future – the server side jack symposium

Enterprise java for the next decade – IBM’s take on one possibility for the future
Facts/industry trends

  • hitting the limit of Moore’s law, can add more CPUs , but not make existing ones significantly faster [surprised they didn’t bring up threading here]
  • Memory still rapidly increasing, disk capacity is growing, but not as fast
  • Hardware is getting smaller, cell phones/smart phones are now real computers, they aren’t special purpose operating systems anymore
  • Projects are becoming more complex
  • Data transformations more complex, new formats
  • Amount of information and # devices dealing with data rapidly growing – ip v4 full, RFID, gps, etc

speculation

  • More software will mean more jobs. But jobs I’ll require new skills for enterprise software
  • Need to simplify the enterprise platform with focus on making easy things easy and hard things possible
  • Class loader system to complex/ambiguous for the future
  • Number of technologies for a beginning JEE developer is too overwhelming and we keep adding to it
  • Don’t need two packages with same name for metadata [how balance backward compatibility without blowing up complexity?]. Eventually will have single definition with ONE XML file that controls metadata, similarly for annotations
  • Don’t think one injection model will be enough, but still need to collapse from what we have now
  • Expect concurrency and async workflows to change so defining at higher level
  • Brought up getting rid of the stuff that has been deprecated for a long time like BMP [sun never reveled anything, will Oracle?]

At this point I stopped taking detailed notes on the APIs. The gist of it is that the IBM speaker organized the APIs into groups and called the higher level one simpler. It is if you can get rid of what is there today and replace it with a general API. Of course 10 years is a long time so it isn’t out of the question
Ok back to hardware, it’s getting interesting again

  • Think laptops sill become peripherals to our phones. [interesting concept, Mac is already on the way] Like a monitor and keyboard for the same environment other phone, but with more processing power.
  • Data analytics will be more important. More parallelization and more devices yields more crosstalk and more data to sift through
  • Cloud will take care of non functional requirements
  • Apps are going to be about code, dependencies and binding rather than a self contained unit. The shared modular environment will handle the rest

future known facts

  • JEE 8 is going to attempt a modular programming environment [how does this make it less complex?]