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/core/src/test-data/xml/deployment simple-geronimo-ejb-jar.xml
Date Tue, 18 Nov 2003 22:22:29 GMT
djencks     2003/11/18 14:22:29

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb
                        Entity.java Query.java Session.java
               modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/ejb
                        EjbConverter.java
               modules/core/src/java/org/apache/geronimo/xml/deployment
                        GeronimoEjbJarLoader.java GeronimoEjbJarStorer.java
               modules/core/src/schema geronimo-ejb-jar.xsd
               modules/core/src/test/org/apache/geronimo/xml/deployment
                        GeronimoEjbJarLoaderTest.java
               modules/core/src/test-data/xml/deployment
                        simple-geronimo-ejb-jar.xml
  Log:
  Updated xml and pojo models to include multiple output bindings and updates.  Added tests
  
  Revision  Changes    Path
  1.6       +20 -10    incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Entity.java
  
  Index: Entity.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Entity.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Entity.java	17 Nov 2003 03:27:55 -0000	1.5
  +++ Entity.java	18 Nov 2003 22:22:28 -0000	1.6
  @@ -70,7 +70,8 @@
    * @version $Revision$ $Date$
    */
   public class Entity extends org.apache.geronimo.deployment.model.ejb.Entity implements
JNDIEnvironmentRefs {
  -    private String jndiName;
  +
  +    private Query[] update;
   
       public Entity() {
           super.setSecurityRoleRef(new SecurityRoleRef[0]);
  @@ -83,14 +84,6 @@
           super.setQuery(new Query[0]);
       }
   
  -    public String getJndiName() {
  -        return jndiName;
  -    }
  -
  -    public void setJndiName(String jndiName) {
  -        this.jndiName = jndiName;
  -    }
  -
       public void setSecurityRoleRef(org.apache.geronimo.deployment.model.j2ee.SecurityRoleRef[]
ref) {
           assert (ref instanceof SecurityRoleRef[]);
           super.setSecurityRoleRef(ref);
  @@ -288,4 +281,21 @@
       public Query getGeronimoQuery(int i) {
           return (Query)super.getQuery(i);
       }
  +
  +    public Query[] getUpdate() {
  +        return update;
  +    }
  +
  +    public void setUpdate(Query[] update) {
  +        this.update = update;
  +    }
  +
  +    public void setUpdate(int i, Query updat) {
  +        update[i] = updat;
  +    }
  +
  +    public Query getUpdate(int i) {
  +        return update[i];
  +    }
  +
   }
  
  
  
  1.3       +9 -9      incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Query.java
  
  Index: Query.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Query.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Query.java	17 Nov 2003 17:29:09 -0000	1.2
  +++ Query.java	18 Nov 2003 22:22:28 -0000	1.3
  @@ -65,10 +65,10 @@
   public class Query extends org.apache.geronimo.deployment.model.ejb.Query {
   
       private String sql;
  -    private Binding[] inputBinding;
  -    private Binding outputBinding;
  +    private Binding[] inputBinding = new Binding[0];
  +    private Binding[] outputBinding = new Binding[0];
       private String abstractSchemaName;
  -    private boolean multivalue;
  +    private String multivalue;
   
       public String getSql() {
           return sql;
  @@ -86,11 +86,11 @@
           this.inputBinding = inputBinding;
       }
   
  -    public Binding getOutputBinding() {
  +    public Binding[] getOutputBinding() {
           return outputBinding;
       }
   
  -    public void setOutputBinding(Binding outputBinding) {
  +    public void setOutputBinding(Binding outputBinding[]) {
           this.outputBinding = outputBinding;
       }
   
  @@ -102,11 +102,11 @@
           this.abstractSchemaName = abstractSchemaName;
       }
   
  -    public boolean isMultivalue() {
  +    public String getMultiplicity() {
           return multivalue;
       }
   
  -    public void setMultivalue(boolean multivalue) {
  -        this.multivalue = multivalue;
  +    public void setMultiplicity(String multiplicity) {
  +        this.multivalue = multiplicity;
       }
   }
  
  
  
  1.5       +1 -10     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Session.java
  
  Index: Session.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Session.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Session.java	29 Sep 2003 14:17:22 -0000	1.4
  +++ Session.java	18 Nov 2003 22:22:28 -0000	1.5
  @@ -70,7 +70,6 @@
    * @version $Revision$ $Date$
    */
   public class Session extends org.apache.geronimo.deployment.model.ejb.Session implements
JNDIEnvironmentRefs {
  -    private String jndiName;
   
       public Session() {
           super.setSecurityRoleRef(new SecurityRoleRef[0]);
  @@ -80,14 +79,6 @@
           super.setResourceEnvRef(new ResourceEnvRef[0]);
           super.setMessageDestinationRef(new MessageDestinationRef[0]);
           super.setServiceRef(new ServiceRef[0]);
  -    }
  -
  -    public String getJndiName() {
  -        return jndiName;
  -    }
  -
  -    public void setJndiName(String jndiName) {
  -        this.jndiName = jndiName;
       }
   
       public void setSecurityRoleRef(org.apache.geronimo.deployment.model.j2ee.SecurityRoleRef[]
ref) {
  
  
  
  1.4       +1 -5      incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/ejb/EjbConverter.java
  
  Index: EjbConverter.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/ejb/EjbConverter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EjbConverter.java	17 Nov 2003 20:28:10 -0000	1.3
  +++ EjbConverter.java	18 Nov 2003 22:22:28 -0000	1.4
  @@ -246,7 +246,6 @@
                   queries[i] = query;
               }
               e.setQuery(queries);
  -            e.setJndiName(bean.getJndiName());
               storeSecurityRoleRefs(e, bean.getSecurityRoleRef().iterator());
               list.add(e);
           }
  @@ -267,7 +266,6 @@
               s.setServiceEndpoint(getText(ddb.getText("service-endpoint")));
               s.setSessionType(getText(ddb.getText("session-type")));
               s.setTransactionType(getText(ddb.getText("transaction-type")));
  -            s.setJndiName(bean.getJndiName());
               storeSecurityRoleRefs(s, bean.getSecurityRoleRef().iterator());
               list.add(s);
           }
  @@ -337,7 +335,6 @@
               SessionBean bean = (SessionBean)root.getDConfigBean(match);
               assignEjb(bean, sessions[i], match);
               //session-specific content
  -            bean.setJndiName(sessions[i].getJndiName());
               assignSecurityRoleRefs(bean, sessions[i].getGeronimoSecurityRoleRef(), match.getChildBean(EntityBean.SECURITY_ROLE_REF_XPATH));
           }
           for(int i = 0; i < childBean.length; i++) {
  @@ -369,7 +366,6 @@
               EntityBean bean = (EntityBean)root.getDConfigBean(match);
               assignEjb(bean, entities[i], match);
               //entity-specific content
  -            bean.setJndiName(entities[i].getJndiName());
               assignSecurityRoleRefs(bean, entities[i].getGeronimoSecurityRoleRef(), match.getChildBean(EntityBean.SECURITY_ROLE_REF_XPATH));
           }
           for(int i = 0; i < childBean.length; i++) {
  
  
  
  1.11      +28 -27    incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java
  
  Index: GeronimoEjbJarLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- GeronimoEjbJarLoader.java	18 Nov 2003 04:16:22 -0000	1.10
  +++ GeronimoEjbJarLoader.java	18 Nov 2003 22:22:28 -0000	1.11
  @@ -87,11 +87,11 @@
           J2EELoader.loadDisplayable(root, jar);
           jar.setModuleName(LoaderUtil.getChildContent(root, "module-name"));
           String datasourceName = LoaderUtil.getChildContent(root, "datasource-name");
  -        if (datasourceName != null && datasourceName.length() >0) {
  +        if (datasourceName != null && datasourceName.length() > 0) {
               jar.setDatasourceName(datasourceName);
           }
           Element ebe = LoaderUtil.getChild(root, "enterprise-beans");
  -        if(ebe != null) {
  +        if (ebe != null) {
               EnterpriseBeans eb = new EnterpriseBeans();
               jar.setEnterpriseBeans(eb);
               eb.setSession(loadSessions(ebe));
  @@ -100,7 +100,7 @@
           }
           //todo: override any Geronimo-specific relationship content
           Element re = LoaderUtil.getChild(root, "relationships");
  -        if(re != null) {
  +        if (re != null) {
               Relationships rel = new Relationships();
               J2EELoader.loadDescribable(re, rel);
               rel.setEjbRelation(EjbJarLoader.loadEjbRelations(re));
  @@ -108,7 +108,7 @@
           }
           //todo: override any Geronimo-specific assembly-descriptor content
           Element ade = LoaderUtil.getChild(root, "assembly-descriptor");
  -        if(ade != null) {
  +        if (ade != null) {
               AssemblyDescriptor ad = new AssemblyDescriptor();
               EjbJarLoader.loadAssemblyDescriptor(ade, ad);
               jar.setAssemblyDescriptor(ad);
  @@ -121,7 +121,7 @@
       private static MessageDriven[] loadMessageDrivens(Element parent) {
           Element[] roots = LoaderUtil.getChildren(parent, "message-driven");
           MessageDriven[] mdbs = new MessageDriven[roots.length];
  -        for(int i = 0; i < roots.length; i++) {
  +        for (int i = 0; i < roots.length; i++) {
               Element root = roots[i];
               mdbs[i] = new MessageDriven();
               loadEjb(root, mdbs[i]);
  @@ -137,7 +137,7 @@
       private static Session[] loadSessions(Element ebe) {
           Element[] roots = LoaderUtil.getChildren(ebe, "session");
           Session[] sessions = new Session[roots.length];
  -        for(int i = 0; i < roots.length; i++) {
  +        for (int i = 0; i < roots.length; i++) {
               Element root = roots[i];
               sessions[i] = new Session();
               loadEjb(root, sessions[i]);
  @@ -149,7 +149,6 @@
               sessions[i].setServiceEndpoint(LoaderUtil.getChildContent(root, "service-endpoint"));
               sessions[i].setSessionType(LoaderUtil.getChildContent(root, "session-type"));
               sessions[i].setTransactionType(LoaderUtil.getChildContent(root, "transaction-type"));
  -            sessions[i].setJndiName(LoaderUtil.getChildContent(root, "jndi-name"));
           }
           return sessions;
       }
  @@ -157,7 +156,7 @@
       private static Entity[] loadEntities(Element ebe) {
           Element[] roots = LoaderUtil.getChildren(ebe, "entity");
           Entity[] entities = new Entity[roots.length];
  -        for(int i = 0; i < roots.length; i++) {
  +        for (int i = 0; i < roots.length; i++) {
               Element root = roots[i];
               entities[i] = new Entity();
               loadEjb(root, entities[i]);
  @@ -173,43 +172,45 @@
               entities[i].setAbstractSchemaName(LoaderUtil.getChildContent(root, "abstract-schema-name"));
               entities[i].setPrimkeyField(LoaderUtil.getChildContent(root, "primkey-field"));
               entities[i].setCmpField(EjbJarLoader.loadCmpFields(root));
  -            entities[i].setQuery(GeronimoEjbJarLoader.loadQueries(root));
  -            entities[i].setJndiName(LoaderUtil.getChildContent(root, "jndi-name"));
  +            Element[] query;
  +            query = LoaderUtil.getChildren(root, "query");
  +            entities[i].setQuery(GeronimoEjbJarLoader.loadQueries(query));
  +            Element[] update = LoaderUtil.getChildren(root, "update");
  +            entities[i].setUpdate(GeronimoEjbJarLoader.loadQueries(update));
           }
           return entities;
       }
   
  -    static Query[] loadQueries(Element parent) {
  -        Element[] roots = LoaderUtil.getChildren(parent, "query");
  +    static Query[] loadQueries(Element[] roots) {
           Query[] queries = new Query[roots.length];
  -        for(int i = 0; i < roots.length; i++) {
  +        for (int i = 0; i < roots.length; i++) {
               Element root = roots[i];
               Query query = (Query) EjbJarLoader.loadQuery(root, new Query());
               query.setSql(LoaderUtil.getChildContent(root, "sql"));
  -            query.setInputBinding(loadInputBinding(LoaderUtil.getChild(root, "input-binding")));
  +            query.setInputBinding(loadBinding(LoaderUtil.getChild(root, "input-binding")));
               Element outputBinding = LoaderUtil.getChild(root, "output-binding");
  -            query.setAbstractSchemaName(LoaderUtil.getChildContent(outputBinding, "abstract-schema-name"));
  -            query.setOutputBinding(loadBinding(LoaderUtil.getChild(outputBinding, "binding")));
  -            query.setMultivalue(Boolean.getBoolean(LoaderUtil.getChildContent(outputBinding,
"multivalue")));
  +            query.setAbstractSchemaName(LoaderUtil.getAttribute(outputBinding, "abstract-schema-name"));
  +            query.setOutputBinding(loadBinding(outputBinding));
  +            query.setMultiplicity(LoaderUtil.getAttribute(outputBinding, "multiplicity"));
               queries[i] = query;
           }
           return queries;
       }
   
  -    private static Binding[] loadInputBinding(Element parent) {
  +    private static Binding[] loadBinding(Element parent) {
  +        if (parent == null) {
  +            return new Binding[0];
  +        }
           Element[] roots = LoaderUtil.getChildren(parent, "binding");
           Binding[] bindings = new Binding[roots.length];
           for (int i = 0; i < bindings.length; i++) {
  -            bindings[i] = loadBinding(roots[i]);
  +            Element root = roots[i];
  +            Binding binding = new Binding();
  +            binding.setType(LoaderUtil.getAttribute(root, "type"));
  +            binding.setParam(Integer.parseInt(LoaderUtil.getAttribute(root, "param")));
  +            bindings[i] = binding;
           }
           return bindings;
  -    }
  -
  -    private static Binding loadBinding(Element root) {
  -        Binding binding = new Binding();
  -        binding.setType(LoaderUtil.getAttribute(root, "type"));
  -        binding.setParam(Integer.parseInt(LoaderUtil.getAttribute(root, "param")));
  -        return binding;
       }
   
   
  
  
  
  1.4       +26 -4     incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorer.java
  
  Index: GeronimoEjbJarStorer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarStorer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GeronimoEjbJarStorer.java	18 Nov 2003 05:41:09 -0000	1.3
  +++ GeronimoEjbJarStorer.java	18 Nov 2003 22:22:28 -0000	1.4
  @@ -67,6 +67,8 @@
   import org.apache.geronimo.deployment.model.geronimo.ejb.EnterpriseBeans;
   import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
   import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
   
   /**
    * Knows how to store geronimo-ejb-jar.xml POJOs to a DOM
  @@ -141,7 +143,6 @@
           if(bean.getSecurityIdentity() != null) {
               EjbJarStorer.storeSecurityIdentity(StorerUtil.createChild(root, "security-identity"),
bean.getSecurityIdentity());
           }
  -        StorerUtil.createOptionalChildText(root, "jndi-name", bean.getJndiName());
       }
   
       static void storeEntityBean(Element root, Entity bean) {
  @@ -167,9 +168,30 @@
               EjbJarStorer.storeSecurityIdentity(StorerUtil.createChild(root, "security-identity"),
bean.getSecurityIdentity());
           }
           for(int i = 0; i < bean.getQuery().length; i++) {
  -            EjbJarStorer.storeQuery(StorerUtil.createChild(root, "query"), bean.getQuery(i));
  +            storeQuery(StorerUtil.createChild(root, "query"), bean.getGeronimoQuery(i));
  +        }
  +        for(int i = 0; i < bean.getUpdate().length; i++) {
  +            storeQuery(StorerUtil.createChild(root, "update"), bean.getUpdate(i));
  +        }
  +    }
  +
  +    private static void storeQuery(Element child, Query query) {
  +        EjbJarStorer.storeQuery(child, query);
  +        Element inputBindings = StorerUtil.createChild(child, "input-binding");
  +        storeBindings(inputBindings, query.getInputBinding());
  +        Element outputBindings = StorerUtil.createChild(child, "output-binding");
  +        outputBindings.setAttribute("abstract-schema-name", query.getAbstractSchemaName());
  +        outputBindings.setAttribute("multiplicity", query.getMultiplicity());
  +        storeBindings(outputBindings, query.getOutputBinding());
  +    }
  +
  +    private static void storeBindings(Element outputBindings, Binding[] bindings) {
  +        for (int i = 0; i < bindings.length; i++) {
  +            Binding binding = bindings[i];
  +            Element child = StorerUtil.createChild(outputBindings, "binding");
  +            child.setAttribute("type", binding.getType());
  +            child.setAttribute("param", "" + binding.getParam());
           }
  -        StorerUtil.createOptionalChildText(root, "jndi-name", bean.getJndiName());
       }
   
       static void storeMessageDrivenBean(Element root, MessageDriven bean) {
  
  
  
  1.10      +4 -23     incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd
  
  Index: geronimo-ejb-jar.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- geronimo-ejb-jar.xsd	18 Nov 2003 04:16:55 -0000	1.9
  +++ geronimo-ejb-jar.xsd	18 Nov 2003 22:22:28 -0000	1.10
  @@ -235,17 +235,7 @@
               <xsd:element name="security-role-ref" type="j2ee:security-role-refType"
minOccurs="0" maxOccurs="unbounded"/>
               <xsd:element name="security-identity" type="j2ee:security-identityType"
minOccurs="0"/>
               <xsd:element name="query" type="j2ee:queryType" minOccurs="0" maxOccurs="unbounded"/>
  -            <xsd:element name="jndi-name" type="xsd:string" minOccurs="0">
  -                <xsd:annotation>
  -                    <xsd:documentation>
  -                        Actually, ejbs are located by the module name and ejb name.
  -
  -                        The JNDI name controls where this EJB will appear in the application-wide
JNDI
  -                        space.  Other application components that want to refer to this
EJB can define
  -                        EJB references and map them to this JNDI location.
  -                    </xsd:documentation>
  -                </xsd:annotation>
  -            </xsd:element>
  +            <xsd:element name="update" type="j2ee:queryType" minOccurs="0" maxOccurs="unbounded"/>
           </xsd:sequence>
           <xsd:attribute name="id" type="xsd:ID"/>
       </xsd:complexType>
  @@ -363,10 +353,10 @@
       </xsd:complexType>
       <xsd:complexType name="output-bindingType">
           <xsd:sequence>
  -            <xsd:element name="abstract-schema-name" type="j2ee:java-identifierType"/>
  -            <xsd:element name="binding" type="ger:bindingType"/>
  -            <xsd:element name="multivalue" type="xds:boolean"/>
  +            <xsd:element name="binding" type="ger:bindingType" minOccurs="0" maxOccurs="unbounded"/>
           </xsd:sequence>
  +        <xsd:attribute name="abstract-schema-name" type="j2ee:java-identifierType"/>
  +        <xsd:attribute name="multiplicity" type="multiplicityType"/>
       </xsd:complexType>
       <xsd:complexType name="bindingType">
           <xsd:attribute name="type" type="j2ee:java-typeType"/>
  @@ -424,15 +414,6 @@
               <xsd:group ref="j2ee:jndiEnvironmentRefsGroup"/>
               <xsd:element name="security-role-ref" type="j2ee:security-role-refType"
minOccurs="0" maxOccurs="unbounded"/>
               <xsd:element name="security-identity" type="j2ee:security-identityType"
minOccurs="0"/>
  -            <xsd:element name="jndi-name" type="xsd:string" minOccurs="0">
  -                <xsd:annotation>
  -                    <xsd:documentation>
  -                        The JNDI name controls where this EJB will appear in the application-wide
JNDI
  -                        space.  Other application components that want to refer to this
EJB can define
  -                        EJB references and map them to this JNDI location.
  -                    </xsd:documentation>
  -                </xsd:annotation>
  -            </xsd:element>
           </xsd:sequence>
           <xsd:attribute name="id" type="xsd:ID"/>
       </xsd:complexType>
  
  
  
  1.5       +40 -3     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java
  
  Index: GeronimoEjbJarLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- GeronimoEjbJarLoaderTest.java	17 Nov 2003 02:03:16 -0000	1.4
  +++ GeronimoEjbJarLoaderTest.java	18 Nov 2003 22:22:29 -0000	1.5
  @@ -64,10 +64,14 @@
   import org.apache.geronimo.deployment.model.geronimo.ejb.EjbJar;
   import org.apache.geronimo.deployment.model.geronimo.ejb.EnterpriseBeans;
   import org.apache.geronimo.deployment.model.geronimo.ejb.Session;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Entity;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Query;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ClassSpace;
   import org.apache.geronimo.deployment.model.j2ee.EnvEntry;
  +import org.apache.geronimo.deployment.model.ejb.QueryMethod;
   
   /**
    * Tests basic Geronimo EJB JAR DD loading (not very comprehensive)
  @@ -98,13 +102,18 @@
           assertEquals(2, session.length);
           assertEquals("Stateless", session[0].getSessionType());
           assertEquals("Stateful", session[1].getSessionType());
  +        Entity[] entity = beans.getGeronimoEntity();
  +        assertEquals(1, entity.length);
  +        assertEquals("Container", entity[0].getPersistenceType());
  +        assertEquals("java.lang.Integer", entity[0].getPrimKeyClass());
  +
           checkStateless(session[0]);
           checkStateful(session[1]);
  +        checkCMPEntity(entity[0]);
       }
   
       static void checkStateless(Session session) {
           assertEquals("StatelessTest", session.getEJBName());
  -        assertEquals("StatelessTestJNDI", session.getJndiName());
   
           EnvEntry[] envs = session.getEnvEntry();
           assertEquals(1, envs.length);
  @@ -121,7 +130,6 @@
   
       static void checkStateful(Session session) {
           assertEquals("StatefulTest", session.getEJBName());
  -        assertEquals("StatefulTestJNDI", session.getJndiName());
   
           EjbRef[] ejbRefs = session.getGeronimoEJBRef();
           assertEquals(1, ejbRefs.length);
  @@ -134,6 +142,35 @@
           ResourceEnvRef resEnvRef = resEnvRefs[0];
           assertEquals("jdbc/StatefulDatabase", resEnvRef.getResourceEnvRefName());
           assertTrue("resEnvRef does not have an empty JNDI name!", resEnvRef.getJndiName()
== null || resEnvRef.getJndiName().equals(""));
  +    }
  +
  +    static void checkCMPEntity(Entity cmpEntity) {
  +        assertEquals("CMPTest", cmpEntity.getEJBName());
  +        //No references...
  +        //test queries
  +        Query[] query = cmpEntity.getGeronimoQuery();
  +        checkQuery(query);
  +        Query[] update = cmpEntity.getUpdate();
  +        checkQuery(update);
  +    }
  +
  +    private static void checkQuery(Query[] query) {
  +        assertEquals(1, query.length);
  +        QueryMethod queryMethod = query[0].getQueryMethod();
  +        assertTrue(null != queryMethod);
  +        assertEquals("doSomething", queryMethod.getMethodName());
  +        assertEquals(2, queryMethod.getMethodParam().length);
  +        assertEquals("java.lang.String", queryMethod.getMethodParam()[0]);
  +        assertEquals("OtherThingy", query[0].getAbstractSchemaName());
  +        assertEquals("Many", query[0].getMultiplicity());
  +        Binding[] inputBinding = query[0].getInputBinding();
  +        assertEquals(2, inputBinding.length);
  +        assertEquals("org.openejb.nova.persistence.binding.jdbc.StringBinding", inputBinding[0].getType());
  +        assertEquals(0, inputBinding[0].getParam());
  +        Binding[] outputBinding = query[0].getOutputBinding();
  +        assertEquals(1, outputBinding.length);
  +        assertEquals("org.openejb.nova.persistence.binding.jdbc.StringBinding", outputBinding[0].getType());
  +        assertEquals(0, outputBinding[0].getParam());
       }
   
       protected void setUp() throws Exception {
  
  
  
  1.4       +63 -5     incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml
  
  Index: simple-geronimo-ejb-jar.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- simple-geronimo-ejb-jar.xml	18 Nov 2003 04:44:16 -0000	1.3
  +++ simple-geronimo-ejb-jar.xml	18 Nov 2003 22:22:29 -0000	1.4
  @@ -1,10 +1,10 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
  -         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  -         xmlns:ger="http://geronimo.apache.org/xml/schema/j2ee"
  -         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  -         http://geronimo.apache.org/xml/schema/1.0/j2ee14/geronimo-ejb-jar.xsd"
  -         version="2.1">
  +    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  +    xmlns:ger="http://geronimo.apache.org/xml/schema/j2ee"
  +    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
  +    http://geronimo.apache.org/xml/schema/1.0/j2ee14/geronimo-ejb-jar.xsd"
  +    version="2.1">
       <class-space name="geronimo.system:role=ClassSpace,name=Test" parent="geronimo.system:role=ClassSpace,name=System"/>
       <security/>
       <description>This is a test EJB JAR DD for JSR-88 purposes</description>
  @@ -56,5 +56,63 @@
               </resource-env-ref>
               <jndi-name>StatefulTestJNDI</jndi-name>
           </session>
  +        <entity>
  +            <description>Sample CMP entity</description>
  +            <display-name>CMP Entity Bean</display-name>
  +            <ejb-name>CMPTest</ejb-name>
  +            <home>org.apache.geronimo.enterprise.deploy.test.CMPEntityHome</home>
  +            <remote>org.apache.geronimo.enterprise.deploy.test.CMPEntity</remote>
  +            <local-home>org.apache.geronimo.enterprise.deploy.test.LocalCMPEntityHome</local-home>
  +            <local>org.apache.geronimo.enterprise.deploy.test.LocalCMPEntity</local>
  +            <ejb-class>org.apache.geronimo.enterprise.deploy.test.CMPEntityEJB</ejb-class>
  +            <persistence-type>Container</persistence-type>
  +            <prim-key-class>java.lang.Integer</prim-key-class>
  +            <reentrant>false</reentrant>
  +            <!--environment refs group-->
  +            <!--security-role-refs-->
  +            <!--security-identity-->
  +            <query>
  +                <description>query example</description>
  +                <query-method>
  +                    <method-name>doSomething</method-name>
  +                    <method-params>
  +                        <method-param>java.lang.String</method-param>
  +                        <method-param>java.lang.String</method-param>
  +                    </method-params>
  +                </query-method>
  +                <result-type-mapping>Local</result-type-mapping>
  +                <ejb-ql>look for something</ejb-ql>
  +                <sql>select something from somewhere</sql>
  +                <input-binding>
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                </input-binding>
  +                <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                </output-binding>
  +
  +            </query>
  +            <update>
  +                <description>query example</description>
  +                <query-method>
  +                    <method-name>doSomething</method-name>
  +                    <method-params>
  +                        <method-param>java.lang.String</method-param>
  +                        <method-param>java.lang.String</method-param>
  +                    </method-params>
  +                </query-method>
  +                <result-type-mapping>Local</result-type-mapping>
  +                <ejb-ql>look for something</ejb-ql>
  +                <sql>select something from somewhere</sql>
  +                <input-binding>
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                </input-binding>
  +                <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                    <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                </output-binding>
  +
  +            </update>
  +        </entity>
       </enterprise-beans>
   </ejb-jar>
  
  
  

Mime
View raw message