I encountered a subtle hibernate mapping issue involving Dates and Timestamps. The following test recreates this issue.
» Read more: Hibernate Date vs Timestamp
Archive for the ‘Development’ category
Debugging memory leaks with VisualVM
July 18th, 2011At work I had run into a memory leak when scrolling through large result sets returned from Hibernate. I thought I had fixed it by performing a evict()/clear()/flush() in the HibernateTemplate that I was using but suddenly the leak was back. I was using VisualVm to monitor the heap so I started poking around to see if there was anything to help diagnose where the leak was.
» Read more: Debugging memory leaks with VisualVM
Maven 3 Tutorial – Project Setup
June 11th, 2011- Overview
- What is Maven?
- Plugins
- Why not Ant and Ivy?
- But It Downloads the Internet
- Getting Started
- Install
- What is a POM?
- Convention over Configuration
- New Project
- Project Management
- Parent POM
- Local Maven Repository
- Multiple Artifacts from a Single Source
- Release Plugin
- Aggregate POM
- Dependency Management
- Distribution Zip
- Conclusions
Overview
What is Maven?
Maven is a software project management and comprehension tool that includes: build tools, dependency management, project reporting and much more. I say “much more” because at the core Maven is a plugin execution framework. There are plugins supported by the Maven project (http://maven.apache.org/plugins/index.html), plugins supported by Mojo Project (http://mojo.codehaus.org/plugins.html), and third party plugins. If you can find or write a plugin, Maven can run it.
» Read more: Maven 3 Tutorial – Project Setup
Testing Spring Wiring
June 1st, 2011Overview
Spring is an essential part of my technology stack. I cann’t image providing quality software that doesn’t leverage an IoC container. However, decoupling components requires some amount of configuration. Whether this is accomplished through annotations or XML, it’s fairly easy to mess up. Fixing these missing or incorrect configurations doesn’t take very long. The real question is how quickly can you identify these errors?
This question of how long, is a feedback loop question. Unfortunately many teams wait until they fire up the application server to see if their Spring context is wired correctly. This is too late.
One of our clients suffered from this very issue. Due to environmental constraints they could not run automated, in-container tests that would have identified misconfigured beans. After repeatedly committing stupid configuration mistakes, I decided that I would write a Spring wiring test. As I began to write this I encountered five problems.
» Read more: Testing Spring Wiring
Mock Me With Fewer Words
May 1st, 2011With Mockito 1.8.3 or higher you can significantly reduce your test code setup.
» Read more: Mock Me With Fewer Words
Rethinking the DAO-Service layer relationship
April 8th, 2011Lately I have been thinking that the standard service-calling-the-dao-layer architecture hasn’t been working out as well as I would hope. The applications I have been working on have been using Spring and Hibernate with a dao object per model object. While this does provide a good separation between the two, I have been finding it increasingly difficult to write good tests for the service layer as the project matures. Past experience has shown that if writing tests is difficult, then it just isn’t done. Follow along as I think about possible ways to address this issue.
» Read more: Rethinking the DAO-Service layer relationship
Selenium IDE – Part II
April 1st, 2011In Part I we covered
- Setting Up
- Recording Tests
- Playing Back Tests
- Saving Test Cases
- Resuming Recording
- Saving Test Suites
All examples will use the sample site https://sites.google.com/site/example4selenium/.
Store Value
- There are two ways to store values.
- First, you can define custom variables
- Second you can use the drop-down ’storeText’ option.
Pair Programming 101
March 9th, 2011Overview
Pair programming is a technique where two programmers work at a single work station. One person “drives” or has control of the mouse and keyboard. The other person “navigates” or keeps track of where they are and where they are headed. This is a perfect environment for teaching and learning to occur.
» Read more: Pair Programming 101
Selenium IDE – Part I
March 1st, 2011Selenium IDE is a free Firefox plugin that leverages javascript to record automated test scripts. In this first tutorial we will install Selenium IDE and create a basic test script. The next tutorial will cover more advanced topics.
I primarily use Selenium IDE in three areas:
- Defect – I ask testers to record their steps and attach the script to their defects. This is a simple way to communicate exactly how they found an issue. This technique significantly cuts down on communication overhead.
- Acceptance Testing – While I prefer writing tests before I write the code, this is a simple way to record tests on existing web applications. In part II I will show you how to export these recordings into Java. By exporting these scripts you can easily add them to your existing automated test suite.
- Demo Setup – I’ve found it handy to run small Selenium test cases to setup a demo. For example you may want to demonstrate the functionality on the tenth page that requires a log-in and multiple data entry steps. This approach can reduce demo setup time and enable you to focus on demonstrating new functionality.
Setup
- Install the Selenium IDE Firefox plugin (http://seleniumhq.org/projects/ide/)
- Navigate to https://sites.google.com/site/example4selenium/ in Firefox
- Tools -> Selenium IDE
Greasemonkey
February 18th, 2011Greasemonkey is an extension for Firefox that leverages javascript to modify the look and functionality of a page. At first glance this tool looks like a neat toy. However, this tool came in quite handy at one of our clients recently.
Our client was tracking their daily status on a whiteboard in a conference room. A corporate memo was sent out banning the exclusive use of whiteboards for teams. As a result we turned to our web-based tracking tool. Unfortunately their whiteboard equivalent was clunky and inadequate. I spent a few hours putting together a Greasemonkey script that altered the look of this page to mimic our old whiteboard. These changes helped ease this transition.
» Read more: Greasemonkey