No more ‘LazyInitializationException’ in your integration tests

July 16, 2008 by Ana

Below an example of what you need to do using JUnit 4 to prevent ‘LazyInitializationException’.

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { “classpath:application-context-test.xml” })
public class AccountServiceIntregrationTests extends
AbstractTransactionalJUnit4SpringContextTests {

protected static final String SESSION_FACTORY = “sessionFactory”;

protected static ApplicationContext ctx =
new ClassPathXmlApplicationContext(
“classpath:application-context-test.xml”);

protected static SessionFactory sessionFactory;

@Autowired
private AccountService accountService;

@BeforeClass
public static void oneTimeSetUp() throws Exception {
sessionFactory = (SessionFactory) ctx.getBean(SESSION_FACTORY);
Session session = SessionFactoryUtils.getSession(sessionFactory, true);
session.setFlushMode(FlushMode.MANUAL);
TransactionSynchronizationManager.bindResource(sessionFactory,
new SessionHolder(session));
}

@AfterClass
public static void oneTimeTearDown() throws Exception {
SessionHolder sessionHolder =
(SessionHolder) TransactionSynchronizationManager
.unbindResource(sessionFactory);
SessionFactoryUtils.closeSession(sessionHolder.getSession());
}

@Test
public void testCreateAccount() {

// Do you test here.

}

}

Cheers,

Ana

Localization with Spring 2.5

July 11, 2008 by Ana

Hello,

In Spring 2.5 you can tell in your dispatcher servlet configuration to scan for @Controller annotations. That way you don’t configure URL mappings explicity in the dispacher servlet as you used to do before since the annotations are added to the controller classes themselves. It’s less XML and I really like it. However I did not know how to add the locale interceptor in this case, because  there was no urlMapping bean defined. I found out online you just need to add the following configuration to the dispatcher servlet.

<bean     class=”org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping”>
<property name=”interceptors” ref=”localeChangeInterceptor” />

</bean>

Hope this helps you too.

My Team

June 25, 2008 by Ana

There are not that many portuguese at TomTom, maybe 10 in total and 3 of them are in my team. :)

Tracking progress the easy way

March 27, 2008 by Ana

This sprint we started using Jira to track our progress. The Greenhopper Plugin produces a really nice burn-down chart, therefore we don’t have to do all that work manually. The good thing is that we can log the work done and update the remaining estimates quite quickly at the end of the day and have an up-to-date chart that tell us how good we’re doing or if we are running out of time.

Above is the burn-down chart for the first sprint of a new project we are working on. You can see we finished 1 day earlier and we overestimated some of the tasks but in the end it turn out to be a very good sprint with software ready to demo. :)

Click the here for a more detailed version of the chart.

Why TomTom?

March 27, 2008 by Ana

Better routes, better maps, better traffic information!

Find out more:

Ladies in Java

March 14, 2008 by Ana

TomTom Young Talent Development Program

March 12, 2008 by Ana

I was selected for the TomTom Young Development Program later last year. :)

We had our first module in the RSM Rotterdam and it was great to meet with “TomTomers” from all other departments and offices from around the world. The TomTom YTD Program is made of carefully developed modules, courses and coaching and interaction with peers in a dynamic, multi disciplinary and international environment. Themes include coaching, personal effectiveness, leadership development and communication.

“It is not enough to have a good mind; the main thing is to use it well” – Rene Descartes

Quotes that matter

January 21, 2008 by Ana
“Live as if you were to die tomorrow. Learn as if you were to live forever.” M. Gandhi

Manage your energy, not your time

January 17, 2008 by Ana

That is the title of an article by Tony Schwartz which I read last night. It might be common sense (or not) that eating better, exercising and taking relaxing breaks prolongs lives and makes people feel healthier and happy. But in the busyness of our lives how many of us is actually doing that? How many managers and leaders out there address these rituals in their own companies or teams? Focused, motivated and energized people perform better and produce more. Maybe it’s time to start supporting energizing rituals in our organizations. Here are some which I extracted from the article and that you can apply on your own:

  • Start moving, do cardiovascular training and strength training at least 3 times a week
  • Eat healthier and do not skip breakfast, take a break for lunch
  • Take regular breaks during the day – go up and down the stairs or go for a walk
  • Attract positive energy by changing the stories you tell to yourself – don’t be irritated just because it’s raining, instead enjoy the good side of it
  • Breath deeply to recover and relax from a stressful situation
  • When focusing in a task avoid distractions, turn off your email – distractions will make you loose 25% of your time on each task (it’s not worth it!)

Remember, time is limited but energy is not!

Innovation in many good ways

January 17, 2008 by Ana

“We work for a successful company that is profitable, expanding and admired. At the same time, our prize-winning products save lives, save fuel, reduce stress, save time, and reduce air pollution. How many people can say that about their job?” – Pieter Geelen (co-founder@TomTom)