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/connector/src/test-data/connector_1_5 geronimo-ra.xml
Date Tue, 10 Feb 2004 08:04:21 GMT
djencks     2004/02/10 00:04:21

  Modified:    modules/connector/src/java/org/apache/geronimo/connector/deployment
                        Connector_1_5Module.java RARConfiguration.java
               modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean
                        AdminObjectInstanceDConfigBean.java
                        ResourceAdapterDConfigBean.java
                        ResourceAdapterDConfigRoot.java
               modules/connector/src/schema geronimo-connector_1_5.xsd
               modules/connector/src/test/org/apache/geronimo/connector/deployment
                        Connector_1_5Test.java
               modules/connector/src/test-data/connector_1_0
                        geronimo-ra.xml
               modules/connector/src/test-data/connector_1_5
                        geronimo-ra.xml
  Log:
  some tests, so now the dconfigbeans work slightly
  
  Revision  Changes    Path
  1.7       +2 -2      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/Connector_1_5Module.java
  
  Index: Connector_1_5Module.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/Connector_1_5Module.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Connector_1_5Module.java	9 Feb 2004 23:13:27 -0000	1.6
  +++ Connector_1_5Module.java	10 Feb 2004 08:04:21 -0000	1.7
  @@ -147,7 +147,7 @@
               throw new DeploymentException(e);
           }
           try {
  -            resourceAdapterObjectName = ObjectName.getInstance(BASE_RESOURCE_ADAPTER_NAME
+ configID);
  +            resourceAdapterObjectName = ObjectName.getInstance(BASE_RESOURCE_ADAPTER_NAME
+ geronimoResourceAdapter.getResourceadapterName() + ",configID=" + configID);
           } catch (MalformedObjectNameException e) {
               throw new DeploymentException("Could not construct resource adapter object
name", e);
           }
  
  
  
  1.3       +3 -2      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RARConfiguration.java
  
  Index: RARConfiguration.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/RARConfiguration.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RARConfiguration.java	6 Feb 2004 08:56:42 -0000	1.2
  +++ RARConfiguration.java	10 Feb 2004 08:04:21 -0000	1.3
  @@ -59,6 +59,7 @@
   import javax.enterprise.deploy.model.DeployableObject;
   
   import org.apache.geronimo.deployment.plugin.DeploymentConfigurationSupport;
  +import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapterDConfigRoot;
   
   /**
    *
  @@ -69,6 +70,6 @@
   public class RARConfiguration extends DeploymentConfigurationSupport {
   
       public RARConfiguration(DeployableObject deployable) {
  -        super(deployable, null);
  +        super(deployable, new ResourceAdapterDConfigRoot(deployable.getDDBeanRoot()));
       }
   }
  
  
  
  1.2       +2 -3      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/AdminObjectInstanceDConfigBean.java
  
  Index: AdminObjectInstanceDConfigBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/AdminObjectInstanceDConfigBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AdminObjectInstanceDConfigBean.java	9 Feb 2004 23:13:27 -0000	1.1
  +++ AdminObjectInstanceDConfigBean.java	10 Feb 2004 08:04:21 -0000	1.2
  @@ -78,8 +78,7 @@
   public class AdminObjectInstanceDConfigBean extends DConfigBeanSupport{
       private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
   
  -    private final static String[] ADMIN_OBJECT_INSTANCE_XPATHS = {
  -        "config-property"};
  +    private final static String[] ADMIN_OBJECT_INSTANCE_XPATHS = {"config-property"};
       private Map configPropertiesMap = new HashMap();
   
       public AdminObjectInstanceDConfigBean() {
  
  
  
  1.2       +117 -4    incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java
  
  Index: ResourceAdapterDConfigBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceAdapterDConfigBean.java	9 Feb 2004 23:13:27 -0000	1.1
  +++ ResourceAdapterDConfigBean.java	10 Feb 2004 08:04:21 -0000	1.2
  @@ -66,6 +66,9 @@
   import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
   import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
   import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
  +import org.apache.geronimo.xbeans.geronimo.GerOutboundResourceadapterType;
  +import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
  +import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
   import org.apache.xmlbeans.SchemaTypeLoader;
   import org.apache.xmlbeans.XmlBeans;
   
  @@ -80,9 +83,11 @@
   
       private final static String[] RESOURCE_ADAPTER_XPATHS = {
           "config-property",
  -        "outbound-resource-adapter/connection-definition",
  -        "admin-object"};
  +        "outbound-resourceadapter/connection-definition",
  +        "adminobject"};
       private Map configPropertiesMap = new HashMap();
  +    private Map connectionDefinitionsMap = new HashMap();
  +    private Map adminObjectsMap = new HashMap();
   
       public ResourceAdapterDConfigBean(DDBean ddBean, final GerResourceadapterType resourceadapter)
{
           super(ddBean, resourceadapter, SCHEMA_TYPE_LOADER);
  @@ -96,20 +101,104 @@
               }
   
           }, configPropertiesMap);
  +        //initialize connection definitions
  +        GerOutboundResourceadapterType outboundResourceadapter = resourceadapter.getOutboundResourceadapter();
  +        if (outboundResourceadapter == null) {
  +            outboundResourceadapter = resourceadapter.addNewOutboundResourceadapter();
  +        }
  +        DDBean[] connectionDefinitionDDBeans = ddBean.getChildBean(RESOURCE_ADAPTER_XPATHS[1]);
  +        GerConnectionDefinitionType[] connectionDefinitions = outboundResourceadapter.getConnectionDefinitionArray();
  +
  +        if (connectionDefinitions.length == 0) {
  +            //we are new
  +            for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
  +                DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
  +                GerConnectionDefinitionType connectionDefinition = outboundResourceadapter.addNewConnectionDefinition();
  +                String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
  +                ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean,
connectionDefinition);
  +                connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
  +            }
  +        } else {
  +            //we are read in from xml.  Check correct length
  +            assert connectionDefinitionDDBeans.length == connectionDefinitions.length;
  +            for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
  +                DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
  +                GerConnectionDefinitionType connectionDefinition = connectionDefinitions[i];
  +                String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
  +                assert connectionfactoryInterface.equals(connectionDefinition.getConnectionfactoryInterface().getStringValue());
  +                ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean,
connectionDefinition);
  +                connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
  +            }
  +        }
  +
  +        //admin objects
  +        DDBean[] adminObjecDdBeans = ddBean.getChildBean(RESOURCE_ADAPTER_XPATHS[2]);
  +        GerAdminobjectType[] adminobjectTypes = getResourceadapter().getAdminobjectArray();
  +
  +        if (adminobjectTypes.length == 0) {
  +            //we are new
  +            for (int i = 0; i < adminObjecDdBeans.length; i++) {
  +                DDBean adminObjectDdBean = adminObjecDdBeans[i];
  +                GerAdminobjectType adminobjectType = getResourceadapter().addNewAdminobject();
  +                String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
  +                String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
  +                AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean,
adminobjectType);
  +                adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
  +            }
  +        } else {
  +            //we are read in from xml.  Check correct length
  +            assert adminObjecDdBeans.length == adminobjectTypes.length;
  +            for (int i = 0; i < adminObjecDdBeans.length; i++) {
  +                DDBean adminObjectDdBean = adminObjecDdBeans[i];
  +                              GerAdminobjectType adminobjectType =  adminobjectTypes[i];
  +                String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
  +                assert(adminObjectInterface.equals(adminobjectType.getAdminobjectInterface().getStringValue()));
  +                String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
  +                assert(adminObjectClass.equals(adminobjectType.getAdminobjectClass().getStringValue()));
  +                AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean,
adminobjectType);
  +                adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
  +
  +            }
  +        }
  +
       }
   
       GerResourceadapterType getResourceadapter() {
           return (GerResourceadapterType)getXmlObject();
       }
   
  +    public String getResourceAdapterName() {
  +        return getResourceadapter().getResourceadapterName();
  +    }
  +
  +    public void setResourceAdapterName(String resourceAdapterName) {
  +        getResourceadapter().setResourceadapterName(resourceAdapterName);
  +    }
  +
       public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
           String xpath = bean.getXpath();
  -        if (xpath.endsWith("/config-property")) {
  +        if (xpath.endsWith("/" + RESOURCE_ADAPTER_XPATHS[0])) {
  +            //resource adapter config property
               String configPropertyName = bean.getText("config-property-name")[0];
               ConfigPropertySettingDConfigBean configPropertySetting = (ConfigPropertySettingDConfigBean)
configPropertiesMap.get(configPropertyName);
               assert configPropertySetting != null;
               return configPropertySetting;
           }
  +        if (xpath.endsWith("/" + RESOURCE_ADAPTER_XPATHS[1])) {
  +            //connection definition
  +            String connectionFactoryInterface = bean.getText("connectionfactory-interface")[0];
  +            ConnectionDefinitionDConfigBean connectionDefinition = (ConnectionDefinitionDConfigBean)
connectionDefinitionsMap.get(connectionFactoryInterface);
  +            assert connectionDefinition != null;
  +            return connectionDefinition;
  +        }
  +        if (xpath.endsWith("/" + RESOURCE_ADAPTER_XPATHS[2])) {
  +            //admin objects
  +            String adminObjectInterface = bean.getText("adminobject-interface")[0];
  +            String adminObjectClass = bean.getText("adminobject-class")[0];
  +            AdminObjectDConfigBean adminObject = (AdminObjectDConfigBean) adminObjectsMap.get(new
Key(adminObjectInterface, adminObjectClass));
  +            assert adminObject != null;
  +            return adminObject;
  +        }
           return null;
       }
   
  @@ -118,4 +207,28 @@
           return RESOURCE_ADAPTER_XPATHS;
       }
   
  +
  +    //from doubleKeyedHashMap, currently in transaction module
  +    private final static class Key {
  +        private final Object part1;
  +        private final Object part2;
  +
  +        public Key(Object part1, Object part2) {
  +            this.part1 = part1;
  +            this.part2 = part2;
  +        }
  +
  +        public int hashCode() {
  +            return part1.hashCode() ^ part2.hashCode();
  +        }
  +
  +        public boolean equals(Object obj) {
  +            if (obj instanceof Key) {
  +                Key other = (Key) obj;
  +                return this.part1.equals(other.part1) && this.part2.equals(other.part2);
  +            } else {
  +                return false;
  +            }
  +        }
  +    }
   }
  
  
  
  1.2       +6 -4      incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java
  
  Index: ResourceAdapterDConfigRoot.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ResourceAdapterDConfigRoot.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResourceAdapterDConfigRoot.java	9 Feb 2004 23:13:27 -0000	1.1
  +++ ResourceAdapterDConfigRoot.java	10 Feb 2004 08:04:21 -0000	1.2
  @@ -80,7 +80,7 @@
   public class ResourceAdapterDConfigRoot extends DConfigBeanRootSupport {
       private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
       private static String[] XPATHS = {
  -        "resource-adapter"
  +        "connector/resourceadapter"
       };
   
       private ResourceAdapterDConfigBean resourceAdapterDConfigBean;
  @@ -93,7 +93,8 @@
   
       private void replaceResourceAdapterDConfigBean(GerResourceadapterType resourceAdapter)
{
           DDBean ddBean = getDDBean();
  -        resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(ddBean.getChildBean("resource-adapter")[0],
resourceAdapter);
  +        DDBean childDDBean = ddBean.getChildBean(XPATHS[0])[0];
  +        resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(childDDBean, resourceAdapter);
       }
   
       GerConnectorDocument getConnectorDocument() {
  @@ -104,8 +105,9 @@
           return XPATHS;
       }
   
  +    //TODO should the xpath start with /??
       public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
  -        if ("/connector/resource-adapter".equals(bean.getXpath())) {
  +        if (("/" + XPATHS[0]).equals(bean.getXpath())) {
               return resourceAdapterDConfigBean;
           }
           return null;
  
  
  
  1.4       +1 -0      incubator-geronimo/modules/connector/src/schema/geronimo-connector_1_5.xsd
  
  Index: geronimo-connector_1_5.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/schema/geronimo-connector_1_5.xsd,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- geronimo-connector_1_5.xsd	9 Feb 2004 23:13:27 -0000	1.3
  +++ geronimo-connector_1_5.xsd	10 Feb 2004 08:04:21 -0000	1.4
  @@ -348,6 +348,7 @@
       <xsd:complexType name="resourceadapterType">
   
           <xsd:sequence>
  +            <xsd:element name="resourceadapter-name" type="xsd:string"/>
               <xsd:element name="config-property-setting"
                   type="ger:config-property-settingType"
                   minOccurs="0"
  
  
  
  1.4       +135 -8    incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/Connector_1_5Test.java
  
  Index: Connector_1_5Test.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/Connector_1_5Test.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Connector_1_5Test.java	8 Feb 2004 20:21:57 -0000	1.3
  +++ Connector_1_5Test.java	10 Feb 2004 08:04:21 -0000	1.4
  @@ -61,23 +61,41 @@
   import java.io.IOException;
   import java.io.ByteArrayOutputStream;
   import java.io.ByteArrayInputStream;
  +import java.io.FileNotFoundException;
   import java.net.URL;
   import java.net.URI;
   import java.util.Map;
   import java.util.HashMap;
   import java.util.List;
   import java.util.ArrayList;
  +import java.util.Enumeration;
   import java.util.zip.ZipEntry;
   import java.util.jar.JarOutputStream;
   
   import javax.management.ObjectName;
  +import javax.enterprise.deploy.model.DeployableObject;
  +import javax.enterprise.deploy.model.DDBeanRoot;
  +import javax.enterprise.deploy.model.DDBean;
  +import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
  +import javax.enterprise.deploy.shared.ModuleType;
  +import javax.enterprise.deploy.spi.DeploymentConfiguration;
  +import javax.enterprise.deploy.spi.DConfigBeanRoot;
   
   import junit.framework.TestCase;
   import org.apache.geronimo.xbeans.j2ee.ConnectorDocument;
   import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
  +import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
  +import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
  +import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
  +import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
   import org.apache.geronimo.deployment.DeploymentModule;
   import org.apache.geronimo.deployment.ConfigurationCallback;
  +import org.apache.geronimo.deployment.tools.DDBeanRootImpl;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
  +import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapterDConfigBean;
  +import org.apache.geronimo.connector.deployment.dconfigbean.ConfigPropertySettingDConfigBean;
  +import org.apache.geronimo.connector.deployment.dconfigbean.AdminObjectDConfigBean;
  +import org.apache.geronimo.connector.deployment.dconfigbean.AdminObjectInstanceDConfigBean;
   import org.apache.xmlbeans.XmlOptions;
   
   /**
  @@ -112,7 +130,76 @@
           }
       }
   
  +    public void testDConfigBeans() throws Exception {
  +        RARDeployable deployable = new RARDeployable(j2eeDD);
  +        DDBeanRoot ddroot = deployable.getDDBeanRoot();
  +        DeploymentConfiguration rarConfiguration = new RARConfigurer().createConfiguration(deployable);
  +        DConfigBeanRoot root = rarConfiguration.getDConfigBeanRoot(deployable.getDDBeanRoot());
  +        assertNotNull(root);
  +
  +        //resource adapter
  +        DDBean resourceAdapterdd = ddroot.getChildBean(root.getXpaths()[0])[0];
  +        ResourceAdapterDConfigBean resourceAdapterDConfigBean = (ResourceAdapterDConfigBean)
root.getDConfigBean(resourceAdapterdd);
  +        assertNotNull(resourceAdapterDConfigBean);
  +        resourceAdapterDConfigBean.setResourceAdapterName("TestRAName");
  +        DDBean[] resourceAdapterProperties = resourceAdapterdd.getChildBean(resourceAdapterDConfigBean.getXpaths()[0]);
  +        assertEquals(1, resourceAdapterProperties.length);
  +        ConfigPropertySettingDConfigBean resourceAdapterSetting = (ConfigPropertySettingDConfigBean)resourceAdapterDConfigBean.getDConfigBean(resourceAdapterProperties[0]);
  +        assertNotNull(resourceAdapterSetting);
  +        assertEquals("StringValue", resourceAdapterSetting.getConfigPropertyValue());
  +        resourceAdapterSetting.setConfigPropertyValue("TestRAValue");
  +
  +        //admin objects
  +        DDBean[] adminObjectdds = resourceAdapterdd.getChildBean(resourceAdapterDConfigBean.getXpaths()[2]);
  +        assertEquals(1, adminObjectdds.length);
  +        AdminObjectDConfigBean adminObjectDConfigBean = (AdminObjectDConfigBean)resourceAdapterDConfigBean.getDConfigBean(adminObjectdds[0]);
  +        assertNotNull(adminObjectDConfigBean);
  +        AdminObjectInstanceDConfigBean adminObjectInstanceDConfigBean1 = new AdminObjectInstanceDConfigBean();
  +        adminObjectDConfigBean.setAdminObjectInstance(new AdminObjectInstanceDConfigBean[]
{adminObjectInstanceDConfigBean1});
  +        DDBean[] adminObjectConfigPropDDs = adminObjectdds[0].getChildBean(adminObjectInstanceDConfigBean1.getXpaths()[0]);
  +        assertEquals(1, adminObjectConfigPropDDs.length);
  +        ConfigPropertySettingDConfigBean adminObjectSetting1 = (ConfigPropertySettingDConfigBean)
adminObjectInstanceDConfigBean1.getDConfigBean(adminObjectConfigPropDDs[0]);
  +        adminObjectSetting1.setConfigPropertyValue("TestAOValue1");
  +
  +        //add a second admin object in first position
  +        AdminObjectInstanceDConfigBean adminObjectInstanceDConfigBean2 = new AdminObjectInstanceDConfigBean();
  +        adminObjectDConfigBean.setAdminObjectInstance(new AdminObjectInstanceDConfigBean[]
{adminObjectInstanceDConfigBean2, adminObjectInstanceDConfigBean1});
  +        ConfigPropertySettingDConfigBean adminObjectSetting2 = (ConfigPropertySettingDConfigBean)
adminObjectInstanceDConfigBean2.getDConfigBean(adminObjectConfigPropDDs[0]);
  +        adminObjectSetting2.setConfigPropertyValue("TestAOValue2");
  +
  +        //check the results
  +        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +        rarConfiguration.save(baos);
  +        baos.flush();
  +        InputStream is = new ByteArrayInputStream(baos.toByteArray());
  +        baos.close();
  +        GerConnectorDocument gcDoc = GerConnectorDocument.Factory.parse(is);
  +        GerResourceadapterType ra = gcDoc.getConnector().getResourceadapter();
  +        assertEquals("TestRAName", ra.getResourceadapterName());
  +        GerConfigPropertySettingType rasetting = ra.getConfigPropertySettingArray(0);
  +        assertEquals("TestRAValue", rasetting.getStringValue());
  +
  +        //admin object
  +        GerAdminobjectType adminobjectType1 = ra.getAdminobjectArray(0);
  +        GerAdminobjectInstanceType adminobjectInstanceType2 = adminobjectType1.getAdminobjectInstanceArray(0);
  +        assertEquals("TestAOValue2", adminobjectInstanceType2.getConfigPropertySettingArray(0).getStringValue());
  +        GerAdminobjectInstanceType adminobjectInstanceType1 = adminobjectType1.getAdminobjectInstanceArray(1);
  +        assertEquals("TestAOValue1", adminobjectInstanceType1.getConfigPropertySettingArray(0).getStringValue());
  +    }
  +
       public void testCreateConnector_1_5Module() throws Exception {
  +        InputStream moduleArchive = getRARInputStream();
  +
  +        InputStream geronimoInputStream = geronimoDD.openStream();
  +        GerConnectorDocument connectorDocument = GerConnectorDocument.Factory.parse(geronimoInputStream);
  +        RARConfigurationFactory rarConfigurationFactory = new RARConfigurationFactory(ObjectName.getInstance("geronimo.test:role=ConnectionTracker"));
  +        DeploymentModule connector_1_5Module = rarConfigurationFactory.createModule(moduleArchive,
connectorDocument, configID, true);
  +        connector_1_5Module.init();
  +        connector_1_5Module.generateClassPath(this);
  +        connector_1_5Module.defineGBeans(this, this.getClass().getClassLoader());
  +    }
  +
  +    private InputStream getRARInputStream() throws IOException {
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
           JarOutputStream jarOutputStream = new JarOutputStream(baos);
           ZipEntry entry = new ZipEntry("META-INF/ra.xml");
  @@ -128,13 +215,7 @@
           jarOutputStream.close();
   
           InputStream moduleArchive = new ByteArrayInputStream(baos.toByteArray());
  -        InputStream geronimoInputStream = geronimoDD.openStream();
  -        GerConnectorDocument connectorDocument = GerConnectorDocument.Factory.parse(geronimoInputStream);
  -        RARConfigurationFactory rarConfigurationFactory = new RARConfigurationFactory(ObjectName.getInstance("geronimo.test:role=ConnectionTracker"));
  -        DeploymentModule connector_1_5Module = rarConfigurationFactory.createModule(moduleArchive,
connectorDocument, configID, true);
  -        connector_1_5Module.init();
  -        connector_1_5Module.generateClassPath(this);
  -        connector_1_5Module.defineGBeans(this, this.getClass().getClassLoader());
  +        return moduleArchive;
       }
   
       protected void setUp() throws Exception {
  @@ -155,5 +236,51 @@
   
       public void addGBean(ObjectName name, GBeanMBean gbean) {
           gbeans.put(name, gbean);
  +    }
  +
  +    private class RARDeployable implements DeployableObject {
  +
  +        private DDBeanRoot root;
  +
  +        public RARDeployable(URL dd) throws DDBeanCreateException {
  +            root =  new DDBeanRootImpl(this, dd);
  +        }
  +
  +        public ModuleType getType() {
  +            return ModuleType.RAR;
  +        }
  +
  +        public DDBeanRoot getDDBeanRoot() {
  +            return root;
  +        }
  +
  +        public DDBean[] getChildBean(String xpath) {
  +            return root.getChildBean(xpath);
  +        }
  +
  +        public String[] getText(String xpath) {
  +            return root.getText(xpath);
  +        }
  +
  +        public Class getClassFromScope(String className) {
  +            return null;
  +        }
  +
  +        public String getModuleDTDVersion() {
  +            return null;
  +        }
  +
  +        public DDBeanRoot getDDBeanRoot(String filename) throws FileNotFoundException,
DDBeanCreateException {
  +            return null;
  +        }
  +
  +        public Enumeration entries() {
  +            return null;
  +        }
  +
  +        public InputStream getEntry(String name) {
  +            return null;
  +        }
  +
       }
   }
  
  
  
  1.4       +2 -0      incubator-geronimo/modules/connector/src/test-data/connector_1_0/geronimo-ra.xml
  
  Index: geronimo-ra.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test-data/connector_1_0/geronimo-ra.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- geronimo-ra.xml	9 Feb 2004 23:13:28 -0000	1.3
  +++ geronimo-ra.xml	10 Feb 2004 08:04:21 -0000	1.4
  @@ -1,6 +1,8 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <connector xmlns="http://org.apache.geronimo/xml/ns/j2ee" version="1.0">
       <resourceadapter>
  +        <!-- how can we get rid of this?-->
  +        <resourceadapter-name>testRA</resourceadapter-name>
           <outbound-resourceadapter>
               <connection-definition>
                   <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
  
  
  
  1.4       +2 -1      incubator-geronimo/modules/connector/src/test-data/connector_1_5/geronimo-ra.xml
  
  Index: geronimo-ra.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test-data/connector_1_5/geronimo-ra.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- geronimo-ra.xml	9 Feb 2004 23:13:28 -0000	1.3
  +++ geronimo-ra.xml	10 Feb 2004 08:04:21 -0000	1.4
  @@ -1,6 +1,7 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <connector xmlns="http://org.apache.geronimo/xml/ns/j2ee" version="1.5">
       <resourceadapter>
  +        <resourceadapter-name>testRA</resourceadapter-name>
           <config-property-setting name="RAStringProperty">NewStringValue</config-property-setting>
           <bootstrapcontext-name>geronimo.jca:service=bootstrapcontext</bootstrapcontext-name>
           <outbound-resourceadapter>
  @@ -62,7 +63,7 @@
           </outbound-resourceadapter>
           <adminobject>
               <adminobject-interface>org.apache.geronimo.connector.mock.MockAdminObject</adminobject-interface>
  -            <adminobject-class>org.apache.geronimo.connector.mock.AdminObjectImpl</adminobject-class>
  +            <adminobject-class>org.apache.geronimo.connector.mock.MockAdminObjectImpl</adminobject-class>
               <adminobject-instance>
                   <adminobject-name>tweedledee</adminobject-name>
                   <config-property-setting name="Tweedle">Dee-value</config-property-setting>
  
  
  

Mime
View raw message