Hi All...

  Well I have an opinion about that, and I hope you will like it:

1- As DBlevins has explained above, delploying EJB in OpenEJB is a
very simple and neat task, which actually does not need a Maven
plugin.

2- Yesterday I was talking to a colleague in IBM Egypt and he really
liked the idea of how you can embed OpenEJB in your test cases and
test your EJB very simple, but he had a real problem, which is that
his EJB has a lot of functions and he didn't want to write test cases
for each method of the EJB by himself.

3- Here comes my idea, what if we develop an Maven plugin which will
generate test cases for a given EJB, or at least provide a generic
test client which can test any given EJB, as we can know what
functions provided by an EJB at run time. IMHO this will add an
advantage to OpenEJB  to make EJB testing more easy. We can even
provide our own annotations which an EJB developer can add to set
conditions on each method, so the generic test client or the generated
one can know what constraints are applied on that method, what are
expected results and what are scenarios throught which that method of
the EJB or the EJB as a whole will be used.

So imagine all these testing functionality are provided out of the box
to OpenEJB users, which will be another attractive point for OpenEJB
users to use more and more and even more easily each time they
download a new version of it :D.


On Wed, Mar 5, 2008 at 10:28 AM, David Blevins <[EMAIL PROTECTED]> wrote:
> On this note, there is a similar thread on the maven users list:
>
>   
> http://www.nabble.com/Unit-Testing-Hibernate-Entities-EJB3-EE-%28Req-Advice%29-to15840586s177.html
>
>  -David
>
>
>
>  On Mar 5, 2008, at 12:13 AM, David Blevins wrote:
>
>  >
>  > On Mar 4, 2008, at 11:17 PM, Manu George wrote:
>  >
>  >> What about this including a few mojos for doing container driven
>  >> testing? I am not very conversant with how you can do container
>  >> driven
>  >> testing in openejb (need to read alexander's articles). However a
>  >> maven plugin using which your ejbs will be tested during the build
>  >> process would be nice option to have.
>  >
>  > Pretty much all the examples we have use container driven testing.
>  > The only one that doesn't is examples/webapps/ejb-examples/.  Most
>  > have ant and maven build files.
>  >
>  > The basic maven howto is this:
>  >
>  > Step 1:  Add this to your pom.xml
>  >
>  >    <dependency>
>  >      <groupId>org.apache.openejb</groupId>
>  >      <artifactId>openejb-core</artifactId>
>  >      <version>3.0-SNAPSHOT</version>
>  >      <scope>test</scope>
>  >    </dependency>
>  >
>  > Step 2:  Add an ejb-jar.xml file
>  >
>  >  Make sure you have an src/main/resources/META-INF/ejb-jar.xml.  A
>  > simple one need only contain "<ejb-jar/>".
>  >
>  > Step 3:  Test Setup
>  >
>  >    protected void setUp() throws Exception {
>  >        Properties properties = new Properties();
>  >        properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>  > "org.apache.openejb.client.LocalInitialContextFactory");
>  >        initialContext = new InitialContext(properties);
>  >    }
>  >
>  >
>  > Done.  That really is all there is to it.  And, yes, I'm serious :)
>  > And, yes, that is very cool.  And, no, no other vendor does it quite
>  > that simply -- they all need plugins ;)  You can configure nearly
>  > anything in the entire container (pool sizes, datasources, topics,
>  > queues, etc.) via the InitialContext properties so you can setup
>  > things exactly how you want them for that exact set of tests.
>  >
>  > The same process works for any build system or IDE or any app.  The
>  > biggest variance will be Step #1, i.e. adding OpenEJB to the
>  > classpath, everything else is always the same.
>  >
>  > If you're a maven user you can generate an eclipse or intellij
>  > project will already be setup and ready to go.  If you're an ant
>  > user you have to create your IDE's classpath by hand and it maybe
>  > frustrating getting all the right jars in your IDE.  It would be
>  > cool if there was one big openejb jar that had all our deps in it
>  > for to make that easier.
>  >
>  > Regardless of how simple it is and how it can be done in any
>  > environment without a plugin, I'm not opposed to the idea of having
>  > openejb plugins for various environments.  We might find ways to
>  > make it even simpler or new things to offer people.
>  >
>  > -David
>  >
>  >
>
>



-- 
Thanks
- Mohammad Nour

Reply via email to