Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Testing Your Enterprise JavaBeans with Cactus

Enterprise JavaBeans provide many advantages. But each server-side/back-end developer knows that development of EJBs is sometimes painful, time-consuming, and requires a lot of patience while creating assembly descriptors, application-server-specific conf

Tutorial Details:

Testing Your Enterprise JavaBeans with Cactus

Enterprise JavaBeans provide many advantages. But each server-side/back-end developer knows that development of EJBs is sometimes painful, time-consuming, and requires a lot of patience while creating assembly descriptors, application-server-specific configuration files, etc. And beyond that is the question: How will we test our EJB?

Let me describe the following real-life situation from my own experience, and see if you haven't experienced the same thing.

I need to implement my project's business logic in a session bean, one that will work with few other EJBs. I will also create documentation in UML (and/or JavaDoc format) to describe the business methods exposed by my EJB. Few other back-end and/or front-end developers will use these business methods from their code.

Time passes and my session bean is ready. At least I think so. But let's be more realistic! I've implemented just a tiny part of the whole business logic, and I need to check how it works. But how will I test it? Do I test business logic by calling EJB methods, like a normal Java class? No, never! Do I need to create an additional EJB client and use that? Probably. But what if I will need to share my test reports with other developers? That could definitely waste my time, and instead of developing just the EJB itself, I will have to develop a useless client, which will be only be needed during development.

I'd really prefer to use some existing tool, and if that makes you think of JUnit, you're right. JUnit is a framework for unit-testing Java applications. Unfortunately, I think plain JUnit is rather useless for testing EJBs. Furthermore, I don't think that it would be a good idea to test an EJB without putting it into a proper container.

Having looked as several hand-crafted variants for testing EJBs, I have settled on Jakarta Cactus. Cactus will let us run its tests run inside of the bean container. As you'll soon see, that makes a big difference.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Testing Your Enterprise JavaBeans with Cactus

View Tutorial:
Testing Your Enterprise JavaBeans with Cactus

Related Tutorials:

The state of Java middleware, Part II: Enterprise JavaBeans - JavaWorld - April 1999
The state of Java middleware, Part II: Enterprise JavaBeans - JavaWorld - April 1999
 
A beginner's guide to Enterprise JavaBeans - JavaWorld - October 1998
A beginner's guide to Enterprise JavaBeans - JavaWorld - October 1998
 
Test infect your Enterprise JavaBeans - JavaWorld May 2000
Test infect your Enterprise JavaBeans - JavaWorld May 2000
 
The art of EJB deployment - JavaWorld August 2001
The art of EJB deployment - JavaWorld August 2001
 
Finalists announced for JavaWorld Editors' Choice Awards
Finalists announced for JavaWorld Editors' Choice Awards
 
Step into the J2EE architecture and process
Step into the J2EE architecture and process
 
Design patterns make for better J2EE apps
Design patterns make for better J2EE apps
 
Rumble in the jungle: J2EE versus .Net, Part 1
Rumble in the jungle: J2EE versus .Net, Part 1
 
Best tools for mobile application development
Best tools for mobile application development
 
Axis-orizing objects for SOAP
Axis-orizing objects for SOAP
 
Java tools reign supreme - JavaWorld celebrates the leading Java tools
Java tools reign supreme - JavaWorld celebrates the leading Java tools
 
Profiling the profilers
Profiling the profilers
 
Object-relation mapping without the container
If you follow the latest developer buzz then you\\\\\'ve likely heard of IOC (Inversion of Control) containers and AOP (aspect-oriented programming).
 
Java Testing and Design
Java Testing and Java Test and Design is the companion to any book on Java software development practices, techniques, and testing. Software developers, QA analysts and IT managers working in large corporate IT groups, software development companies, and
 
Turn EJB components into Web services
Summary Web services have become the de facto standard for communication among applications. J2EE 1.4 allows stateless Enterprise JavaBeans (EJB) components to be exposed as Web services via a JAX-RPC (Java API for XML Remote Procedure Call) endpoint, al
 
A lightweight nonintrusive EJB testing framework
A lightweight nonintrusive EJB testing framework Summary This article presents a simple, easy-to-deploy framework that enables fine-grained tests to be run on the container, making it possible to develop and maintain Enterprise JavaBeans components usin
 
Testing Your Enterprise JavaBeans with Cactus
Enterprise JavaBeans provide many advantages. But each server-side/back-end developer knows that development of EJBs is sometimes painful, time-consuming, and requires a lot of patience while creating assembly descriptors, application-server-specific conf
 
Developing Distributed application using Enterprise Java Beans, J2EE Architecture, EJB Tutorial, WebLogic Tutorial.
Developing Distributed application using Enterprise Java Beans, J2EE Architecture, EJB Tutorial, WebLogic Tutorial. Distributed Architecture Two-tier application: In the past two-tier applications were used. Two-tier applications are also know as
 
Introduction To Enterprise Java Bean(EJB). WebLogic 6.0 Tutorial.
Introduction To Enterprise Java Bean(EJB). WebLogic 6.0 Tutorial. Welcome to EJB Section (Learn to Develop World Class Applications with Enterprise Java Beans) (Online WebLogic 6.0 Tutorial) Introduction To Enterprise Java Bean(EJB) Enterprise
 
NetBeans IDE 4.1
Out-of-the-box support for J2EE 1.4 and Web Services. Check out what early access release 2 can do for you!
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.