[jboss-cvs] JBossAS SVN: r66431 - in projects/metadata/trunk/src: main/resources/schema and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 25 10:09:45 EDT 2007


Author: wolfc
Date: 2007-10-25 10:09:45 -0400 (Thu, 25 Oct 2007)
New Revision: 66431

Added:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/CurrentMessageMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossConsumerBeanMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/LocalProducerMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/MessagePropertiesMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/ProducerMetaData.java
   projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/JBoss50_testConsumer.xml
Modified:
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java
   projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossServiceBeanMetaData.java
   projects/metadata/trunk/src/main/resources/schema/jboss_5_0.xsd
   projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/JBoss50UnitTestCase.java
Log:
EJBTHREE-1067: added consumer bean

Copied: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/CurrentMessageMetaData.java (from rev 66417, projects/metadata/trunk/src/main/java/org/jboss/ejb3/metamodel/CurrentMessage.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/CurrentMessageMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/CurrentMessageMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.ejb.jboss;
+
+import org.jboss.metadata.ejb.spec.MethodsMetaData;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class CurrentMessageMetaData extends MethodsMetaData
+{
+   private static final long serialVersionUID = 1L;
+}

Copied: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossConsumerBeanMetaData.java (from rev 66417, projects/metadata/trunk/src/main/java/org/jboss/ejb3/metamodel/Consumer.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossConsumerBeanMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossConsumerBeanMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.ejb.jboss;
+
+import org.jboss.logging.Logger;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * An EJB 3 consumer bean.
+ * 
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version <tt>$Revision$</tt>
+ */
+ at XmlType(name="consumer-beanType")
+public class JBossConsumerBeanMetaData extends JBossEnterpriseBeanMetaData
+{
+   private static final long serialVersionUID = 1L;
+
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(JBossConsumerBeanMetaData.class);
+   
+   private String destination = null;
+   private String destinationType = null;
+   private MethodAttributesMetaData currentMessage = null;
+   private List<MessagePropertiesMetaData> messageProperties = null;
+   private List<ProducerMetaData> producers = null;
+   private List<LocalProducerMetaData> localProducers = null;
+   
+   public String getMessageDestination()
+   {
+      return destination;
+   }
+   
+   public void setMessageDestination(String destination)
+   {
+      this.destination = destination;
+   }
+   
+   public String getMessageDestinationType()
+   {
+      return destinationType;
+   }
+   
+   public void setMessageDestinationType(String destinationType)
+   {
+      this.destinationType = destinationType;
+   }
+   
+   public MethodAttributesMetaData getCurrentMessage()
+   {
+      return currentMessage;
+   }
+   
+   public void setCurrentMessage(MethodAttributesMetaData currentMessage)
+   {
+      this.currentMessage = currentMessage;
+   }
+   
+   public List<MessagePropertiesMetaData> getMessageProperties()
+   {
+      return messageProperties;
+   }
+   
+   public void setMessageProperties(List<MessagePropertiesMetaData> messageProperties)
+   {
+      this.messageProperties = messageProperties;
+   }
+   
+   public List<ProducerMetaData> getProducers()
+   {
+      return producers;
+   }
+   
+   @XmlElement(name="producer", required=false)
+   public void setProducers(List<ProducerMetaData> producers)
+   {
+      this.producers = producers;
+   }
+   
+   public List<LocalProducerMetaData> getLocalProducers()
+   {
+      return localProducers;
+   }
+   
+   @XmlElement(name="local-producer", required=false)
+   public void setLocalProducers(List<LocalProducerMetaData> producers)
+   {
+      this.localProducers = producers;
+   }
+   
+   @Override
+   public boolean isConsumer()
+   {
+      return true;
+   }
+   
+   public String toString()
+   {
+      StringBuffer sb = new StringBuffer(100);
+      sb.append("[Consumer:");
+      sb.append(super.toString());
+      sb.append(", destination=" + destination);
+      sb.append(", destinationType=" + destinationType);
+      sb.append(']');
+      return sb.toString();
+   }
+
+   @Override
+   public String getDefaultConfigurationName()
+   {
+      throw new RuntimeException("NYI");
+   }
+
+   @Override
+   protected String getDefaultInvokerName()
+   {
+      throw new RuntimeException("NYI");
+   }
+}

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java	2007-10-25 13:57:42 UTC (rev 66430)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossEnterpriseBeanMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -91,6 +91,7 @@
             @JBossXmlModelGroup.Particle(element=@XmlElement(name="session"), type=JBossSessionBeanMetaData.class),
             @JBossXmlModelGroup.Particle(element=@XmlElement(name="entity"), type=JBossEntityBeanMetaData.class),
             @JBossXmlModelGroup.Particle(element=@XmlElement(name="message-driven"), type=JBossMessageDrivenBeanMetaData.class),
+            @JBossXmlModelGroup.Particle(element=@XmlElement(name="consumer"), type=JBossConsumerBeanMetaData.class),
             @JBossXmlModelGroup.Particle(element=@XmlElement(name="ejb"), type=JBossGenericBeanMetaData.class),
             @JBossXmlModelGroup.Particle(element=@XmlElement(name="service"), type=JBossServiceBeanMetaData.class)})
 public abstract class JBossEnterpriseBeanMetaData extends NamedMetaDataWithDescriptionGroup
@@ -420,6 +421,26 @@
    }
 
    /**
+    * Whether this is a consumer bean
+    * 
+    * @return true when a consumer bean
+    */
+   public boolean isConsumer()
+   {
+      return false;
+   }
+   
+   /**
+    * Whether this is a service bean
+    * 
+    * @return true when a service bean
+    */
+   public boolean isService()
+   {
+      return false;
+   }
+
+   /**
     * Whether this is a session bean
     * 
     * @return true when a session bean

Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossServiceBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossServiceBeanMetaData.java	2007-10-25 13:57:42 UTC (rev 66430)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossServiceBeanMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -66,6 +66,22 @@
       return xmBean;
    }
    
+   @Override
+   public boolean isService()
+   {
+      return true;
+   }
+   
+   /**
+    * Although a service bean shares the same metadata
+    * as a session bean, it's not trully a session bean.
+    */
+   @Override
+   public boolean isSession()
+   {
+      return false;
+   }
+   
    public void setLocalJndiName(String localJndiName)
    {
       this.localJndiName = localJndiName;

Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/LocalProducerMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/LocalProducerMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/LocalProducerMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.ejb.jboss;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class LocalProducerMetaData extends ProducerMetaData
+{
+   public LocalProducerMetaData()
+   {
+      super(true);
+   }
+}


Property changes on: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/LocalProducerMetaData.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Copied: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/MessagePropertiesMetaData.java (from rev 66417, projects/metadata/trunk/src/main/java/org/jboss/ejb3/metamodel/MessageProperties.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/MessagePropertiesMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/MessagePropertiesMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.ejb.jboss;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version <tt>$Revision$</tt>
+ */
+ at XmlType(name="message-propertiesType")
+public class MessagePropertiesMetaData
+{
+   private MethodAttributeMetaData method;
+   private String delivery;
+   private Integer priority;
+   private String className;
+
+   public MethodAttributeMetaData getMethod()
+   {
+      return method;
+   }
+   
+   public void setMethod(MethodAttributeMetaData method)
+   {
+      this.method = method;
+   }
+   
+   public String getDelivery()
+   {
+      return delivery;
+   }
+   
+   public void setDelivery(String delivery)
+   {
+      this.delivery = delivery;
+   }
+   
+   @XmlElement(name="class")
+   public String getClassName()
+   {
+      return className;
+   }
+   
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   public Integer getPriority()
+   {
+      return priority;
+   }
+   
+   public void setPriority(Integer priority)
+   {
+      this.priority = priority;
+   }
+
+   public String toString()
+   {
+      StringBuffer sb = new StringBuffer(100);
+      sb.append("[");
+      sb.append("className=").append(className);
+      sb.append(", priority=").append(priority);
+      sb.append(", delivery=").append(delivery);
+      sb.append(", method=").append(method);
+      sb.append("]");
+      return sb.toString();
+   }
+
+}

Copied: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/ProducerMetaData.java (from rev 66417, projects/metadata/trunk/src/main/java/org/jboss/ejb3/metamodel/Producer.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/ProducerMetaData.java	                        (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/ProducerMetaData.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.metadata.ejb.jboss;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Represents a producer element of the jboss.xml deployment descriptor for
+ * the 1.4 schema
+ *
+ * @author <a href="mailto:bdecoste at jboss.com">William DeCoste</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version <tt>$Revision$</tt>
+ */
+public class ProducerMetaData
+{
+   @SuppressWarnings("unused")
+   private static final Logger log = Logger.getLogger(ProducerMetaData.class);
+
+   // jboss.xml
+   private String className;
+   private String connectionFactory;
+   private boolean local = false;
+   
+   public ProducerMetaData()
+   {
+   }
+   
+   public ProducerMetaData(boolean local)
+   {
+      this.local = local;
+   }
+   
+   public boolean isLocal()
+   {
+      return local;
+   }
+
+   public String getClassName()
+   {
+      return className;
+   }
+
+   @XmlElement(name="class")
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+   
+   public String getConnectionFactory()
+   {
+      return connectionFactory;
+   }
+
+   public void setConnectionFactory(String connectionFactory)
+   {
+      this.connectionFactory = connectionFactory;
+   }
+
+   public String toString()
+   {
+      StringBuffer sb = new StringBuffer(100);
+      sb.append('[');
+      sb.append("className=").append(className);
+      sb.append(", connectionFactory=").append(connectionFactory);
+      sb.append(']');
+      return sb.toString();
+   }
+}

Modified: projects/metadata/trunk/src/main/resources/schema/jboss_5_0.xsd
===================================================================
--- projects/metadata/trunk/src/main/resources/schema/jboss_5_0.xsd	2007-10-25 13:57:42 UTC (rev 66430)
+++ projects/metadata/trunk/src/main/resources/schema/jboss_5_0.xsd	2007-10-25 14:09:45 UTC (rev 66431)
@@ -668,7 +668,7 @@
 
       <xsd:sequence>
          <xsd:element name="method-name" type="javaee:method-nameType"/>
-         <xsd:element name="transaction-timeout" type="jboss:transaction-timeoutType"/>
+         <xsd:element name="transaction-timeout" type="jboss:transaction-timeoutType" minOccurs="0"/>
 
       </xsd:sequence>
       <xsd:attribute name="id" type="xsd:ID"/>
@@ -866,7 +866,7 @@
       </xsd:annotation>
 
       <xsd:sequence>
-         <xsd:element name="class" type="javaee:xsdStringType"/>
+         <xsd:element name="class" type="javaee:fully-qualified-classType"/>
          <xsd:element name="connection-factory" type="javaee:xsdStringType" minOccurs="0"/>
       </xsd:sequence>
       <xsd:attribute name="id" type="xsd:ID"/>

Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/JBoss50UnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/JBoss50UnitTestCase.java	2007-10-25 13:57:42 UTC (rev 66430)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/JBoss50UnitTestCase.java	2007-10-25 14:09:45 UTC (rev 66431)
@@ -37,6 +37,7 @@
 import org.jboss.metadata.ejb.jboss.InvokerProxyBindingsMetaData;
 import org.jboss.metadata.ejb.jboss.JBoss50DTDMetaData;
 import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossConsumerBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
 import org.jboss.metadata.ejb.jboss.JBossGenericBeanMetaData;
@@ -45,6 +46,8 @@
 import org.jboss.metadata.ejb.jboss.JBossMetaDataWrapper;
 import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.MessagePropertiesMetaData;
+import org.jboss.metadata.ejb.jboss.ProducerMetaData;
 import org.jboss.metadata.ejb.jboss.ResourceManagerMetaData;
 import org.jboss.metadata.ejb.jboss.ResourceManagersMetaData;
 import org.jboss.metadata.ejb.spec.EjbJar20MetaData;
@@ -120,6 +123,119 @@
    }
    
    /**
+    * Test for consumer bean
+    */
+   public void testConsumer() throws Exception
+   {
+      JBossMetaData result = unmarshal();
+      
+      assertEquals(1, result.getEnterpriseBeans().size());
+      JBossConsumerBeanMetaData bean = (JBossConsumerBeanMetaData) result.getEnterpriseBean("DeploymentDescriptorQueueTestConsumer");
+      assertNotNull(bean);
+      assertTrue(bean.isConsumer());
+      assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer", bean.getEjbClass());
+      assertEquals("queue/consumertest", bean.getMessageDestination());
+      assertEquals("javax.jms.Queue", bean.getMessageDestinationType());
+      
+      assertEquals(2, bean.getProducers().size());
+      {
+         ProducerMetaData producer = bean.getProducers().get(0);
+         assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestRemote", producer.getClassName());
+      }
+      {
+         ProducerMetaData producer = bean.getProducers().get(1);
+         assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestXA", producer.getClassName());
+         assertEquals("java:/JmsXA", producer.getConnectionFactory());
+      }
+      assertEquals(1, bean.getLocalProducers().size());
+      {
+         ProducerMetaData producer = bean.getLocalProducers().get(0);
+         assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestLocal", producer.getClassName());
+         assertTrue(producer.isLocal());
+      }
+      assertEquals(2, bean.getCurrentMessage().size());
+      assertNotNull(bean.getCurrentMessage().getMethodAttribute("currentMessage"));
+      assertNotNull(bean.getCurrentMessage().getMethodAttribute("setMessage"));
+      assertEquals(2, bean.getMessageProperties().size());
+      {
+         MessagePropertiesMetaData messageProperties = bean.getMessageProperties().get(0);
+         assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTest", messageProperties.getClassName());
+         assertEquals("method2", messageProperties.getMethod().getMethodName());
+         assertEquals("NonPersistent", messageProperties.getDelivery());
+      }
+      {
+         MessagePropertiesMetaData messageProperties = bean.getMessageProperties().get(1);
+         assertEquals("org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestXA", messageProperties.getClassName());
+         assertEquals("method2", messageProperties.getMethod().getMethodName());
+         assertEquals("Persistent", messageProperties.getDelivery());
+         assertEquals(4, (int) messageProperties.getPriority());
+      }
+      
+      String pkg = "consumer";
+      String injectionTargetClass = "org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer";
+      {
+         assertEquals(1, bean.getEjbReferences().size());
+         EJBReferenceMetaData ejbRef = bean.getEjbReferenceByName("ejb/StatelessRemote");
+         assertNotNull(ejbRef);
+         //assertEquals("test", ejbRef.getDescriptions().value()[0].value());
+         assertEquals(EJBReferenceType.Session, ejbRef.getEjbRefType());
+         assertEquals("org.jboss.ejb3.test." + pkg + ".StatelessRemote", ejbRef.getRemote());
+         assertEquals("StatelessBean", ejbRef.getLink());
+         assertEquals("StatelessBean/remote", ejbRef.getJndiName());
+         assertEquals(1, ejbRef.getInjectionTargets().size());
+         ResourceInjectionTargetMetaData injectionTarget = ejbRef.getInjectionTargets().iterator().next();
+         assertNotNull(injectionTarget);
+         assertEquals(injectionTargetClass, injectionTarget.getInjectionTargetClass());
+         assertEquals("stateless", injectionTarget.getInjectionTargetName());
+      }
+      
+      {
+         assertEquals(1, bean.getEjbLocalReferences().size());
+         EJBLocalReferenceMetaData ejbLocalRef = bean.getEjbLocalReferenceByName("ejb/StatelessLocal");
+         assertNotNull(ejbLocalRef);
+         assertEquals(EJBReferenceType.Session, ejbLocalRef.getEjbRefType());
+         assertEquals("org.jboss.ejb3.test." + pkg +".StatelessLocal", ejbLocalRef.getLocal());
+         assertEquals("StatelessBean", ejbLocalRef.getLink());
+         assertEquals("StatelessBean/local", ejbLocalRef.getJndiName());
+         assertEquals(1, ejbLocalRef.getInjectionTargets().size());
+         ResourceInjectionTargetMetaData injectionTarget = ejbLocalRef.getInjectionTargets().iterator().next();
+         assertNotNull(injectionTarget);
+         assertEquals(injectionTargetClass, injectionTarget.getInjectionTargetClass());
+         assertEquals("setStatelessLocal", injectionTarget.getInjectionTargetName());
+      }
+      
+      {
+         assertEquals(1, bean.getResourceReferences().size());
+         ResourceReferenceMetaData resourceRef = bean.getResourceReferenceByName("testDatasource");
+         assertNotNull(resourceRef);
+         assertEquals("javax.sql.DataSource", resourceRef.getType());
+         assertEquals(ResourceAuthorityType.Container, resourceRef.getResAuth());
+         assertEquals("java:/DefaultDS", resourceRef.getMappedName());
+         assertEquals(1, resourceRef.getInjectionTargets().size());
+         ResourceInjectionTargetMetaData injectionTarget = resourceRef.getInjectionTargets().iterator().next();
+         assertNotNull(injectionTarget);
+         assertEquals(injectionTargetClass, injectionTarget.getInjectionTargetClass());
+         assertEquals("testDatasource", injectionTarget.getInjectionTargetName());
+      }
+      
+      {
+         assertEquals(1, bean.getResourceEnvironmentReferences().size());
+         ResourceEnvironmentReferenceMetaData resourceEnvRef = bean.getResourceEnvironmentReferenceByName("res/aQueue");
+         assertEquals("javax.jms.Queue", resourceEnvRef.getType());
+         assertEquals("queue/mdbtest", resourceEnvRef.getJndiName());
+      }
+      
+      /*
+      {
+         assertEquals(1, bean.getMessageDestinationReferences().size());
+         MessageDestinationReferenceMetaData messageDestinationRef = bean.getMessageDestinationReferenceByName("messageDestinationRef");
+         assertNotNull(messageDestinationRef);
+         assertEquals("mappedName", messageDestinationRef.getMappedName());
+      }
+      */
+   }
+   
+   /**
     * Test whether the cardinality of depends and ignore-dependency is correct.
     */
    public void testDependencies() throws Exception

Copied: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/JBoss50_testConsumer.xml (from rev 66417, trunk/ejb3/src/resources/test/consumer/META-INF/jboss.xml)
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/JBoss50_testConsumer.xml	                        (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/JBoss50_testConsumer.xml	2007-10-25 14:09:45 UTC (rev 66431)
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+<jboss
+        xmlns="http://www.jboss.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+        version="3.0">
+	<enterprise-beans>
+    	<consumer>
+         	<ejb-name>DeploymentDescriptorQueueTestConsumer</ejb-name>
+         	<ejb-class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer</ejb-class>
+         	<message-destination>queue/consumertest</message-destination>
+	     	<message-destination-type>javax.jms.Queue</message-destination-type>
+         	<producer>
+            	<class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestRemote</class>
+         	</producer>
+         	<producer>
+            	<class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestXA</class>
+            	<connection-factory>java:/JmsXA</connection-factory>
+         	</producer>
+         	<local-producer>
+            	<class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestLocal</class>
+         	</local-producer>
+         	<current-message>
+				<method>
+               		<method-name>currentMessage</method-name>
+            	</method>
+            	<method>
+               		<method-name>setMessage</method-name>
+            	</method>
+         	</current-message>
+         	<message-properties>
+            	<class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTest</class>
+				<method>
+		   			<method-name>method2</method-name>
+	      		</method>
+				<delivery>NonPersistent</delivery>
+         	</message-properties>
+         	<message-properties>
+            	<class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestXA</class>
+				<method>
+		   			<method-name>method2</method-name>
+	      		</method>
+				<delivery>Persistent</delivery>
+            	<priority>4</priority>
+         	</message-properties>
+            <ejb-ref>
+            	<ejb-ref-name>ejb/StatelessRemote</ejb-ref-name>
+            	<ejb-ref-type>Session</ejb-ref-type>
+            	<remote>org.jboss.ejb3.test.consumer.StatelessRemote</remote>
+            	<ejb-link>StatelessBean</ejb-link>
+                <jndi-name>StatelessBean/remote</jndi-name>
+            	<injection-target>
+               		<injection-target-class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer</injection-target-class>
+               		<injection-target-name>stateless</injection-target-name>
+            	</injection-target>
+         	</ejb-ref>
+			<ejb-local-ref>
+            	<ejb-ref-name>ejb/StatelessLocal</ejb-ref-name>
+            	<ejb-ref-type>Session</ejb-ref-type>
+            	<local>org.jboss.ejb3.test.consumer.StatelessLocal</local>
+            	<ejb-link>StatelessBean</ejb-link>
+                <jndi-name>StatelessBean/local</jndi-name>
+            	<injection-target>
+               		<injection-target-class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer</injection-target-class>
+               		<injection-target-name>setStatelessLocal</injection-target-name>
+            	</injection-target>
+         	</ejb-local-ref>
+            <resource-ref>
+            	<res-ref-name>testDatasource</res-ref-name>
+            	<res-type>javax.sql.DataSource</res-type>
+            	<res-auth>Container</res-auth>
+            	<res-sharing-scope>Shareable</res-sharing-scope>
+            	<mapped-name>java:/DefaultDS</mapped-name>
+            	<injection-target>
+               		<injection-target-class>org.jboss.ejb3.test.consumer.DeploymentDescriptorQueueTestConsumer</injection-target-class>
+               		<injection-target-name>testDatasource</injection-target-name>
+            	</injection-target>
+         	</resource-ref>
+            <resource-env-ref>
+            	<description>A test of the resource-env-ref tag</description>
+            	<resource-env-ref-name>res/aQueue</resource-env-ref-name>
+            	<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
+                <jndi-name>queue/mdbtest</jndi-name>
+         	</resource-env-ref>
+      	</consumer>
+   	</enterprise-beans>
+</jboss>




More information about the jboss-cvs-commits mailing list