Java Reference
In-Depth Information
}catch(Exception ex){
ex.printStackTrace();
}
}
}
Given the changes in JMS 2.0 Specification, the EJB 3.2 Specification has a revised
list of JMS MDB activation properties to conform to the list of standard properties.
Thesepropertiesare: destinationLookup , connectionFactoryLookup , cli-
entId , subscriptionName , and shareSubscriptions . In addition, it has ad-
ded the ability in MDB to implement a no-method message listener, resulting in the
exposure of all public methods of the bean as message listener methods.
Other improvements
As we said earlier, the EJB 3.1 Specification has given developers the opportunity to
test EJB applications outside a full Java EE server. This was made possible through
an embeddable EJBContainer . The following example demonstrates how to test
an EJB using an embeddable EJBContainer :
@Test
public void testAddition(){
Map<String, Object> properties = new
HashMap<String, Object>();
properties.put(EJBContainer.APP_NAME,
"chapter05EmbeddableEJBContainer");
properties.put(EJBContainer.MODULES, new
File("target\\classes"));
EJBContainer container =
javax.ejb.embeddable.EJBContainer.createEJBContainer(properties);
try {
NewSessionBean bean = (NewSessionBean)
container.getContext().lookup("java:global/
chapter05EmbeddableEJBContainer/
NewSessionBean");
int restult = bean.addition(10, 10);
Assert.assertEquals(20, restult);
Search WWH ::




Custom Search