[jboss-cvs] JBossAS SVN: r77657 - in projects/metadata/trunk/src: main/java/org/jboss/metadata/ejb/jboss and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 29 11:17:44 EDT 2008
Author: emuckenhuber
Date: 2008-08-29 11:17:43 -0400 (Fri, 29 Aug 2008)
New Revision: 77657
Added:
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailListener.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailMsg.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IStateless.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MetaDataStatelessBean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyApplicationException.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyBaseInterceptor.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyMDB.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful21.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulBean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulHome.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Bean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Home.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Local.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessBean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessLocal.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/PostXmlProcessingUnitTestCase.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SecureBean.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SomeEntity.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestClassInterceptor.java
projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestMethodInterceptor.java
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/annotation/jbmeta99/
projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/annotation/jbmeta99/ejb-jar.xml
Modified:
projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractEnterpriseBeanProcessor.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java
projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBeanMetaData.java
Log:
[JBMETA-99] process not top-level annotated classes
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractEnterpriseBeanProcessor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractEnterpriseBeanProcessor.java 2008-08-29 14:23:23 UTC (rev 77656)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/AbstractEnterpriseBeanProcessor.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -36,6 +36,7 @@
import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
import org.jboss.metadata.ejb.jboss.JBossEnvironmentRefsGroupMetaData;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
import org.jboss.metadata.ejb.spec.InterceptorBindingsMetaData;
import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
@@ -83,15 +84,21 @@
addTypeProcessor(new JBossPoolProcessor(finder));
}
+
+ public void process(JBossMetaData ejbJarMetaData, Class<?> beanClass)
+ {
+ MD beanMetaData = create(beanClass);
+ if(beanMetaData == null)
+ return;
+
+ process(ejbJarMetaData, beanMetaData, beanClass);
+ }
+
/**
* TODO: this should iterate over all method processors
*/
- public void process(JBossMetaData ejbJarMetaData, Class<?> beanClass)
+ public void process(JBossMetaData ejbJarMetaData, JBossEnterpriseBeanMetaData beanMetaData, Class<?> beanClass)
{
- MD beanMetaData = create(beanClass);
- if(beanMetaData == null)
- return;
-
EjbNameThreadLocal.ejbName.set(beanMetaData.getEjbName());
try
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java 2008-08-29 14:23:23 UTC (rev 77656)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/JBoss50Creator.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -32,7 +32,13 @@
import org.jboss.metadata.annotation.creator.AbstractProcessor.Scope;
import org.jboss.metadata.annotation.finder.AnnotationFinder;
import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.EjbJarMetaData;
+import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.SessionBeanMetaData;
+import org.jboss.metadata.ejb.spec.SessionType;
/**
* A JBoss50Creator.
@@ -44,6 +50,13 @@
public class JBoss50Creator extends AbstractCreator<JBossMetaData>
implements Creator<Collection<Class<?>>, JBoss50MetaData>
{
+
+ /** The ejbJar3xMetaData */
+ private EjbJarMetaData ejbJarMetaData;
+
+ /** The deploymentUnit classLoader */
+ private ClassLoader classLoader;
+
/**
* Create a new JBoss50Creator.
*
@@ -60,6 +73,13 @@
addProcessor(new MessageDrivenProcessor(finder));
addProcessor(new ApplicationExceptionProcessor(finder));
}
+
+ public JBoss50Creator(EjbJarMetaData metaData, ClassLoader classLoader, AnnotationFinder<AnnotatedElement> finder)
+ {
+ this(finder);
+ this.ejbJarMetaData = metaData;
+ this.classLoader = classLoader;
+ }
/**
* Create the meta data for a set of annotated classes.
@@ -69,13 +89,22 @@
public JBoss50MetaData create(Collection<Class<?>> classes)
{
// Don't create meta data for a empty collection
- if(classes == null || classes.isEmpty())
+ if((classes == null
+ || classes.isEmpty())
+ && (ejbJarMetaData == null
+ || ejbJarMetaData.getEnterpriseBeans() == null
+ || ejbJarMetaData.getEnterpriseBeans().isEmpty()))
return null;
+
// Create meta data
JBoss50MetaData metaData = create();
+
+ // Process annotations
+ processMetaData(classes, metaData);
- processMetaData(classes, metaData);
+ // Process classes specified in the xml without top-level annotations
+ processClassesWithoutTopLevelAnnotations(metaData, classes);
return metaData;
}
@@ -88,6 +117,64 @@
return metaData;
}
+ private void processClassesWithoutTopLevelAnnotations(JBossMetaData metaData, Collection<Class<?>> classes)
+ {
+ if(ejbJarMetaData == null || classLoader == null) return;
+ if(ejbJarMetaData.getEnterpriseBeans() == null) return;
+ for(EnterpriseBeanMetaData bean : ejbJarMetaData.getEnterpriseBeans())
+ {
+ if(bean.getEjbName() == null || bean.getEjbClass() == null) continue;
+
+ try
+ {
+ Class<?> ejbClass = classLoader.loadClass(bean.getEjbClass());
+ if(! classes.contains(ejbClass))
+ {
+ if(bean.isSession())
+ {
+ SessionBeanMetaData sb = (SessionBeanMetaData) bean;
+ JBossSessionBeanMetaData sessionBean = new JBossSessionBeanMetaData();
+ sessionBean.setEjbName(sb.getEjbName());
+ sessionBean.setEjbClass(sb.getEjbClass());
+
+ if(sb.isStateful())
+ {
+ StatefulProcessor processor = new StatefulProcessor(finder);
+ sessionBean.setSessionType(SessionType.Stateful);
+ processor.process(metaData, sessionBean, ejbClass);
+ }
+ else
+ {
+ StatelessProcessor processor = new StatelessProcessor(finder);
+ sessionBean.setSessionType(SessionType.Stateless);
+ processor.process(metaData, sessionBean, ejbClass);
+ }
+
+ metaData.getEnterpriseBeans().add(sessionBean);
+ }
+ else if(bean.isMessageDriven())
+ {
+ JBossMessageDrivenBeanMetaData messageDriven = new JBossMessageDrivenBeanMetaData();
+ messageDriven.setEjbClass(bean.getEjbClass());
+ messageDriven.setEjbName(bean.getEjbName());
+ MessageDrivenProcessor processor = new MessageDrivenProcessor(finder);
+ processor.process(metaData, messageDriven, ejbClass);
+ metaData.getEnterpriseBeans().add(messageDriven);
+ }
+ }
+ }
+ catch(ClassNotFoundException e)
+ {
+ throw new RuntimeException("could not find class: "+ bean.getEjbClass(), e);
+ }
+ }
+ }
+
+ /**
+ * Validate a class for this deployment
+ *
+ * @param clazz the Class
+ */
protected boolean validateClass(Class<?> clazz)
{
// The AnnotationDeployer picks up only classes based on to the AnnotationContext, therefore no further validation
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java 2008-08-29 14:23:23 UTC (rev 77656)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMetaData.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -679,6 +679,10 @@
public void merge(JBossMetaData override, EjbJarMetaData original)
{
super.merge(override, original);
+ if(override != null && override.getVersion() != null)
+ version = override.getVersion();
+ else if(original != null && original.getVersion() != null)
+ version = original.getVersion();
if(assemblyDescriptor == null)
assemblyDescriptor = new JBossAssemblyDescriptorMetaData();
if(resourceManagers == null)
@@ -809,6 +813,11 @@
{
super.merge(override, original);
+ if(override != null && override.getVersion() != null)
+ version = override.getVersion();
+ else if(original != null && original.getVersion() != null)
+ version = original.getVersion();
+
JBossAssemblyDescriptorMetaData originalAssembly = null;
InvokerProxyBindingsMetaData originalInvokerProxyBindings = null;
InterceptorsMetaData originalInterceptors = null;
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBeanMetaData.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBeanMetaData.java 2008-08-29 14:23:23 UTC (rev 77656)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBeanMetaData.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -1000,16 +1000,25 @@
local = joverride.getLocal();
else if(soriginal != null && soriginal.getLocal() != null)
local = soriginal.getLocal();
- // businessLocals
- if(joverride != null && joverride.getBusinessLocals() != null)
- businessLocals = joverride.getBusinessLocals();
- else if(soriginal != null && soriginal.getBusinessLocals() != null)
- businessLocals = soriginal.getBusinessLocals();
// businessRemotes
if(joverride != null && joverride.getBusinessRemotes() != null)
businessRemotes = joverride.getBusinessRemotes();
else if(soriginal != null && soriginal.getBusinessRemotes() != null)
businessRemotes = soriginal.getBusinessRemotes();
+ // businessLocals
+ if(joverride != null && joverride.getBusinessLocals() != null)
+ businessLocals = joverride.getBusinessLocals();
+ else if(soriginal != null && soriginal.getBusinessLocals() != null)
+ {
+ // explicit merge, as this could be a implicit local interface
+ if(soriginal.getBusinessLocals().size() == 1)
+ {
+ if(businessRemotes == null || ! businessRemotes.containsAll(soriginal.getBusinessLocals()))
+ businessLocals = soriginal.getBusinessLocals();
+ }
+ else
+ businessLocals = soriginal.getBusinessLocals();
+ }
// serviceEndpoint
if(joverride != null && joverride.getServiceEndpoint() != null)
serviceEndpoint = joverride.getServiceEndpoint();
@@ -1070,6 +1079,11 @@
concurrent = joverride.isConcurrent();
else if(soriginal != null && soriginal.isConcurrent() != null)
concurrent = soriginal.isConcurrent();
+ //CacheConfig
+ if(joverride != null && joverride.getCacheConfig() != null)
+ cacheConfig = joverride.getCacheConfig();
+ else if(soriginal != null && soriginal.getCacheConfig() != null)
+ cacheConfig = soriginal.getCacheConfig();
// removeMethods
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailListener.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailListener.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailListener.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,33 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+/**
+ * Dummy mail listener interface for a custom mdb
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67280 $
+ */
+public interface IMailListener
+{
+ public void onMessage(IMailMsg msg);
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailMsg.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailMsg.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IMailMsg.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,31 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67280 $
+ */
+public interface IMailMsg
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IStateless.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IStateless.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/IStateless.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,17 @@
+package org.jboss.test.metadata.annotation.jbmeta99;
+
+public interface IStateless
+{
+ int unchecked(int i);
+
+ int checked(int i);
+
+ SomeEntity insertSomeEntity();
+
+ SomeEntity readSomeEntity(int key);
+
+ void updateSomeEntity(SomeEntity e);
+
+ void deleteSomeEntity(SomeEntity e);
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MetaDataStatelessBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MetaDataStatelessBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MetaDataStatelessBean.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.Stateless;
+
+/**
+ * This bean has a postConstruct in the descriptor.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+//@Stateless
+public class MetaDataStatelessBean
+{
+ public void postConstruct()
+ {
+
+ }
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyApplicationException.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyApplicationException.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyApplicationException.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.ApplicationException;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 65657 $
+ */
+ at ApplicationException(rollback=true)
+public class MyApplicationException extends Exception
+{
+ private static final long serialVersionUID = 1L;
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyBaseInterceptor.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyBaseInterceptor.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyBaseInterceptor.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,81 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.EJB;
+import javax.annotation.Resource;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContext;
+import javax.persistence.PersistenceUnit;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67165 $
+ */
+public class MyBaseInterceptor
+{
+ @EJB MyStatelessLocal baseSession2;
+ @Resource(mappedName="java:/TransactionManager") TransactionManager baseTm;
+ @Resource(name="DefaultDS", mappedName="java:DefaultDS") DataSource baseDs;
+ @PersistenceContext(unitName="interceptors-test") EntityManager baseEm;
+ @PersistenceUnit(unitName="interceptors-test") EntityManagerFactory baseFactory;
+
+ MyStatelessLocal baseSession2Method;
+ TransactionManager baseTmMethod;
+ DataSource baseDsMethod;
+ EntityManager baseEmMethod;
+ EntityManagerFactory baseFactoryMethod;
+
+ @EJB
+ public void setBaseSession2Method(MyStatelessLocal session2Method)
+ {
+ this.baseSession2Method = session2Method;
+ }
+ @Resource(name="DefaultDS", mappedName="java:DefaultDS")
+ public void setBaseDsMethod(DataSource dsMethod)
+ {
+ this.baseDsMethod = dsMethod;
+ }
+ @PersistenceContext(unitName="interceptors-test")
+ public void setBaseEmMethod(EntityManager emMethod)
+ {
+ this.baseEmMethod = emMethod;
+ }
+ @PersistenceUnit(unitName="interceptors-test")
+ public void setBaseFactoryMethod(EntityManagerFactory factoryMethod)
+ {
+ this.baseFactoryMethod = factoryMethod;
+ }
+
+ @AroundInvoke
+ public Object baseInvoke(InvocationContext ctx) throws Exception
+ {
+ return null;
+ }
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyMDB.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyMDB.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyMDB.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import org.jboss.ejb3.annotation.ResourceAdapter;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 75391 $
+ */
+//@MessageDriven(
+// name="MailMDB",
+// messageListenerInterface=IMailListener.class,
+// activationConfig={
+// @ActivationConfigProperty(propertyName="prop1", propertyValue="value1"),
+// @ActivationConfigProperty(propertyName="prop2", propertyValue="value2")
+// },
+// mappedName="java:/mdbs/MailMDB",
+// description="A custom IMailListener MDB"
+//)
+ at ResourceAdapter(value = "MDBResourceAdapter")
+public class MyMDB implements IMailListener
+{
+ public void onMessage(IMailMsg msg)
+ {
+ }
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,33 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface MyStateful
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful21.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful21.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateful21.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface MyStateful21 extends EJBObject, MyStateful
+{
+
+}
+
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulBean.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,119 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.EJBs;
+import javax.ejb.Init;
+import javax.ejb.PostActivate;
+import javax.ejb.PrePassivate;
+import javax.ejb.Remote;
+import javax.ejb.RemoteHome;
+import javax.ejb.Remove;
+import javax.ejb.SessionContext;
+import javax.persistence.PersistenceContext;
+import javax.xml.ws.WebServiceRef;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+import org.jboss.ejb3.annotation.Clustered;
+import org.jboss.ejb3.annotation.LocalHomeBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+import org.jboss.ejb3.annotation.RemoteHomeBinding;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: $
+ */
+//@Stateful(name="AnotherName")
+ at Remote(MyStateful.class)
+ at RemoteHome(MyStatefulHome.class)
+ at RemoteBindings(
+ value = {
+ @RemoteBinding(clientBindUrl = "clientBind1", interceptorStack = "stack1", factory = "factory1", jndiBinding = "RemoteBinding1"),
+ @RemoteBinding(clientBindUrl = "clientBind2", interceptorStack = "stack2", factory = "factory2", jndiBinding = "RemoteBinding2")
+ }
+)
+ at RemoteBinding(jndiBinding = "jndiBind3")
+ at LocalHomeBinding(jndiBinding = "localHome")
+ at RemoteHomeBinding(jndiBinding = "remoteHomeBinding")
+ at EJBs(
+ value={
+ @EJB(name="ejb/local1", beanInterface=MyStatelessLocal.class,
+ beanName="MyLocalSession1", mappedName="java:/MyLocalSession1",
+ description="A reference to MyLocalSession1"),
+ @EJB(name="ejb/local2", beanInterface=MyStatelessLocal.class,
+ beanName="local.jar#MyLocalSession1", mappedName="java:/MyLocalSession2",
+ description="A reference to MyLocalSession2")
+ }
+)
+ at CacheConfig(name = "test",
+ idleTimeoutSeconds = 123,
+ maxSize = 234,
+ removalTimeoutSeconds = 345,
+ replicationIsPassivation = true
+ )
+ at Clustered(homeLoadBalancePolicy = "home", loadBalancePolicy = "bean", partition = "partition")
+public class MyStatefulBean
+{
+
+ @Resource
+ private SessionContext context;
+
+ @PersistenceContext
+ private String string;
+
+ @WebServiceRef
+ private MyStateful webserviceRef;
+
+ @PostConstruct
+ public void setUp()
+ {
+
+ }
+ @PreDestroy
+ public void tearDown()
+ {
+ }
+ @Init
+ public void init()
+ {
+ }
+ @PostActivate
+ public void activate()
+ {
+ }
+ @PrePassivate
+ public void passivate()
+ {
+ }
+ @Remove
+ public void remove()
+ {
+ }
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulHome.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulHome.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatefulHome.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,33 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.EJBHome;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 73696 $
+ */
+public interface MyStatefulHome extends EJBHome
+{
+ public MyStateful21 create(String x);
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Bean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Bean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Bean.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.LocalHome;
+import javax.ejb.Stateless;
+
+/**
+ * An EJB 2.1 local stateless bean
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 73696 $
+ */
+//@Stateless
+ at LocalHome(MyStateless21Home.class)
+public class MyStateless21Bean
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Home.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Home.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Home.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,38 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBLocalHome;
+
+/**
+ * EJB 3 4.6.10
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 67332 $
+ */
+public interface MyStateless21Home extends EJBLocalHome
+{
+ MyStateless21Local create() throws CreateException, RemoteException;
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Local.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Local.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStateless21Local.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.EJBLocalObject;
+
+/**
+ * EJB 3 4.6.9
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 67332 $
+ */
+public interface MyStateless21Local extends EJBLocalObject
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessBean.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,178 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import java.net.URL;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.annotation.security.DeclareRoles;
+import javax.annotation.security.DenyAll;
+import javax.annotation.security.PermitAll;
+import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.RunAs;
+import javax.ejb.EJB;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.ejb.Timeout;
+import javax.ejb.Timer;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+import javax.jms.Queue;
+import javax.sql.DataSource;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 74785 $
+ */
+ at SuppressWarnings("unused")
+//@Stateless
+ at TransactionAttribute(TransactionAttributeType.NEVER)
+ at LocalBinding(jndiBinding = "LocalJndiBinding")
+ at RemoteBinding(clientBindUrl = "clientBind", interceptorStack = "stack", factory = "factory", jndiBinding = "RemoteBinding")
+ at Resources({
+ @Resource(description="url-resource-ref", name="googleHome", type=java.net.URL.class, mappedName="http://www.google.com"),
+ @Resource(description="DataSource-resource-ref", name="jdbc/ds", type=DataSource.class, mappedName="java:/DefaultDS")
+})
+ at DeclareRoles(value={"Role1","Role2"})
+ at RunAs("InternalUser")
+ at Interceptors(TestClassInterceptor.class)
+ at ExcludeDefaultInterceptors
+public class MyStatelessBean implements MyStatelessLocal
+{
+ @EJB
+ private MyStatelessLocal injectedField;
+ @Resource(description="SessionContext-resource-env-ref")
+ private SessionContext context;
+
+ @Resource(description="string-env-entry")
+ private String sfield;
+ private URL homePage;
+ private URL googleHome;
+ private Queue mailQueue;
+ private double pi;
+
+ @EJB(name="overrideName")
+ private MyStatelessLocal injectedFieldWithOverridenName;
+
+ @TransactionAttribute(TransactionAttributeType.MANDATORY)
+ public void transactionAttributeMandatory()
+ {
+
+ }
+
+ public URL getHomePage()
+ {
+ return homePage;
+ }
+ @Resource(description="url-resource-ref2")
+ public void setHomePage(URL homePage)
+ {
+ this.homePage = homePage;
+ }
+
+ public Queue getMailQueue()
+ {
+ return mailQueue;
+ }
+ @Resource(description="message-destination-ref")
+ public void setMailQueue(Queue mailQueue)
+ {
+ this.mailQueue = mailQueue;
+ }
+
+ public double getPi()
+ {
+ return pi;
+ }
+ @Resource(description="pi-env-entry", mappedName="3.14159")
+ public void setPi(double pi)
+ {
+ this.pi = pi;
+ }
+
+ @PostConstruct
+ public void setUp()
+ {
+
+ }
+ @PreDestroy
+ public void tearDown()
+ {
+ }
+
+ @DenyAll
+ public void denyAll()
+ {
+ }
+
+ @DenyAll
+ public void excluded()
+ {
+ }
+
+ @PermitAll
+ public void permitAll()
+ {
+ }
+
+ @RolesAllowed({"AccessRole1", "AccessRole2"})
+ public void rolesAllowed()
+ {
+ }
+
+ @AroundInvoke
+ public Object intercept(InvocationContext ctx) throws Exception
+ {
+ System.out.println("**** intercept ****" + ctx.getMethod().getName());
+ return ctx.proceed();
+ }
+
+ @ExcludeClassInterceptors
+ @ExcludeDefaultInterceptors
+ @Interceptors(TestMethodInterceptor.class)
+ public Object intercept2(InvocationContext ctx) throws Exception
+ {
+ System.out.println("**** intercept2 ****" + ctx.getMethod().getName());
+ return ctx.proceed();
+ }
+
+ @Timeout
+ public void timeout(Timer timer)
+ {
+
+ }
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessLocal.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessLocal.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/MyStatelessLocal.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -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.test.metadata.annotation.jbmeta99;
+
+import javax.ejb.Local;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: 65638 $
+ */
+ at Local
+public interface MyStatelessLocal
+{
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/PostXmlProcessingUnitTestCase.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/PostXmlProcessingUnitTestCase.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/PostXmlProcessingUnitTestCase.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,528 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import java.lang.reflect.AnnotatedElement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.ejb.Timer;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.common.ejb.IEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.CacheConfigMetaData;
+import org.jboss.metadata.ejb.jboss.ClusterConfigMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50DTDMetaData;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossAssemblyDescriptorMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
+import org.jboss.metadata.ejb.jboss.RemoteBindingMetaData;
+import org.jboss.metadata.ejb.spec.ActivationConfigMetaData;
+import org.jboss.metadata.ejb.spec.ActivationConfigPropertiesMetaData;
+import org.jboss.metadata.ejb.spec.ActivationConfigPropertyMetaData;
+import org.jboss.metadata.ejb.spec.AroundInvokeMetaData;
+import org.jboss.metadata.ejb.spec.AroundInvokesMetaData;
+import org.jboss.metadata.ejb.spec.ContainerTransactionMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar20MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar21MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.EjbJar3xMetaData;
+import org.jboss.metadata.ejb.spec.ExcludeListMetaData;
+import org.jboss.metadata.ejb.spec.InitMethodMetaData;
+import org.jboss.metadata.ejb.spec.InitMethodsMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorBindingMetaData;
+import org.jboss.metadata.ejb.spec.InterceptorBindingsMetaData;
+import org.jboss.metadata.ejb.spec.MethodMetaData;
+import org.jboss.metadata.ejb.spec.MethodParametersMetaData;
+import org.jboss.metadata.ejb.spec.MethodPermissionMetaData;
+import org.jboss.metadata.ejb.spec.MethodPermissionsMetaData;
+import org.jboss.metadata.ejb.spec.MethodsMetaData;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+import org.jboss.metadata.ejb.spec.RemoveMethodMetaData;
+import org.jboss.metadata.ejb.spec.RemoveMethodsMetaData;
+import org.jboss.metadata.ejb.spec.SecurityIdentityMetaData;
+import org.jboss.metadata.ejb.spec.SessionType;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferenceMetaData;
+import org.jboss.metadata.javaee.spec.AnnotatedEJBReferencesMetaData;
+import org.jboss.metadata.javaee.spec.LifecycleCallbackMetaData;
+import org.jboss.metadata.javaee.spec.LifecycleCallbacksMetaData;
+import org.jboss.metadata.javaee.spec.PersistenceContextReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ResourceEnvironmentReferencesMetaData;
+import org.jboss.metadata.javaee.spec.RunAsMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRoleMetaData;
+import org.jboss.metadata.javaee.spec.SecurityRolesMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferenceMetaData;
+import org.jboss.metadata.javaee.spec.ServiceReferencesMetaData;
+import org.jboss.test.metadata.javaee.AbstractJavaEEMetaDataTest;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+
+
+/**
+ * Process xml beans without top-level annotation
+ *
+ * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision: 1.1 $
+ */
+public class PostXmlProcessingUnitTestCase extends AbstractJavaEEMetaDataTest
+{
+ public static SchemaBindingResolver initResolver()
+ {
+ DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+
+ resolver.addClassBindingForLocation("ejb-jar_2_0.dtd", EjbJar20MetaData.class);
+ resolver.addClassBindingForLocation("ejb-jar_2_1.xsd", EjbJar21MetaData.class);
+ resolver.addClassBindingForLocation("ejb-jar_3_0.xsd", EjbJar30MetaData.class);
+ resolver.addClassBindingForLocation("jboss_3_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_3_2.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_4_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_4_2.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_5_0.dtd", JBoss50DTDMetaData.class);
+ resolver.addClassBindingForLocation("jboss_5_0.xsd", JBoss50MetaData.class);
+ // Workaround wildard resolution slowness
+ resolver.addClassBinding("http://www.jboss.com/xml/ns/javaee", JBoss50MetaData.class);
+ return resolver;
+ }
+
+ public PostXmlProcessingUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testBeans() throws Exception
+ {
+ AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+ Collection<Class<?>> classes = new ArrayList<Class<?>>();
+
+ EjbJar3xMetaData ejbJarMetaData = unmarshal("ejb-jar.xml", EjbJar3xMetaData.class, null);
+
+ JBoss50Creator creator = new JBoss50Creator(ejbJarMetaData, this.getClass().getClassLoader(), finder);
+ JBoss50MetaData annotations = creator.create(classes);
+
+ JBoss50MetaData specMetaData = new JBoss50MetaData();
+ specMetaData.merge(null, ejbJarMetaData);
+
+ JBoss50MetaData metaData = new JBoss50MetaData();
+ metaData.merge(specMetaData, annotations);
+
+ assertTrue(metaData.isEJB3x());
+ assertEquals("3.0", metaData.getVersion());
+
+ assertNotNull("no beans defined", metaData.getEnterpriseBeans());
+ assertNotNull("no assembly descriptor defined", metaData.getAssemblyDescriptor());
+
+ assertNotNull("no container transactions", metaData.getAssemblyDescriptor().getContainerTransactions());
+ // There is a bug in IdMetaDataImpl.hashCode which isn't unique when id is not set.
+ for(ContainerTransactionMetaData transaction : metaData.getAssemblyDescriptor().getContainerTransactions())
+ {
+ System.out.println(transaction);
+ }
+
+ assertEquals(6, metaData.getEnterpriseBeans().size());
+
+ assertMyStatefulBean(metaData.getEnterpriseBean("AnotherName")); // MyStatefulBean
+ assertMyStateless21Bean(metaData.getEnterpriseBean("MyStateless21Bean"));
+ assertMyStatelessBean(metaData.getEnterpriseBean("MyStatelessBean"));
+ assertMyMDB(metaData.getEnterpriseBean("MailMDB"));
+
+ JBossAssemblyDescriptorMetaData assembly = metaData.getAssemblyDescriptor();
+
+ // @DeclareRoles
+ SecurityRolesMetaData securityRoles = assembly.getSecurityRoles();
+ assertNotNull(securityRoles);
+ assertEquals(2, securityRoles.size());
+ SecurityRoleMetaData role1 = securityRoles.get("Role1");
+ assertNotNull(role1);
+ assertEquals("Role1", role1.getRoleName());
+ SecurityRoleMetaData role2 = securityRoles.get("Role2");
+ assertNotNull(role2);
+ assertEquals("Role2", role2.getRoleName());
+
+ // @DenyAll
+ // cls.getDeclaredMethods is un-ordered, so we must use bestMatch
+ ExcludeListMetaData excludes = assembly.getExcludeList();
+ assertNotNull(excludes);
+ MethodsMetaData excludedMethods = excludes.getMethods();
+ assertEquals(2, excludedMethods.size());
+ MethodMetaData m0 = excludedMethods.bestMatch("denyAll", (Class[]) null, null, null);
+ assertEquals("MyStatelessBean", m0.getEjbName());
+ assertEquals("denyAll", m0.getMethodName());
+ MethodParametersMetaData noargs = new MethodParametersMetaData();
+ assertEquals(noargs, m0.getMethodParams());
+ MethodMetaData m1 = excludedMethods.bestMatch("excluded", (Class[]) null, null, null);;
+ assertEquals("MyStatelessBean", m1.getEjbName());
+ assertEquals("excluded", m1.getMethodName());
+ assertEquals(noargs, m1.getMethodParams());
+
+ // @PermitAll, @RolesAllowed({"AccessRole1", "AccessRole2"})
+ MethodPermissionsMetaData allPerms = assembly.getMethodPermissions();
+ assertEquals(8, allPerms.size());
+ MethodPermissionsMetaData perms = assembly.getMethodPermissionsByEjbName("MyStatelessBean");
+ assertEquals(2, perms.size());
+ MethodPermissionMetaData permitAll = null;
+ MethodPermissionMetaData rolesAllowed = null;
+ for(MethodPermissionMetaData mp : perms)
+ {
+ if(mp.matches("permitAll", null, null))
+ permitAll = mp;
+ if(mp.matches("rolesAllowed", null, null))
+ rolesAllowed = mp;
+ }
+ assertNotNull(permitAll);
+ assertTrue(permitAll.isNotChecked());
+ assertTrue(permitAll.isNotChecked("permitAll", null, null));
+ assertNotNull(rolesAllowed);
+ HashSet<String> roles = new HashSet<String>();
+ roles.add("AccessRole1");
+ roles.add("AccessRole2");
+ assertEquals(roles, rolesAllowed.getRoles());
+
+ // Validate the MyStateless @Interceptors
+ InterceptorBindingsMetaData interceptorBindings = assembly.getInterceptorBindings();
+ assertEquals(2, interceptorBindings.size());
+ InterceptorBindingMetaData ib0 = interceptorBindings.get(0);
+ InterceptorBindingMetaData ib1 = interceptorBindings.get(1);
+ assertEquals("MyStatelessBean", ib0.getEjbName());
+ NamedMethodMetaData ib0Method = ib0.getMethod();
+ if(ib0Method == null)
+ {
+ // The class level @Interceptors
+ assertFalse(ib0.isExcludeClassInterceptors());
+ assertTrue(ib0.isExcludeDefaultInterceptors());
+ assertEquals(TestClassInterceptor.class.getName(),
+ ib0.getInterceptorClasses().iterator().next());
+ }
+ else
+ {
+ // The method level @Interceptors
+ assertTrue(ib0.isExcludeClassInterceptors());
+ assertTrue(ib0.isExcludeDefaultInterceptors());
+ assertEquals(TestMethodInterceptor.class.getName(),
+ ib0.getInterceptorClasses().iterator().next());
+ assertEquals("intercept2", ib0Method.getMethodName());
+ }
+ assertEquals("MyStatelessBean", ib1.getEjbName());
+ NamedMethodMetaData ib1Method = ib1.getMethod();
+ if(ib1Method == null)
+ {
+ // The class level @Interceptors
+ assertFalse(ib1.isExcludeClassInterceptors());
+ assertTrue(ib1.isExcludeDefaultInterceptors());
+ assertEquals(TestClassInterceptor.class.getName(),
+ ib1.getInterceptorClasses().iterator().next());
+ }
+ else
+ {
+ // The method level @Interceptors
+ assertTrue(ib1.isExcludeClassInterceptors());
+ assertTrue(ib1.isExcludeDefaultInterceptors());
+ assertEquals(TestMethodInterceptor.class.getName(),
+ ib1.getInterceptorClasses().iterator().next());
+ assertEquals("intercept2", ib1Method.getMethodName());
+ }
+
+ JBossSessionBeanMetaData secureBean = (JBossSessionBeanMetaData)metaData.getEnterpriseBean("SecureBean");
+ assertNotNull(secureBean);
+ assertNull(secureBean.getBusinessLocals());
+ assertNotNull(secureBean.getBusinessRemotes());
+
+ }
+
+ private void assertMyStatefulBean(IEnterpriseBeanMetaData enterpriseBean)
+ {
+ assertTrue(enterpriseBean instanceof JBossSessionBeanMetaData);
+
+ JBossSessionBeanMetaData bean = (JBossSessionBeanMetaData) enterpriseBean;
+ assertEquals(SessionType.Stateful, bean.getSessionType());
+ assertEquals(MyStatefulBean.class.getName(), bean.getEjbClass());
+ assertEquals("AnotherName", bean.getEjbName());
+
+ assertNotNull("bean has no business remotes", bean.getBusinessRemotes());
+ assertEquals(1, bean.getBusinessRemotes().size());
+ assertTrue(bean.getBusinessRemotes().contains(MyStateful.class.getName()));
+ assertEquals(MyStatefulHome.class.getName(), bean.getHome());
+
+ // @EJBs
+ AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
+ assertEquals(2, ejbRefs.size());
+ AnnotatedEJBReferenceMetaData local1 = ejbRefs.get("ejb/local1");
+ assertNotNull(local1);
+ assertEquals("java:/MyLocalSession1", local1.getMappedName());
+ assertEquals("ejb/local1", local1.getEjbRefName());
+ assertEquals("MyLocalSession1", local1.getLink());
+ assertEquals("A reference to MyLocalSession1", local1.getDescriptions().value()[0].value());
+ assertEquals(MyStatelessLocal.class, local1.getBeanInterface());
+ AnnotatedEJBReferenceMetaData local2 = ejbRefs.get("ejb/local2");
+ assertNotNull(local2);
+ assertEquals("java:/MyLocalSession2", local2.getMappedName());
+ assertEquals("ejb/local2", local2.getEjbRefName());
+ assertEquals("local.jar#MyLocalSession1", local2.getLink());
+ assertEquals("A reference to MyLocalSession2", local2.getDescriptions().value()[0].value());
+ assertEquals(MyStatelessLocal.class, local2.getBeanInterface());
+ // @PostConstruct
+ LifecycleCallbacksMetaData postConstructs = bean.getPostConstructs();
+ assertNotNull(postConstructs);
+ assertEquals(1, postConstructs.size());
+ LifecycleCallbackMetaData postConstruct = postConstructs.get(0);
+ assertEquals("setUp", postConstruct.getMethodName());
+ assertEquals(MyStatefulBean.class.getName(), postConstruct.getClassName());
+ // @PreDestroy
+ LifecycleCallbacksMetaData preDestroys = bean.getPreDestroys();
+ assertNotNull(preDestroys);
+ assertEquals(1, preDestroys.size());
+ LifecycleCallbackMetaData preDestroy = preDestroys.get(0);
+ assertEquals("tearDown", preDestroy.getMethodName());
+ assertEquals(MyStatefulBean.class.getName(), preDestroy.getClassName());
+ // @Init
+ InitMethodsMetaData initMethods = bean.getInitMethods();
+ assertNotNull(initMethods);
+ assertEquals(1, initMethods.size());
+ InitMethodMetaData initMethod = initMethods.get(0);
+ assertEquals("init", initMethod.getBeanMethod().getMethodName());
+ // @PostActivate
+ LifecycleCallbacksMetaData postActivates = bean.getPostActivates();
+ assertNotNull(postActivates);
+ assertEquals(1, postActivates.size());
+ LifecycleCallbackMetaData postActivate = postActivates.get(0);
+ assertEquals("activate", postActivate.getMethodName());
+ assertEquals(MyStatefulBean.class.getName(), postActivate.getClassName());
+ // @PrePassivate
+ LifecycleCallbacksMetaData prePassivates = bean.getPrePassivates();
+ assertNotNull(prePassivates);
+ assertEquals(1, prePassivates.size());
+ LifecycleCallbackMetaData prePassivate = prePassivates.get(0);
+ assertEquals("passivate", prePassivate.getMethodName());
+ assertEquals(MyStatefulBean.class.getName(), prePassivate.getClassName());
+ // @Remove
+ RemoveMethodsMetaData removeMethods = bean.getRemoveMethods();
+ assertNotNull(removeMethods);
+ assertEquals(1, removeMethods.size());
+ RemoveMethodMetaData removeMethod = removeMethods.get(0);
+ assertEquals("remove", removeMethod.getBeanMethod().getMethodName());
+ // @Resource
+ ResourceEnvironmentReferencesMetaData resource = bean.getResourceEnvironmentReferences();
+ assertNotNull(resource);
+ assertEquals(1, resource.size());
+ ResourceEnvironmentReferenceMetaData ref = resource.get("context");
+ assertNotNull(ref);
+ assertNotNull(ref.getInjectionTargets());
+ // @PersistenceContext
+ PersistenceContextReferenceMetaData persistence = bean.getPersistenceContextReferenceByName("string");
+ assertNotNull(persistence);
+ assertNotNull(persistence.getInjectionTargets());
+ // @WebServiceRef
+ ServiceReferencesMetaData serviceRefs = bean.getServiceReferences();
+ assertNotNull(serviceRefs);
+ assertEquals(1, serviceRefs.size());
+ ServiceReferenceMetaData serviceRef = serviceRefs.get(bean.getEjbClass() + "/webserviceRef");
+ assertNotNull(serviceRef);
+ assertNotNull(serviceRef.getInjectionTargets());
+
+ // @RemoteBindings
+ assertNotNull(bean.getRemoteBindings());
+ assertEquals(3, bean.getRemoteBindings().size());
+ RemoteBindingMetaData remoteBinding = bean.getRemoteBindings().get(0);
+ assertNotNull(remoteBinding);
+ assertEquals("jndiBind3", remoteBinding.getJndiName());
+ remoteBinding = bean.getRemoteBindings().get(1);
+ assertNotNull(remoteBinding);
+ assertEquals("clientBind1", remoteBinding.getClientBindUrl());
+ assertEquals("stack1", remoteBinding.getInterceptorStack());
+ assertEquals("factory1", remoteBinding.getProxyFactory());
+ assertEquals("RemoteBinding1", remoteBinding.getJndiName());
+ remoteBinding = bean.getRemoteBindings().get(2);
+ assertNotNull(remoteBinding);
+ assertEquals("clientBind2", remoteBinding.getClientBindUrl());
+ assertEquals("stack2", remoteBinding.getInterceptorStack());
+ assertEquals("factory2", remoteBinding.getProxyFactory());
+ assertEquals("RemoteBinding2", remoteBinding.getJndiName());
+
+ // @LocalHomeBinding
+ assertEquals("localHome", bean.getLocalHomeJndiName());
+
+ // @RemoteHomeBinding
+ assertEquals("remoteHomeBinding", bean.getHomeJndiName());
+
+ // @CacheConfig
+ assertNotNull(bean.getCacheConfig());
+ CacheConfigMetaData cacheConfig = bean.getCacheConfig();
+ assertEquals("test", cacheConfig.getName());
+ assertEquals(Integer.valueOf(123), cacheConfig.getIdleTimeoutSeconds());
+ assertEquals(Integer.valueOf(234), cacheConfig.getMaxSize());
+ assertEquals(Integer.valueOf(345), cacheConfig.getRemoveTimeoutSeconds());
+ assertEquals("true", cacheConfig.getReplicationIsPassivation());
+
+ // @Clustered
+ assertNotNull(bean.getClusterConfig());
+ ClusterConfigMetaData clusterConfig = bean.getClusterConfig();
+ assertEquals("home", clusterConfig.getHomeLoadBalancePolicy());
+ assertEquals("bean", clusterConfig.getBeanLoadBalancePolicy());
+ assertEquals("partition", clusterConfig.getPartitionName());
+ }
+
+ private void assertMyStateless21Bean(IEnterpriseBeanMetaData enterpriseBean)
+ {
+ assertTrue(enterpriseBean instanceof JBossSessionBeanMetaData);
+ JBossSessionBeanMetaData bean = (JBossSessionBeanMetaData) enterpriseBean;
+ assertEquals(SessionType.Stateless, bean.getSessionType());
+ assertEquals(MyStateless21Bean.class.getName(), bean.getEjbClass());
+ assertEquals("MyStateless21Bean", bean.getEjbName());
+
+ assertNull("bean has business locals (instead of local interface)", bean.getBusinessLocals());
+
+ assertEquals(MyStateless21Local.class.getName(), bean.getLocal());
+ assertEquals(MyStateless21Home.class.getName(), bean.getLocalHome());
+ }
+
+ private void assertMyStatelessBean(IEnterpriseBeanMetaData enterpriseBean)
+ {
+ assertTrue(enterpriseBean instanceof JBossSessionBeanMetaData);
+ JBossSessionBeanMetaData bean = (JBossSessionBeanMetaData) enterpriseBean;
+ assertEquals(SessionType.Stateless, bean.getSessionType());
+ assertEquals(MyStatelessBean.class.getName(), bean.getEjbClass());
+ assertEquals("MyStatelessBean", bean.getEjbName());
+
+ assertNotNull("bean has no business locals", bean.getBusinessLocals());
+ assertEquals(1, bean.getBusinessLocals().size());
+ assertTrue(bean.getBusinessLocals().contains(MyStatelessLocal.class.getName()));
+
+ assertNotNull("bean has no container transactions", bean.getContainerTransactions());
+ Iterator<ContainerTransactionMetaData> it = bean.getContainerTransactions().iterator();
+ ContainerTransactionMetaData tx1 = it.next();
+ assertEquals(TransactionAttributeType.NEVER, tx1.getTransAttribute());
+ ContainerTransactionMetaData tx2 = it.next();
+ assertEquals(TransactionAttributeType.MANDATORY, tx2.getTransAttribute());
+ MethodsMetaData tx2Methods = tx2.getMethods();
+ String[] params = {};
+ tx2Methods.matches("transactionAttributeMandatory", params, null);
+
+ // @EJB
+ AnnotatedEJBReferencesMetaData ejbRefs = bean.getAnnotatedEjbReferences();
+ assertEquals(2, ejbRefs.size());
+ AnnotatedEJBReferenceMetaData injectedField = ejbRefs.get("injectedField");
+ assertNotNull(injectedField);
+ assertEquals(MyStatelessLocal.class, injectedField.getBeanInterface());
+ AnnotatedEJBReferenceMetaData injectedFieldWithOverridenName = ejbRefs.get("overrideName");
+ assertNotNull(injectedFieldWithOverridenName);
+ assertEquals(MyStatelessLocal.class, injectedFieldWithOverridenName.getBeanInterface());
+ // @PostConstruct
+ LifecycleCallbacksMetaData postConstructs = bean.getPostConstructs();
+ assertNotNull(postConstructs);
+ assertEquals(1, postConstructs.size());
+ LifecycleCallbackMetaData postConstruct = postConstructs.get(0);
+ assertEquals("setUp", postConstruct.getMethodName());
+ assertEquals(MyStatelessBean.class.getName(), postConstruct.getClassName());
+ // @PreDestroy
+ LifecycleCallbacksMetaData preDestroys = bean.getPreDestroys();
+ assertNotNull(preDestroys);
+ assertEquals(1, preDestroys.size());
+ LifecycleCallbackMetaData preDestroy = preDestroys.get(0);
+ assertEquals("tearDown", preDestroy.getMethodName());
+ assertEquals(MyStatelessBean.class.getName(), preDestroy.getClassName());
+
+ // @RunAs
+ SecurityIdentityMetaData identity = bean.getSecurityIdentity();
+ assertNotNull(identity);
+ RunAsMetaData runAs = identity.getRunAs();
+ assertNotNull(runAs);
+ assertEquals("InternalUser", runAs.getRoleName());
+
+ // @AroundInvoke
+ AroundInvokesMetaData invokes = bean.getAroundInvokes();
+ assertNotNull(invokes);
+ assertEquals(1, invokes.size());
+ AroundInvokeMetaData aroundInvoke = invokes.get(0);
+ assertEquals(MyStatelessBean.class.getName(), aroundInvoke.getClassName());
+ assertEquals("intercept", aroundInvoke.getMethodName());
+
+ // @Timeout
+ NamedMethodMetaData timeoutMethod = bean.getTimeoutMethod();
+ assertNotNull(timeoutMethod);
+ assertEquals("timeout", timeoutMethod.getMethodName());
+ MethodParametersMetaData parameters = timeoutMethod.getMethodParams();
+ assertEquals(1, parameters.size());
+ assertEquals(Timer.class.getName(), parameters.get(0));
+
+ // @LocalBinding
+ assertEquals("LocalJndiBinding", bean.getLocalJndiName());
+
+ // @RemoteBinding
+ assertNotNull(bean.getRemoteBindings());
+ assertEquals(1, bean.getRemoteBindings().size());
+ RemoteBindingMetaData remoteBinding = bean.getRemoteBindings().get(0);
+ assertNotNull(remoteBinding);
+ assertEquals("clientBind", remoteBinding.getClientBindUrl());
+ assertEquals("stack", remoteBinding.getInterceptorStack());
+ assertEquals("factory", remoteBinding.getProxyFactory());
+ assertEquals("RemoteBinding", remoteBinding.getJndiName());
+ }
+
+ private void assertMyMDB(IEnterpriseBeanMetaData enterpriseBean)
+ {
+ assertTrue(enterpriseBean instanceof JBossMessageDrivenBeanMetaData);
+ JBossMessageDrivenBeanMetaData bean = (JBossMessageDrivenBeanMetaData) enterpriseBean;
+ assertEquals(MyMDB.class.getName(), bean.getEjbClass());
+ assertEquals("MailMDB", bean.getEjbName());
+ assertEquals(false, bean.isJMS());
+ assertEquals(IMailListener.class.getName(), bean.getMessagingType());
+ ActivationConfigMetaData config = bean.getActivationConfig();
+ ActivationConfigMetaData expected = new ActivationConfigMetaData();
+ ActivationConfigPropertiesMetaData props = new ActivationConfigPropertiesMetaData();
+ ActivationConfigPropertyMetaData p1 = new ActivationConfigPropertyMetaData();
+ p1.setName("p1");
+ p1.setValue("v1");
+ props.add(p1);
+ ActivationConfigPropertyMetaData p2 = new ActivationConfigPropertyMetaData();
+ p2.setName("p2");
+ p2.setValue("v2");
+ props.add(p2);
+ expected.setActivationConfigProperties(props);
+ assertEquals(expected, config);
+ assertEquals("java:/mdbs/MailMDB", bean.getMappedName());
+ // @ResourceAdapter
+ assertEquals("MDBResourceAdapter", bean.getResourceAdapterName());
+ }
+
+ private void assertInterMediateBean(JBossEnterpriseBeanMetaData interMediateBean)
+ {
+ // Validate the merged InterMediateBean
+ assertNotNull(interMediateBean);
+ assertEquals("org.jboss.test.metadata.annotation.ejb3.runas.InterMediate", interMediateBean.getEjbClass());
+ assertTrue(interMediateBean instanceof JBossSessionBeanMetaData);
+ JBossSessionBeanMetaData sInterMediateBean = (JBossSessionBeanMetaData) interMediateBean;
+ assertEquals(SessionType.Stateless, sInterMediateBean.getSessionType());
+ SecurityIdentityMetaData identity = sInterMediateBean.getSecurityIdentity();
+ assertNotNull(identity);
+ RunAsMetaData runAs = identity.getRunAs();
+ assertNotNull(runAs);
+ assertEquals("InternalUser", runAs.getRoleName());
+ }
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SecureBean.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SecureBean.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SecureBean.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,89 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.PermitAll;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.jboss.test.metadata.annotation.ejb3.jbas5124.StatelessIF;
+
+/**
+ *
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67165 $
+ */
+//@Stateless
+public class SecureBean implements StatelessIF
+{
+ @PersistenceContext(unitName="jacc-test")
+ EntityManager em;
+
+ @PermitAll
+ public int unchecked(int i)
+ {
+ System.out.println("stateless unchecked");
+ return i;
+ }
+
+ @RolesAllowed ("allowed")
+ public int checked(int i)
+ {
+ System.out.println("stateless checked");
+ return i;
+ }
+
+ @PermitAll
+ public SomeEntity insertSomeEntity()
+ {
+ SomeEntity e = new SomeEntity();
+ e.val = "x";
+ em.persist(e);
+ return e;
+ }
+
+ @PermitAll
+ public SomeEntity readSomeEntity(int key)
+ {
+ SomeEntity e = em.find(SomeEntity.class, key);
+ return e;
+ }
+
+ @PermitAll
+ public void updateSomeEntity(SomeEntity e)
+ {
+ em.merge(e);
+ }
+
+ @PermitAll
+ public void deleteSomeEntity(SomeEntity e)
+ {
+ em.remove(e);
+ }
+
+ public void test1() throws Exception {}
+ public void test2() throws Exception {}
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SomeEntity.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SomeEntity.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/SomeEntity.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,42 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+/**
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67165 $
+ */
+ at Entity
+public class SomeEntity implements Serializable
+{
+ @Id @GeneratedValue(strategy=GenerationType.AUTO)
+ public int id;
+
+ public String val;
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestClassInterceptor.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestClassInterceptor.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestClassInterceptor.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67317 $
+ */
+public class TestClassInterceptor
+{
+ @PostConstruct
+ public void postConstruct(InvocationContext ctx)
+ {
+ System.out.println("PostConstruct");
+ }
+
+ @AroundInvoke
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ System.out.println("Around invoke");
+ return ctx.proceed();
+ }
+
+}
Added: projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestMethodInterceptor.java
===================================================================
--- projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestMethodInterceptor.java (rev 0)
+++ projects/metadata/trunk/src/test/java/org/jboss/test/metadata/annotation/jbmeta99/TestMethodInterceptor.java 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,47 @@
+/*
+ * 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.test.metadata.annotation.jbmeta99;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 67317 $
+ */
+public class TestMethodInterceptor
+{
+ @PostConstruct
+ public void postConstruct(InvocationContext ctx)
+ {
+ System.out.println("PostConstruct");
+ }
+
+ @AroundInvoke
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ System.out.println("Around invoke");
+ return ctx.proceed();
+ }
+
+}
Added: projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/annotation/jbmeta99/ejb-jar.xml
===================================================================
--- projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/annotation/jbmeta99/ejb-jar.xml (rev 0)
+++ projects/metadata/trunk/src/test/resources/org/jboss/test/metadata/annotation/jbmeta99/ejb-jar.xml 2008-08-29 15:17:43 UTC (rev 77657)
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ metadata-complete="false"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <enterprise-beans>
+ <session>
+ <ejb-name>AnotherName</ejb-name>
+ <ejb-class>
+ org.jboss.test.metadata.annotation.jbmeta99.MyStatefulBean
+ </ejb-class>
+ <session-type>Stateful</session-type>
+ </session>
+ <session>
+ <ejb-name>MyStatelessBean</ejb-name>
+ <ejb-class>
+ org.jboss.test.metadata.annotation.jbmeta99.MyStatelessBean
+ </ejb-class>
+ <session-type>Stateless</session-type>
+ </session>
+ <session>
+ <ejb-name>MyStateless21Bean</ejb-name>
+ <ejb-class>
+ org.jboss.test.metadata.annotation.jbmeta99.MyStateless21Bean
+ </ejb-class>
+ <session-type>Stateless</session-type>
+ </session>
+ <session>
+ <ejb-name>SecureBean</ejb-name>
+ <business-remote>org.jboss.test.metadata.annotation.ejb3.jbas5124.StatelessIF</business-remote>
+ <ejb-class>
+ org.jboss.test.metadata.annotation.jbmeta99.SecureBean
+ </ejb-class>
+ <session-type>Stateless</session-type>
+ </session>
+ <session>
+ <ejb-name>MetaDataStatelessBean</ejb-name>
+ <ejb-class>
+ org.jboss.test.metadata.annotation.jbmeta99.MetaDataStatelessBean
+ </ejb-class>
+ <session-type>Stateless</session-type>
+ <post-construct>
+ <lifecycle-callback-method>
+ postConstruct
+ </lifecycle-callback-method>
+ </post-construct>
+ </session>
+ <message-driven>
+ <ejb-name>MailMDB</ejb-name>
+ <mapped-name>java:/mdbs/MailMDB</mapped-name>
+ <ejb-class>org.jboss.test.metadata.annotation.jbmeta99.MyMDB</ejb-class>
+ <messaging-type>org.jboss.test.metadata.annotation.jbmeta99.IMailListener</messaging-type>
+ <activation-config>
+ <activation-config-property>
+ <activation-config-property-name>prop1</activation-config-property-name>
+ <activation-config-property-value>value1</activation-config-property-value>
+ </activation-config-property>
+ <activation-config-property>
+ <activation-config-property-name>prop2</activation-config-property-name>
+ <activation-config-property-value>value2</activation-config-property-value>
+ </activation-config-property>
+ </activation-config>
+ </message-driven>
+ </enterprise-beans>
+</ejb-jar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list