Shaun Abram
Java and Technology weblog
JavaOne: Tuesday’s Keynote
This morning’s Keynote at JavaOne contained a few interesting announcements, including
- JDK7 for MacOS X Developer Preview announced by Hasan Rizvi (SVP @ Oracle). Available here.
- Java FX to be open sourced, and it will be proposed to the JCP (Confirmed, see press release)
- JDK8 will be released in the summer of 2013 (not 2012 as previously discussed), as announced by Adam Messinger from Oracle
There was also mention of an Oracle Java Magazine, which I confess I had never heard of before.
For a summary of this morning’s announcements, see here.
Overall, not the most exciting keynote I have seen. It opened with a presentation from Juniper Networks. I didn’t find the topic of “Programming the network” to bring networks and apps closer together particular relevant for me personally. They then rolled out a bunch of other corporate folks from the likes of Intel, Redhat, IBM and ARM. The Twitter guy did announce that Twitter are joining OpenJDK as well as the JCP though.
On to the sessions…
Tags: javaone, javaone2011
JavaOne: Comparing Java Web Frameworks
The first talk I attended at this year’s JavaOne was “Choosing Your Java Web Framework” by Richard Pack from salesforce.com
Overall, I found this a really interesting talk. It was lacking in any sales pitch, nor did it have the unquestioning devotion to one particular framework that I felt some of the Java FX talks had. Instead it seemed like an unbiased look at web frameworks in general and a handful of frameworks in more detail, based on Richard’s extensive and hands on experience and SalesForce and Hyperic.
Read more
Tags: grails, gwt, javaone, javaone2011, jsf, tapestry, webframework, wicket
@JavaOne
I am at JavaOne 2011 right now. Always fun and it seems to be bigger than last year, with a huge selection of talks and presentations (although frustratingly flaky wifi!).
Some of the themes of this morning’s keynote talk were JavaFX 2.0, what will be coming in Java 8 and a new Oracle NoSQL Database. There are some links here, here and here (and I believe the videos will be posted soon here).
I just attended a very useful Java Web Framework comparison talk that I will try to post about shortly. I also met up with some of the DZone team. For now, I am going to some JavaFX talks.
If any of you are attending, let me know!
Tags: javaone, javaone2011
Spring MVC Hello World
There is a good Getting Started with Spring MVC blog post over on the Spring team blog.
I have created several Spring MVC projects for both work and play, and am attaching my own simple version of the HelloWorld example here, based on the Spring blog example.
Find my maven ready source here.
Like my previous JSP/Servlet example, I find these templates useful for getting prototypes up and running.
Tags: helloworld, jsp, servlet, spring, springmvc, webapp, webframework
SLF4J & Logback is the new commons-logging & log4j
Interesting post on which logging framework to choose from the logging mess.
I still default to log4j, but it sounds like logback (as the new alternative to log4j), wrapped by SLF4J (as the new alternative to commons logging) is the way forward. Both are written by Ceki Gülcü (blog), the original log4j author.
Tags: log4j, logback, logging, slf4j
JSP EL statements not being evaluated
On several occasions I have had problems with EL (Expression Language) statements not being evaluated.
As an example, you add a statement to a JSP like
$(2+2), expecting the JSP to simply display 4, when it in fact displays the raw statement, i.e. $(2+2).
After digging around the web, I found a number of points to check…
Setting up multiple instances of Tomcat
With multiple tomcat instances, each can run in its own JVM, have its own configuration and can be started/stopped independently. For example, you can have a dev, QA and Prod version of tomcat all running on the same box.
One approach to doing this would be to have multiple, full tomcat installations. This article instead details how to install tomcat once (in CATALINA_HOME) but have multiple independent instances (by utilizing CATALINA_BASE). This is a more streamlined approach that makes creating multiple instances easier and also simplifies upgrades/rollbacks of tomcat.
Tags: apache, appserver, tomcat
Add log4j logging for a unit test in IntelliJ
In IntelliJ
- Click: Run -> Edit Configuration
- Select your test configuration (or add a new one)
- In VM parameters, add
-Dlog4j.configuration=file:/C:/dev/config/log4j.xml
(Or wherever your log4j properties file is)
That’s it. The test should now run with log4j logging (although obviously you need to have the necessary log4j jars available).
This example uses a windows file format, but will work equally well with *nix.
I use this approach for turning on MyBatis logging for individual tests. See here for a basic setup of a log4j.xml file to enable logging with MyBatis.
Tags: intellij, JUnit, log4j, mybatis, unittesting
EasyMock
EasyMock is an open source library for creating, and defining the behavior of, mock objects as part of your unit tests. This article describes how to use EasyMock (v3.0), including its record/playback approach, after setting the context with an brief introduction to unit testing in general and the associated need for mock objects.
Read more
Tags: easymock, mocks, unittesting
Hamcrest Matcher
As a follow up to the Hamcrest post I made yesterday, I wanted to post an example of my own Hamcrest matcher implementation. This matcher tests if a string contains a specified number of substrings.
An example usage could be:
String sql = "select a,b,c from tableA";
assertThat(sql, hasNumberOfSubstrings(",", 2));
See the source code below. I have been reading up on OSS licenses recently and decided to release this using the same license as Hamcrest – the new BSD license.
I have also attached a jar which includes the associated unit tests, although you will need the hamcrest-unit-test project to compile, which can be downloaded as part of the hamcrest all-in-one jar.
Read more
Tags: Hamcrest, JUnit, Testing, unittesting
Subscribe to RSS Feed