geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty ApplicationTest.java
Date Fri, 11 Jun 2004 19:18:21 GMT
djencks     2004/06/11 12:18:21

  Modified:    modules/assembly/src/plan j2ee-deployer-plan.xml
                        j2ee-server-plan.xml
               modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment
                        EARConfigBuilder.java EARContext.java
               modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment
                        EARConfigBuilderTest.java EARContextTest.java
               modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        JettyModuleBuilder.java
               modules/jetty/src/test/org/apache/geronimo/jetty
                        ApplicationTest.java
  Log:
  Replace hardcoded name reference patterns with configurable names from the EarDeployer
  
  Revision  Changes    Path
  1.17      +2 -0      incubator-geronimo/modules/assembly/src/plan/j2ee-deployer-plan.xml
  
  Index: j2ee-deployer-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/j2ee-deployer-plan.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- j2ee-deployer-plan.xml	5 Jun 2004 01:40:08 -0000	1.16
  +++ j2ee-deployer-plan.xml	11 Jun 2004 19:18:21 -0000	1.17
  @@ -91,6 +91,8 @@
           <reference name="EJBConfigBuilder">geronimo.deployer:role=ModuleBuilder,type=EJB,config=org/apache/geronimo/J2EEDeployer</reference>
           <reference name="WebConfigBuilder">geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer</reference>
           <!--        <reference name="ConnectorConfigBuilder"></reference>
-->
  +        <attribute name="transactionManagerObjectName" type="javax.management.ObjectName">geronimo.server:type=TransactionManager</attribute>
  +        <attribute name="connectionTrackerObjectName" type="javax.management.ObjectName">geronimo.server:type=ConnectionTracker</attribute>
       </gbean>
   
       <gbean name="geronimo.deployer:role=ModuleBuilder,type=Web,config=org/apache/geronimo/J2EEDeployer"
class="org.apache.geronimo.jetty.deployment.JettyModuleBuilder"/>
  
  
  
  1.24      +8 -3      incubator-geronimo/modules/assembly/src/plan/j2ee-server-plan.xml
  
  Index: j2ee-server-plan.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/assembly/src/plan/j2ee-server-plan.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- j2ee-server-plan.xml	5 Jun 2004 01:40:08 -0000	1.23
  +++ j2ee-server-plan.xml	11 Jun 2004 19:18:21 -0000	1.24
  @@ -114,15 +114,20 @@
           <attribute name="StartMaximumPoolSize" type="int">10</attribute>
           <attribute name="ScheduledMinimumPoolSize" type="int">0</attribute>
           <attribute name="ScheduledMaximumPoolSize" type="int">10</attribute>
  -        <reference name="XAWork">geronimo.transaction:service=TransactionManager</reference>
  +        <reference name="XAWork">geronimo.server:type=TransactionManager</reference>
       </gbean>
   
       <gbean name="geronimo.server:type=BootstrapContext" class="org.apache.geronimo.connector.BootstrapContext">
           <reference name="WorkManager">geronimo.connector:service=WorkManager</reference>
  -        <reference name="XATerminator">geronimo.transaction:service=TransactionManager</reference>
  +        <reference name="XATerminator">geronimo.server:type=TransactionManager</reference>
       </gbean>
   
  -    <gbean name="geronimo.server:type=TransactionManager" class="org.apache.geronimo.transaction.TransactionManagerProxy"/>
  +    <gbean name="geronimo.server:type=TransactionManager" class="org.apache.geronimo.transaction.GeronimoTransactionManager">
  +        <references name="resourceManagers">
  +            <pattern>geronimo.management:J2eeType=ManagedConnectionFactory,*</pattern>
  +            <pattern>geronimo.server:j2eeType=MessageDrivenBean,*</pattern>
  +        </references>
  +    </gbean>
   
   
       <!-- default WAR container using Jetty -->
  
  
  
  1.6       +23 -5     incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
  
  Index: EARConfigBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EARConfigBuilder.java	5 Jun 2004 01:40:09 -0000	1.5
  +++ EARConfigBuilder.java	11 Jun 2004 19:18:21 -0000	1.6
  @@ -35,6 +35,7 @@
   import java.util.jar.JarOutputStream;
   import java.util.jar.Manifest;
   import java.util.zip.ZipEntry;
  +
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  @@ -69,10 +70,13 @@
       private final ModuleBuilder connectorConfigBuilder;
       private final String j2eeServerName;
       private final String j2eeDomainName;
  -    private ObjectName j2eeServer;
  +    private final ObjectName j2eeServer;
  +    private final ObjectName transactionManagerObjectName;
  +    private final ObjectName connectionTrackerObjectName;
   
   
  -    public EARConfigBuilder(Kernel kernel, Repository repository, ObjectName j2eeServer,
ModuleBuilder ejbConfigBuilder, ModuleBuilder webConfigBuilder, ModuleBuilder connectorConfigBuilder)
{
  +    public EARConfigBuilder(Kernel kernel, Repository repository, ObjectName j2eeServer,
ModuleBuilder ejbConfigBuilder, ModuleBuilder webConfigBuilder, ModuleBuilder connectorConfigBuilder,
  +                            ObjectName transactionManagerObjectName, ObjectName connectionTrackerObjectName)
{
           this.kernel = kernel;
           this.repository = repository;
           this.j2eeServer = j2eeServer;
  @@ -82,6 +86,8 @@
           this.ejbConfigBuilder = ejbConfigBuilder;
           this.webConfigBuilder = webConfigBuilder;
           this.connectorConfigBuilder = connectorConfigBuilder;
  +        this.transactionManagerObjectName = transactionManagerObjectName;
  +        this.connectionTrackerObjectName = connectionTrackerObjectName;
       }
   
       public boolean canConfigure(XmlObject plan) {
  @@ -166,7 +172,15 @@
               JarOutputStream os = new JarOutputStream(new BufferedOutputStream(fos));
               EARContext earContext = null;
               try {
  -                earContext = new EARContext(os, configId, parentId, kernel, j2eeDomainName,
j2eeServerName, applicationName);
  +                earContext = new EARContext(os,
  +                        configId,
  +                        parentId,
  +                        kernel,
  +                        j2eeDomainName,
  +                        j2eeServerName,
  +                        applicationName,
  +                        transactionManagerObjectName,
  +                        connectionTrackerObjectName);
               } catch (MalformedObjectNameException e) {
                   throw new DeploymentException(e);
               }
  @@ -368,6 +382,8 @@
       static {
           GBeanInfoFactory infoFactory = new GBeanInfoFactory(EARConfigBuilder.class);
           infoFactory.addAttribute("kernel", Kernel.class, false);
  +        infoFactory.addAttribute("transactionManagerObjectName", ObjectName.class, true);
  +        infoFactory.addAttribute("connectionTrackerObjectName", ObjectName.class, true);
           infoFactory.addReference("Repository", Repository.class);
           infoFactory.addAttribute("j2eeServer", ObjectName.class, true);
           infoFactory.addReference("EJBConfigBuilder", ModuleBuilder.class);
  @@ -382,7 +398,9 @@
               "j2eeServer",
               "EJBConfigBuilder",
               "WebConfigBuilder",
  -            "ConnectorConfigBuilder"});
  +            "ConnectorConfigBuilder",
  +            "transactionManagerObjectName",
  +            "connectionTrackerObjectName"});
   
           GBEAN_INFO = infoFactory.getBeanInfo();
       }
  
  
  
  1.4       +15 -2     incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java
  
  Index: EARContext.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/java/org/apache/geronimo/j2ee/deployment/EARContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EARContext.java	26 May 2004 21:12:08 -0000	1.3
  +++ EARContext.java	11 Jun 2004 19:18:21 -0000	1.4
  @@ -42,7 +42,10 @@
       private final ObjectName serverObjectName;
       private final ObjectName applicationObjectName;
   
  -    public EARContext(JarOutputStream jos, URI id, URI parentID, Kernel kernel, String
j2eeDomainName, String j2eeServerName, String j2eeApplicationName) throws MalformedObjectNameException,
DeploymentException {
  +    private final ObjectName transactionManagerObjectName;
  +    private final ObjectName connectionTrackerObjectName;
  +
  +    public EARContext(JarOutputStream jos, URI id, URI parentID, Kernel kernel, String
j2eeDomainName, String j2eeServerName, String j2eeApplicationName, ObjectName transactionManagerObjectName,
ObjectName connectionTrackerObjectName) throws MalformedObjectNameException, DeploymentException
{
           super(jos, id, parentID, kernel);
           this.j2eeDomainName = j2eeDomainName;
           this.j2eeServerName = j2eeServerName;
  @@ -83,6 +86,8 @@
           } else {
               applicationObjectName = null;
           }
  +        this.transactionManagerObjectName = transactionManagerObjectName;
  +        this.connectionTrackerObjectName = connectionTrackerObjectName;
   
       }
   
  @@ -108,6 +113,14 @@
   
       public ObjectName getApplicationObjectName() {
           return applicationObjectName;
  +    }
  +
  +    public ObjectName getTransactionManagerObjectName() {
  +        return transactionManagerObjectName;
  +    }
  +
  +    public ObjectName getConnectionTrackerObjectName() {
  +        return connectionTrackerObjectName;
       }
   
       public void addEJBRef(URI modulePath, String name, Object reference) throws DeploymentException
{
  
  
  
  1.2       +7 -5      incubator-geronimo/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java
  
  Index: EARConfigBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/EARConfigBuilderTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EARConfigBuilderTest.java	19 May 2004 20:53:59 -0000	1.1
  +++ EARConfigBuilderTest.java	11 Jun 2004 19:18:21 -0000	1.2
  @@ -61,12 +61,14 @@
    */
   public class EARConfigBuilderTest extends TestCase {
       private static final ObjectName j2eeServer = JMXUtil.getObjectName("someDomain:j2eeType=J2EEServer,name=J2EEServerName");
  +    private static final ObjectName transactionManagerObjectName = JMXUtil.getObjectName("someDomain:type=TransactionManager");
  +    private static final ObjectName connectionTrackerObjectName = JMXUtil.getObjectName("someDomain:type=ConnectionTracker");
   
       public void testBuildConfiguration() throws Exception {
           MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder();
           MockWARConfigBuilder webConfigBuilder = new MockWARConfigBuilder();
           MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder();
  -        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
webConfigBuilder, connectorConfigBuilder);
  +        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
webConfigBuilder, connectorConfigBuilder, transactionManagerObjectName, connectionTrackerObjectName);
           File earFile = new File("target/test-ear.ear");
   
           File carFile = File.createTempFile("EARTest", ".car");
  @@ -86,7 +88,7 @@
       public void testNoEJBDeployer() throws Exception {
           MockWARConfigBuilder warConfigBuilder = new MockWARConfigBuilder();
           MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder();
  -        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, null,
warConfigBuilder, connectorConfigBuilder);
  +        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, null,
warConfigBuilder, connectorConfigBuilder, transactionManagerObjectName, connectionTrackerObjectName);
           File earFile = new File("target/test-ear.ear");
   
           File carFile = File.createTempFile("EARTest", ".car");
  @@ -104,7 +106,7 @@
       public void testNoWARDeployer() throws Exception {
           MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder();
           MockConnectorConfigBuilder connectorConfigBuilder = new MockConnectorConfigBuilder();
  -        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
null, connectorConfigBuilder);
  +        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
null, connectorConfigBuilder, transactionManagerObjectName, connectionTrackerObjectName);
           File earFile = new File("target/test-ear.ear");
   
           File carFile = File.createTempFile("EARTest", ".car");
  @@ -122,7 +124,7 @@
       public void testNoConnectorDeployer() throws Exception {
           MockWARConfigBuilder warConfigBuilder = new MockWARConfigBuilder();
           MockEJBConfigBuilder ejbConfigBuilder = new MockEJBConfigBuilder();
  -        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
warConfigBuilder, null);
  +        EARConfigBuilder configBuilder = new EARConfigBuilder(null, null, j2eeServer, ejbConfigBuilder,
warConfigBuilder, null, transactionManagerObjectName, connectionTrackerObjectName);
           File earFile = new File("target/test-ear.ear");
   
           File carFile = File.createTempFile("EARTest", ".car");
  
  
  
  1.2       +6 -2      incubator-geronimo/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/EARContextTest.java
  
  Index: EARContextTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/j2ee/src/test/org/apache/geronimo/j2ee/deployment/EARContextTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EARContextTest.java	19 May 2004 20:53:59 -0000	1.1
  +++ EARContextTest.java	11 Jun 2004 19:18:21 -0000	1.2
  @@ -21,6 +21,8 @@
   import java.net.URI;
   import java.util.jar.JarOutputStream;
   
  +import javax.management.ObjectName;
  +
   import junit.framework.TestCase;
   
   /**
  @@ -133,7 +135,9 @@
                   null,
                   "j2eeDomain",
                   "j2eeServer",
  -                "j2eeApplicationName");
  +                "j2eeApplicationName",
  +                ObjectName.getInstance("j2eeDomain:type=TransactionManager"),
  +                ObjectName.getInstance("j2eeDomain:type=ConnectionTracker"));
   
           earContext.addEJBRef(coffee, "peaberry", coffee_peaberry);
           earContext.addEJBLocalRef(coffee, "peaberry", coffee_peaberry_local);
  
  
  
  1.8       +4 -4      incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java
  
  Index: JettyModuleBuilder.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/JettyModuleBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JettyModuleBuilder.java	10 Jun 2004 02:24:27 -0000	1.7
  +++ JettyModuleBuilder.java	11 Jun 2004 19:18:21 -0000	1.8
  @@ -231,7 +231,7 @@
               } else {
                   warRoot = URI.create("war/");
               }
  -            
  +
               String PolicyContextID = (earContext.getApplicationObjectName()==null? module.getName():earContext.getApplicationObjectName().toString());
   
               gbean.setAttribute("URI", warRoot);
  @@ -244,8 +244,8 @@
               setResourceEnvironment(gbean, webApp.getResourceRefArray(), jettyWebApp.getResourceRefArray());
               gbean.setReferencePatterns("Configuration", Collections.singleton(new ObjectName("geronimo.config:name="
+ ObjectName.quote(configID.toString())))); // @todo this is used to resolve relative URIs,
we should fix this
               gbean.setReferencePatterns("JettyContainer", Collections.singleton(new ObjectName("*:type=WebContainer,container=Jetty")));
// @todo configurable
  -            gbean.setReferencePatterns("TransactionManager", Collections.singleton(new
ObjectName("*:type=TransactionManager,*")));
  -            gbean.setReferencePatterns("TrackedConnectionAssociator", Collections.singleton(new
ObjectName("*:type=ConnectionTracker,*")));
  +            gbean.setReferencePatterns("TransactionManager", Collections.singleton(earContext.getTransactionManagerObjectName()));
  +            gbean.setReferencePatterns("TrackedConnectionAssociator", Collections.singleton(earContext.getConnectionTrackerObjectName()));
           } catch (Exception e) {
               throw new DeploymentException("Unable to initialize webapp GBean", e);
           }
  
  
  
  1.10      +7 -3      incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java
  
  Index: ApplicationTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/ApplicationTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApplicationTest.java	30 May 2004 19:09:57 -0000	1.9
  +++ ApplicationTest.java	11 Jun 2004 19:18:21 -0000	1.10
  @@ -24,6 +24,7 @@
   import java.net.URL;
   import java.util.Collections;
   import java.util.Set;
  +import java.util.HashSet;
   
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
  @@ -33,7 +34,7 @@
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
   import org.apache.geronimo.jetty.connector.HTTPConnector;
   import org.apache.geronimo.kernel.Kernel;
  -import org.apache.geronimo.transaction.TransactionManagerProxy;
  +import org.apache.geronimo.transaction.GeronimoTransactionManager;
   import org.apache.geronimo.transaction.UserTransactionImpl;
   
   /**
  @@ -109,7 +110,10 @@
           start(containerName, container);
           start(connectorName, connector);
   
  -        tm = new GBeanMBean(TransactionManagerProxy.GBEAN_INFO);
  +        tm = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
  +        Set patterns = new HashSet();
  +        patterns.add(ObjectName.getInstance("geronimo.management:J2eeType=ManagedConnectionFactory,*"));
  +        tm.setReferencePatterns("resourceManagers", patterns);
           start(tmName, tm);
           ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
           start(tcaName, ctc);
  
  
  

Mime
View raw message