[jboss-cvs] JBossAS SVN: r66113 - in projects/metadata/trunk/src: test/java/org/jboss/test/metadata/ejb and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Oct 14 21:04:46 EDT 2007
Author: scott.stark at jboss.org
Date: 2007-10-14 21:04:46 -0400 (Sun, 14 Oct 2007)
New Revision: 66113
Added:
projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenDestinationMetaData.java
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar20_testMDB.xml
Modified:
projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBeanMetaData.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar20UnitTestCase.java
Log:
Handle the 2.0 ejb-jar message-driven/message-driven-destination element
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBeanMetaData.java 2007-10-15 00:17:32 UTC (rev 66112)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBeanMetaData.java 2007-10-15 01:04:46 UTC (rev 66113)
@@ -335,4 +335,16 @@
throw new IllegalArgumentException("Null subscriptionDurability");
this.subscriptionDurability = subscriptionDurability;
}
+
+ @XmlElement(name="message-driven-destination", required=false)
+ public void setMessageDrivenDestination(MessageDrivenDestinationMetaData mdd)
+ {
+ // Translate this into destinationType, subscriptionDurability
+ this.setMessageDestinationType(mdd.getDestinationType());
+ String durability = mdd.getSubscriptionDurability();
+ SubscriptionDurability sd = SubscriptionDurability.NonDurable;
+ if (durability != null && durability.equalsIgnoreCase("Durable"))
+ sd = SubscriptionDurability.Durable;
+ this.setSubscriptionDurability(sd);
+ }
}
Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenDestinationMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenDestinationMetaData.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenDestinationMetaData.java 2007-10-15 01:04:46 UTC (rev 66113)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * 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.spec;
+
+import org.jboss.metadata.javaee.support.IdMetaDataImpl;
+
+/**
+ * The ejb-jar 2.0 message-driven/message-driven-destination element
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class MessageDrivenDestinationMetaData extends IdMetaDataImpl
+{
+ private static final long serialVersionUID = 1;
+
+ private String destinationType;
+
+ private String subscriptionDurability;
+
+ public String getDestinationType()
+ {
+ return destinationType;
+ }
+
+ public void setDestinationType(String destinationType)
+ {
+ this.destinationType = destinationType;
+ }
+
+ public String getSubscriptionDurability()
+ {
+ return subscriptionDurability;
+ }
+
+ public void setSubscriptionDurability(String subscriptionDurability)
+ {
+ this.subscriptionDurability = subscriptionDurability;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(100);
+ sb.append('[');
+ sb.append("destinationType=").append(destinationType);
+ sb.append(']');
+ return sb.toString();
+ }
+}
Property changes on: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenDestinationMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
Modified: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar20UnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar20UnitTestCase.java 2007-10-15 00:17:32 UTC (rev 66112)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/ejb/EjbJar20UnitTestCase.java 2007-10-15 01:04:46 UTC (rev 66113)
@@ -26,6 +26,11 @@
import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.ejb.spec.EjbJar20MetaData;
import org.jboss.metadata.ejb.spec.EjbJar2xMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.spec.MessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.spec.SubscriptionDurability;
+import org.jboss.metadata.javaee.spec.EnvironmentEntryMetaData;
import org.jboss.test.metadata.javaee.AbstractJavaEEMetaDataTest;
import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
@@ -60,7 +65,8 @@
return unmarshal(EjbJar20MetaData.class);
}
- public void testVersion() throws Exception
+ public void testVersion()
+ throws Exception
{
EjbJar2xMetaData result = unmarshal();
assertEquals("2.0", result.getVersion());
@@ -75,4 +81,38 @@
assertFalse(old.isEJB21());
assertFalse(old.isEJB3x());
}
+
+ public void testMDB()
+ throws Exception
+ {
+ EjbJar2xMetaData result = unmarshal();
+ assertEquals("2.0", result.getVersion());
+
+ EnterpriseBeansMetaData beans = result.getEnterpriseBeans();
+ EnterpriseBeanMetaData strictlyPooledMDB = beans.get("StrictlyPooledMDB");
+ assertNotNull("strictlyPooledMDB", strictlyPooledMDB);
+ assertEquals("strictlyPooledMDB-id", strictlyPooledMDB.getId());
+ assertEquals("Message driven pooling test", strictlyPooledMDB.getDescriptionGroup().getDescription());
+ assertEquals("org.jboss.test.cts.ejb.StrictlyPooledMDB", strictlyPooledMDB.getEjbClass());
+ assertTrue(strictlyPooledMDB.isMessageDriven());
+ MessageDrivenBeanMetaData mdbMD = (MessageDrivenBeanMetaData) strictlyPooledMDB;
+ assertEquals("AUTO_ACKNOWLEDGE", mdbMD.getAcknowledgeMode());
+ assertEquals("javax.jms.Queue", mdbMD.getMessageDestinationType());
+ assertEquals(SubscriptionDurability.NonDurable, mdbMD.getSubscriptionDurability());
+ EnvironmentEntryMetaData maxActiveCount = mdbMD.getEnvironmentEntryByName("maxActiveCount");
+ assertEquals("maxActiveCountID", maxActiveCount.getId());
+ assertEquals("java.lang.Integer", maxActiveCount.getType());
+ assertEquals("5", maxActiveCount.getValue());
+
+ EnterpriseBeanMetaData subclassMDB = beans.get("SubclassMDB");
+ assertNotNull("strictlyPooledMDB", subclassMDB);
+ assertEquals("SubclassMDB-id", subclassMDB.getId());
+ assertEquals("Message driven pooling test", subclassMDB.getDescriptionGroup().getDescription());
+ assertEquals("org.jboss.test.cts.ejb.ConcreteMDB", subclassMDB.getEjbClass());
+ assertTrue(subclassMDB.isMessageDriven());
+ MessageDrivenBeanMetaData mdbMD2 = (MessageDrivenBeanMetaData) subclassMDB;
+ assertEquals("AUTO_ACKNOWLEDGE", mdbMD2.getAcknowledgeMode());
+ assertEquals("javax.jms.Topic", mdbMD2.getMessageDestinationType());
+ assertEquals(SubscriptionDurability.Durable, mdbMD2.getSubscriptionDurability());
+ }
}
Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar20_testMDB.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar20_testMDB.xml (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar20_testMDB.xml 2007-10-15 01:04:46 UTC (rev 66113)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE ejb-jar PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
+ "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar id="ejb-jar_2_0">
+ <description>Basic version tests</description>
+ <enterprise-beans>
+ <message-driven id="strictlyPooledMDB-id">
+ <description>Message driven pooling test</description>
+ <ejb-name>StrictlyPooledMDB</ejb-name>
+ <ejb-class>org.jboss.test.cts.ejb.StrictlyPooledMDB</ejb-class>
+ <transaction-type>Container</transaction-type>
+ <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+ <message-driven-destination>
+ <destination-type>javax.jms.Queue</destination-type>
+ <subscription-durability>NonDurable</subscription-durability>
+ </message-driven-destination>
+ <env-entry id="maxActiveCountID">
+ <env-entry-name>maxActiveCount</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>5</env-entry-value>
+ </env-entry>
+ </message-driven>
+ <message-driven id="SubclassMDB-id">
+ <description>Message driven pooling test</description>
+ <ejb-name>SubclassMDB</ejb-name>
+ <ejb-class>org.jboss.test.cts.ejb.ConcreteMDB</ejb-class>
+ <transaction-type>Container</transaction-type>
+ <acknowledge-mode>AUTO_ACKNOWLEDGE</acknowledge-mode>
+ <message-driven-destination>
+ <destination-type>javax.jms.Topic</destination-type>
+ <subscription-durability>Durable</subscription-durability>
+ </message-driven-destination>
+ </message-driven>
+ </enterprise-beans>
+</ejb-jar>
Property changes on: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/ejb/EjbJar20_testMDB.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list