![]() |
![]() |
![]() |
![]() |
![]() |
||||||
![]() |
Index | News | FAQ | Download | Lists | Issues![]() |
![]() |
||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
||||||
OverviewAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/README.txt. The system administrator has been notified.The CodeIn this example we develop two simple session stateless beans (DataReader and DataStore), and show how we can use the @EJB annotation in one of these beans to get the reference to the other session bean DataStore session beanLocal business interfaceAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/main/java/org/apache/openejb/examples/injection/DataStoreLocal.java. The system administrator has been notified.Remote business interfaceAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/main/java/org/apache/openejb/examples/injection/DataStoreRemote.java. The system administrator has been notified.BeanAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/main/java/org/apache/openejb/examples/injection/DataStoreImpl.java. The system administrator has been notified.DataReader session beanLocal business interfaceAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/main/java/org/apache/openejb/examples/injection/DataReaderLocal.java. The system administrator has been notified.BeanAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/main/java/org/apache/openejb/examples/injection/DataReaderImpl.java. The system administrator has been notified.(The remote business interface is not shown for the sake of brevity).
Writing a unit test for the exampleWriting an unit test for this example is quite simple. We need just to write a setup method to create and initialize the InitialContext, and then write our test methods setUpAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/test/java/org/apache/openejb/examples/injection/EjbDependencyTest.java. The system administrator has been notified.TestAn error occurred: http://svn.apache.org/repos/asf/openejb/trunk/openejb3/examples/ejb-injection/src/test/java/org/apache/openejb/examples/injection/EjbDependencyTest.java. The system administrator has been notified.RunningRunning the example is fairly simple, just run: $ cd ejb-injection Which should create output like the following. ------------------------------------------------------- T E S T S ------------------------------------------------------- [OPENEJB:surefire] Running org.apache.openejb.examples.injection.EjbDependencyTest log4j:WARN No appenders could be found for logger (OpenEJB). log4j:WARN Please initialize the log4j system properly. Apache OpenEJB 3.0-incubating-SNAPSHOT build: 20070105-12:45 http://incubator.apache.org/openejb OpenEJB ready. [OPENEJB:surefire] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 2.006 sec [OPENEJB:INFO] [jar:jar] [OPENEJB:INFO] Building jar: openejb3/examples/ejb-injection/target/ejb-injection-sample-1.0-SNAPSHOT.jar [OPENEJB:INFO] [install:install] [OPENEJB:INFO] Installing openejb3/examples/ejb-injection/target/ejb-injection-sample-1.0-SNAPSHOT.jar to ... [OPENEJB:INFO] ------------------------------------------------------------------------ [OPENEJB:INFO] BUILD SUCCESSFUL [OPENEJB:INFO] ------------------------------------------------------------------------ |
![]() |
|||||||||
![]()
|
![]() |