February 2015
Intermediate to advanced
178 pages
3h 47m
English
Sometimes, we need to mock the <jee:jndi-lookup>/JNDI lookup with a mock value in the out-of-container tests. The org.springframework.mock.jndi package contains an implementation of the JNDI SPI, which you can use to set up a simple JNDI environment for test suites or standalone applications. In the following example, we'll define <jee:jndi-lookup> for the DataSource resource in applicationContext and mock out the lookup from the test. The following are the steps to mock up a JNDI call:
applicationContext.xml file in the com.packt.jndi package, with the following details:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:jee="http://www.springframework.org/schema/jee" ...
Read now
Unlock full access