djencks     2004/06/11 15:19:16

  Modified:    modules/core/src/test/org/openejb/entity
                        BasicBMPEntityContainerTest.java
                        BasicCMPEntityContainerTest.java
  Log:

  Replace hardcoded name reference patterns with configurable names from the 
EarDeployer
  
  Revision  Changes    Path
  1.5       +13 -11    
openejb/modules/core/src/test/org/openejb/entity/BasicBMPEntityContainerTest.java
  
  Index: BasicBMPEntityContainerTest.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/entity/BasicBMPEntityContainerTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BasicBMPEntityContainerTest.java  16 Apr 2004 02:34:09 -0000      1.4
  +++ BasicBMPEntityContainerTest.java  11 Jun 2004 19:19:16 -0000      1.5
  @@ -49,18 +49,18 @@
   
   import java.util.Collections;
   import java.util.HashSet;
  +import java.util.Set;
  +
   import javax.ejb.EJBObject;
   import javax.management.ObjectName;
   
  +import junit.framework.TestCase;
   import 
org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.kernel.Kernel;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   import org.apache.geronimo.naming.java.ReadOnlyContext;
  -import org.apache.geronimo.transaction.TransactionManagerProxy;
  -
  -import junit.framework.TestCase;
  -import org.openejb.MockTransactionManager;
  +import org.apache.geronimo.transaction.GeronimoTransactionManager;
   import org.openejb.deployment.TransactionPolicySource;
   import org.openejb.dispatch.InterfaceMethodSignature;
   import org.openejb.entity.bmp.BMPContainerBuilder;
  @@ -80,13 +80,14 @@
   
       public void testSimpleConfig() throws Throwable {
           MockHome home = (MockHome) kernel.getAttribute(CONTAINER_NAME, "EJBHome");
  -        assertEquals(5+1, home.intMethod(5));
  +        assertEquals(5 + 1, home.intMethod(5));
   
           EJBObject ejbObject1 = home.findByPrimaryKey(new Integer(1));
           assertEquals(new Integer(1), ejbObject1.getPrimaryKey());
           assertTrue(ejbObject1.isIdentical(ejbObject1));
   
  -        EJBObject ejbObject2 = home.findByPrimaryKey(new Integer(2));;
  +        EJBObject ejbObject2 = home.findByPrimaryKey(new Integer(2));
  +        ;
           assertEquals(new Integer(2), ejbObject2.getPrimaryKey());
           assertTrue(ejbObject2.isIdentical(ejbObject2));
   
  @@ -153,10 +154,11 @@
           kernel = new Kernel("BeanManagedPersistenceTest");
           kernel.boot();
   
  -        GBeanMBean transactionManager = new 
GBeanMBean(TransactionManagerProxy.GBEAN_INFO);
  -        transactionManager.setAttribute("Delegate", new MockTransactionManager());
  -        start(TM_NAME, transactionManager);
  -
  +        GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
  +        Set rmpatterns = new HashSet();
  +        
rmpatterns.add(ObjectName.getInstance("geronimo.management:J2eeType=ManagedConnectionFactory,*"));
  +        tmGBean.setReferencePatterns("resourceManagers", rmpatterns);
  +        start(TM_NAME, tmGBean);
           GBeanMBean trackedConnectionAssociator = new 
GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
           start(TCA_NAME, trackedConnectionAssociator);
   
  
  
  
  1.14      +9 -6      
openejb/modules/core/src/test/org/openejb/entity/BasicCMPEntityContainerTest.java
  
  Index: BasicCMPEntityContainerTest.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/test/org/openejb/entity/BasicCMPEntityContainerTest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BasicCMPEntityContainerTest.java  4 Jun 2004 22:24:23 -0000       1.13
  +++ BasicCMPEntityContainerTest.java  11 Jun 2004 19:19:16 -0000      1.14
  @@ -55,6 +55,8 @@
   import java.util.Collections;
   import java.util.HashMap;
   import java.util.HashSet;
  +import java.util.Set;
  +
   import javax.ejb.NoSuchObjectLocalException;
   import javax.ejb.ObjectNotFoundException;
   import javax.management.ObjectName;
  @@ -68,10 +70,9 @@
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   import org.apache.geronimo.naming.java.ReadOnlyContext;
   import org.apache.geronimo.naming.jmx.JMXReferenceFactory;
  -import org.apache.geronimo.transaction.TransactionManagerProxy;
  +import org.apache.geronimo.transaction.GeronimoTransactionManager;
   import org.axiondb.jdbc.AxionDataSource;
   import org.openejb.ContainerIndex;
  -import org.openejb.MockTransactionManager;
   import org.openejb.deployment.MockConnectionProxyFactory;
   import org.openejb.deployment.TransactionPolicySource;
   import org.openejb.dispatch.InterfaceMethodSignature;
  @@ -426,9 +427,11 @@
           kernel = new Kernel("ContainerManagedPersistenceTest");
           kernel.boot();
   
  -        GBeanMBean transactionManager = new 
GBeanMBean(TransactionManagerProxy.GBEAN_INFO);
  -        transactionManager.setAttribute("Delegate", new MockTransactionManager());
  -        start(TM_NAME, transactionManager);
  +        GBeanMBean tmGBean = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
  +        Set rmpatterns = new HashSet();
  +        
rmpatterns.add(ObjectName.getInstance("geronimo.management:J2eeType=ManagedConnectionFactory,*"));
  +        tmGBean.setReferencePatterns("resourceManagers", rmpatterns);
  +        start(TM_NAME, tmGBean);
   
           GBeanMBean trackedConnectionAssociator = new 
GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
           start(TCA_NAME, trackedConnectionAssociator);
  
  
  

Reply via email to