[jboss-cvs] JBossAS SVN: r102114 - projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 9 02:13:24 EST 2010


Author: ALRubinger
Date: 2010-03-09 02:13:24 -0500 (Tue, 09 Mar 2010)
New Revision: 102114

Modified:
   projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/CalculatorIntegrationTestCase.java
   projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/MultiViewCalculatorIntegrationTestCase.java
Log:
[EJBBOOK-20] Remove unnecessary JNDI calls in favor of injection

Modified: projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/CalculatorIntegrationTestCase.java
===================================================================
--- projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/CalculatorIntegrationTestCase.java	2010-03-09 06:43:14 UTC (rev 102113)
+++ projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/CalculatorIntegrationTestCase.java	2010-03-09 07:13:24 UTC (rev 102114)
@@ -24,8 +24,7 @@
 
 import java.net.MalformedURLException;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
+import javax.ejb.EJB;
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
@@ -37,10 +36,8 @@
 import org.junit.runner.RunWith;
 
 /**
- * CalculatorIntegrationTestCase
- * 
  * Integration tests for the CalculatorEJB exposing one 
- * remote business view
+ * business view
  *
  * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
  * @version $Revision: $
@@ -58,13 +55,9 @@
    private static final Logger log = Logger.getLogger(CalculatorIntegrationTestCase.class);
 
    /**
-    * The JNDI Naming Context
-    */
-   private static Context namingContext;
-
-   /**
     * The EJB 3.x local business view of the CalculatorEJB
     */
+   @EJB
    private static CalculatorLocalBusiness calcLocalBusiness;
 
    /**
@@ -73,12 +66,6 @@
    private static CalculatorAssertionDelegate assertionDelegate;
 
    /**
-    * JNDI Name of the Remote Business Reference
-    */
-   //TODO Use Global JNDI Syntax 
-   private static final String JNDI_NAME_CALC_LOCAL_BUSINESS = SimpleCalculatorBean.class.getSimpleName() + "Local";
-
-   /**
     * Define the deployment
     */
    @Deployment
@@ -100,12 +87,6 @@
    @BeforeClass
    public static void beforeClass() throws Throwable
    {
-      // Create the naming context, using jndi.properties on the CP
-      namingContext = new InitialContext();
-
-      // Obtain EJB 3.x Business Reference
-      calcLocalBusiness = (CalculatorLocalBusiness) namingContext.lookup(JNDI_NAME_CALC_LOCAL_BUSINESS);
-
       // Create Assertion Delegate
       assertionDelegate = new CalculatorAssertionDelegate();
    }
@@ -122,7 +103,7 @@
    public void testAdditionUsingBusinessReference() throws Throwable
    {
       // Test 
-      log.info("Testing remote business reference...");
+      log.info("Testing EJB via business reference...");
       assertionDelegate.assertAdditionSucceeds(calcLocalBusiness);
    }
 

Modified: projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/MultiViewCalculatorIntegrationTestCase.java
===================================================================
--- projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/MultiViewCalculatorIntegrationTestCase.java	2010-03-09 06:43:14 UTC (rev 102113)
+++ projects/ejb-book/trunk/ch04-firstejb/src/test/java/org/jboss/ejb3/examples/ch04/firstejb/MultiViewCalculatorIntegrationTestCase.java	2010-03-09 07:13:24 UTC (rev 102114)
@@ -85,7 +85,7 @@
    /**
     * JNDI Name of the Local Home Reference
     */
-   //TODO Use Global JNDI Syntax (not yet supported in JBoss EJB3)
+   //TODO Use Global JNDI Syntax 
    private static final String JNDI_NAME_CALC_REMOTE_HOME = ManyViewCalculatorBean.class.getSimpleName() + "LocalHome";
 
    /**




More information about the jboss-cvs-commits mailing list