[jboss-cvs] JBossAS SVN: r72578 - in projects/ejb3/trunk/interceptors/src: test/java/org/jboss/ejb3/test/interceptors and 5 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 22 12:24:52 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-04-22 12:24:52 -0400 (Tue, 22 Apr 2008)
New Revision: 72578
Added:
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBase.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBean.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassBaseInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/Interceptions.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodBaseInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MyInterface.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBase.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBean.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassBaseInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodBaseInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/unit/
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/unit/InheritanceTestCase.java
projects/ejb3/trunk/interceptors/src/test/resources/inheritance/
projects/ejb3/trunk/interceptors/src/test/resources/inheritance/META-INF/
projects/ejb3/trunk/interceptors/src/test/resources/inheritance/META-INF/ejb-jar.xml
Modified:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java
Log:
[EJBTHREE-1312] Test around invoke with inheritance rules
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java 2008-04-22 15:38:50 UTC (rev 72577)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -326,6 +326,12 @@
continue;
List<Method> methods = methodMap.get(method.getMethodName());
+
+ if (methods == null)
+ {
+ throw new IllegalStateException("Bean class " + beanClass.getName() + " does not have a method called '" + method.getMethodName() + "'. This method name was used in an interceptor-binding entry.");
+ }
+
for (Method refMethod : methods)
{
Signature signature = methodSignatures.getSignature(refMethod);
Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java 2008-04-22 15:38:50 UTC (rev 72577)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/InterceptorMetaDataBridge.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -47,6 +47,13 @@
{
private static final Logger log = Logger.getLogger(InterceptorMetaDataBridge.class);
+ public InterceptorMetaDataBridge()
+ {
+ // FIXME InterceptorMetaDataBridge constructor
+ System.out.println("======> Creating interceptor metadata bridge");
+
+ }
+
@Override
public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, InterceptorMetaData metaData, ClassLoader classLoader)
{
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBase.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBase.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBase.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,55 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotatedBase
+{
+ @PostConstruct
+ public void basePostConstruct()
+ {
+ Interceptions.addPostConstruct(AnnotatedBase.class);
+ }
+
+ @PreDestroy
+ public void basePreDestroy()
+ {
+ Interceptions.addPreDestroy(AnnotatedBase.class);
+ }
+
+ @AroundInvoke
+ public Object baseAround(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(AnnotatedBase.class);
+ return ctx.proceed();
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBean.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBean.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/AnnotatedBean.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,63 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptors;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Interceptors(ClassInterceptor.class)
+public class AnnotatedBean extends AnnotatedBase implements MyInterface
+{
+ @Interceptors(MethodInterceptor.class)
+ public void method()
+ {
+
+ }
+
+ @AroundInvoke
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(AnnotatedBean.class);
+ return ctx.proceed();
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ Interceptions.addPostConstruct(AnnotatedBean.class);
+ }
+
+ @PreDestroy
+ public void preDestroy()
+ {
+ Interceptions.addPreDestroy(AnnotatedBean.class);
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassBaseInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassBaseInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassBaseInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,72 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassBaseInterceptor
+{
+ @PostConstruct
+ public static void basePostConstruct(InvocationContext ctx)
+ {
+ try
+ {
+ Interceptions.addPostConstruct(ClassBaseInterceptor.class);
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @PreDestroy
+ public static void basePreDestroy(InvocationContext ctx)
+ {
+ try
+ {
+ Interceptions.addPreDestroy(ClassBaseInterceptor.class);
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @AroundInvoke
+ public Object baseAround(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(ClassBaseInterceptor.class);
+ return ctx.proceed();
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/ClassInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,71 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ClassInterceptor extends ClassBaseInterceptor
+{
+ @AroundInvoke
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(ClassInterceptor.class);
+ return ctx.proceed();
+ }
+
+ @PostConstruct
+ public static void postConstruct(InvocationContext ctx)
+ {
+ try
+ {
+ Interceptions.addPostConstruct(ClassInterceptor.class);
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @PreDestroy
+ public static void preDestroy(InvocationContext ctx)
+ {
+ try
+ {
+ Interceptions.addPreDestroy(ClassInterceptor.class);
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ }
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/Interceptions.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/Interceptions.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/Interceptions.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,73 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Interceptions
+{
+ private static ArrayList<Class<?>> aroundInvokes = new ArrayList<Class<?>>();
+ private static ArrayList<Class<?>> postConstructs = new ArrayList<Class<?>>();
+ private static ArrayList<Class<?>> preDestroys = new ArrayList<Class<?>>();
+
+ public static void addAroundInvoke(Class<?> clazz)
+ {
+ aroundInvokes.add(clazz);
+ }
+
+ public static void addPostConstruct(Class<?> clazz)
+ {
+ postConstructs.add(clazz);
+ }
+
+ public static void addPreDestroy(Class<?> clazz)
+ {
+ preDestroys.add(clazz);
+ }
+
+ public static void clear()
+ {
+ aroundInvokes.clear();
+ postConstructs.clear();
+ preDestroys.clear();
+ }
+
+ public static ArrayList<Class<?>> getAroundInvokes()
+ {
+ return aroundInvokes;
+ }
+
+ public static ArrayList<Class<?>> getPostConstructs()
+ {
+ return postConstructs;
+ }
+
+ public static ArrayList<Class<?>> getPreDestroys()
+ {
+ return preDestroys;
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodBaseInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodBaseInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodBaseInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,48 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MethodBaseInterceptor
+{
+ @PostConstruct
+ public static void basePostConstruct(InvocationContext ctx)
+ {
+ try
+ {
+ Interceptions.addPostConstruct(MethodBaseInterceptor.class);
+ ctx.proceed();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MethodInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,42 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class MethodInterceptor extends MethodBaseInterceptor
+{
+ @AroundInvoke
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(MethodInterceptor.class);
+ return ctx.proceed();
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MyInterface.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MyInterface.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/MyInterface.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,32 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MyInterface
+{
+ void method();
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBase.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBase.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBase.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,39 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlBase
+{
+ public Object baseAround(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlBase.class);
+ return ctx.proceed();
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBean.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBean.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlBean.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,44 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlBean extends XmlBase
+{
+ public void method()
+ {
+
+ }
+
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlBean.class);
+ return ctx.proceed();
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassBaseInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassBaseInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassBaseInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,40 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlClassBaseInterceptor
+{
+ public Object baseAround(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlClassBaseInterceptor.class);
+ return ctx.proceed();
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlClassInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,40 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlClassInterceptor extends XmlClassBaseInterceptor
+{
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlClassInterceptor.class);
+ return ctx.proceed();
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodBaseInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodBaseInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodBaseInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,40 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlMethodBaseInterceptor
+{
+ public Object baseAround(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlMethodBaseInterceptor.class);
+ return ctx.proceed();
+ }
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/XmlMethodInterceptor.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,39 @@
+/*
+* 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.ejb3.test.interceptors.inheritance;
+
+import javax.interceptor.InvocationContext;
+
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlMethodInterceptor extends XmlMethodBaseInterceptor
+{
+ public Object around(InvocationContext ctx) throws Exception
+ {
+ Interceptions.addAroundInvoke(XmlMethodInterceptor.class);
+ return ctx.proceed();
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/unit/InheritanceTestCase.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/unit/InheritanceTestCase.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/inheritance/unit/InheritanceTestCase.java 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,269 @@
+/*
+* 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.ejb3.test.interceptors.inheritance.unit;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aspects.common.AOPDeployer;
+import org.jboss.ejb3.interceptors.container.BeanContext;
+import org.jboss.ejb3.interceptors.direct.AbstractDirectContainer;
+import org.jboss.ejb3.interceptors.metadata.AdditiveBeanInterceptorMetaDataBridge;
+import org.jboss.ejb3.interceptors.metadata.InterceptorComponentMetaDataLoaderFactory;
+import org.jboss.ejb3.interceptors.metadata.InterceptorMetaDataBridge;
+import org.jboss.ejb3.interceptors.proxy.ProxyContainer;
+import org.jboss.ejb3.metadata.MetaDataBridge;
+import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.test.interceptors.inheritance.AnnotatedBase;
+import org.jboss.ejb3.test.interceptors.inheritance.AnnotatedBean;
+import org.jboss.ejb3.test.interceptors.inheritance.ClassBaseInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.ClassInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.Interceptions;
+import org.jboss.ejb3.test.interceptors.inheritance.MethodBaseInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.MethodInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.MyInterface;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlBase;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlBean;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlClassBaseInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlClassInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlMethodBaseInterceptor;
+import org.jboss.ejb3.test.interceptors.inheritance.XmlMethodInterceptor;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.builder.JBossXBBuilder;
+import org.w3c.dom.ls.LSInput;
+
+import junit.framework.TestCase;
+
+/**
+ *
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class InheritanceTestCase extends TestCase
+{
+ private static final Logger log = Logger.getLogger(InheritanceTestCase.class);
+
+ private class MyContainer<T> extends AbstractDirectContainer<T, MyContainer<T>>
+ {
+ public MyContainer(String name, String domainName, Class<? extends T> beanClass, JBossEnterpriseBeanMetaData beanMetaData)
+ {
+ super();
+
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ AnnotationRepositoryToMetaData annotations = new AnnotationRepositoryToMetaData(beanClass, beanMetaData, name, classLoader);
+ List<MetaDataBridge<InterceptorMetaData>> interceptorBridges = new ArrayList<MetaDataBridge<InterceptorMetaData>>();
+ interceptorBridges.add(new InterceptorMetaDataBridge());
+ annotations.addComponentMetaDataLoaderFactory(new InterceptorComponentMetaDataLoaderFactory(interceptorBridges));
+ annotations.addMetaDataBridge(new AdditiveBeanInterceptorMetaDataBridge(beanClass, classLoader, beanMetaData));
+
+ initializeAdvisor(name, getDomain(domainName), beanClass, annotations);
+ }
+
+ public void testAdvisor()
+ {
+ MyContainer<?> container = getAdvisor().getContainer();
+ assertNotNull("container not set in managed object advisor", container);
+ assertTrue(container == this);
+ }
+ }
+
+ protected static SchemaBindingResolver schemaResolverForClass(final Class<?> root)
+ {
+ return new SchemaBindingResolver()
+ {
+ public String getBaseURI()
+ {
+ return null;
+ }
+
+ public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
+ {
+ return JBossXBBuilder.build(root);
+ }
+
+ public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation)
+ {
+ return null;
+ }
+
+ public void setBaseURI(String baseURI)
+ {
+ }
+ };
+ }
+
+ // FIXME: use the right jboss-aop.xml
+ AOPDeployer deployer = new AOPDeployer("proxy/jboss-aop.xml");
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ log.info(deployer.deploy());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ log.info(deployer.undeploy());
+ }
+
+
+ public void testAnnotatedInheritanceAroundInvoke() throws Throwable
+ {
+ Thread.currentThread().setContextClassLoader(MyInterface.class.getClassLoader());
+
+ ProxyContainer<AnnotatedBean> container = new ProxyContainer<AnnotatedBean>("AnnotatedContainer", "InterceptorContainer", AnnotatedBean.class);
+ Interceptions.clear();
+
+ Class<?> interfaces[] = { MyInterface.class };
+ MyInterface proxy = container.constructProxy(interfaces);
+
+ ArrayList<Class<?>> interceptions = Interceptions.getAroundInvokes();
+ assertEquals(0, interceptions.size());
+
+ proxy.method();
+
+ assertEquals(6, interceptions.size());
+ assertEquals(ClassBaseInterceptor.class, interceptions.get(0));
+ assertEquals(ClassInterceptor.class, interceptions.get(1));
+ assertEquals(MethodBaseInterceptor.class, interceptions.get(2));
+ assertEquals(MethodInterceptor.class, interceptions.get(3));
+ assertEquals(AnnotatedBase.class, interceptions.get(4));
+ assertEquals(AnnotatedBean.class, interceptions.get(5));
+ }
+
+ public void testXmlInheritanceAroundInvoke() throws Throwable
+ {
+ AspectManager.verbose = true;
+
+ // To make surefire happy
+ Thread.currentThread().setContextClassLoader(MyInterface.class.getClassLoader());
+
+ JBossEnterpriseBeanMetaData beanMetaData = getJBossEnterpriseBeanMetaData("XmlBean");
+
+ MyContainer<XmlBean> container = new MyContainer<XmlBean>("XmlBean", "Test", XmlBean.class, beanMetaData);
+ container.testAdvisor();
+
+ BeanContext<XmlBean> bean = container.construct();
+
+ Interceptions.clear();
+ container.invoke(bean, "method");
+
+ ArrayList<Class<?>> interceptions = Interceptions.getAroundInvokes();
+ assertEquals("Wrong number of interceptions " + interceptions, 6, interceptions.size());
+ assertEquals(XmlClassBaseInterceptor.class, interceptions.get(0));
+ assertEquals(XmlClassInterceptor.class, interceptions.get(1));
+ assertEquals(XmlMethodBaseInterceptor.class, interceptions.get(2));
+ assertEquals(XmlMethodInterceptor.class, interceptions.get(3));
+ assertEquals(XmlBase.class, interceptions.get(4));
+ assertEquals(XmlBean.class, interceptions.get(5));
+ }
+
+//
+// public void testAnnotatedInheritanceLifecycle() throws Throwable
+// {
+// Thread.currentThread().setContextClassLoader(MyInterface.class.getClassLoader());
+//
+// JBossEnterpriseBeanMetaData beanMetaData = getJBossEnterpriseBeanMetaData("AnnotatedBean");
+//
+// MyContainer<AnnotatedBean> container = new MyContainer<AnnotatedBean>("AnnotatedBean", "Test", AnnotatedBean.class, beanMetaData);
+// container.testAdvisor();
+//
+// Interceptions.clear();
+// BeanContext<AnnotatedBean> bean = container.construct();
+//
+//
+// ArrayList<Class<?>> postConstructs = Interceptions.getPostConstructs();
+// assertEquals(4, postConstructs.size());
+//
+// ArrayList<Class<?>> interceptions = Interceptions.getAroundInvokes();
+// assertEquals(0, interceptions.size());
+//
+// container.invoke(bean, "method");
+//
+// assertEquals("Wrong number of interceptions " + interceptions, 6, interceptions.size());
+// assertEquals(ClassBaseInterceptor.class, interceptions.get(0));
+// assertEquals(ClassInterceptor.class, interceptions.get(1));
+// assertEquals(MethodBaseInterceptor.class, interceptions.get(2));
+// assertEquals(MethodInterceptor.class, interceptions.get(3));
+// assertEquals(AnnotatedBase.class, interceptions.get(4));
+// assertEquals(AnnotatedBean.class, interceptions.get(5));
+//
+// container.destroy(bean);
+// }
+//
+// public void testXmlInheritanceLifecycle() throws Throwable
+// {
+// AspectManager.verbose = true;
+//
+// // To make surefire happy
+// Thread.currentThread().setContextClassLoader(MyInterface.class.getClassLoader());
+//
+// JBossEnterpriseBeanMetaData beanMetaData = getJBossEnterpriseBeanMetaData("XmlBean");
+//
+// MyContainer<XmlBean> container = new MyContainer<XmlBean>("XmlBean", "Test", XmlBean.class, beanMetaData);
+// container.testAdvisor();
+//
+// BeanContext<XmlBean> bean = container.construct();
+//
+// Interceptions.clear();
+// container.invoke(bean, "method");
+//
+// ArrayList<Class<?>> interceptions = Interceptions.getAroundInvokes();
+// assertEquals("Wrong number of interceptions " + interceptions, 6, interceptions.size());
+// assertEquals(XmlClassBaseInterceptor.class, interceptions.get(0));
+// assertEquals(XmlClassInterceptor.class, interceptions.get(1));
+// assertEquals(XmlMethodBaseInterceptor.class, interceptions.get(2));
+// assertEquals(XmlMethodInterceptor.class, interceptions.get(3));
+// assertEquals(XmlBase.class, interceptions.get(4));
+// assertEquals(XmlBean.class, interceptions.get(5));
+//
+// container.destroy(bean);
+// }
+
+ private JBossEnterpriseBeanMetaData getJBossEnterpriseBeanMetaData(String name) throws JBossXBException
+ {
+ // Bootstrap metadata
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+ URL url = Thread.currentThread().getContextClassLoader().getResource("inheritance/META-INF/ejb-jar.xml");
+ EjbJar30MetaData metaData = (EjbJar30MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(EjbJar30MetaData.class));
+ JBoss50MetaData jbossMetaData = new JBoss50MetaData();
+ jbossMetaData.merge(null, metaData);
+
+ JBossEnterpriseBeanMetaData beanMetaData = jbossMetaData.getEnterpriseBean(name);
+ assertNotNull(beanMetaData);
+
+ return beanMetaData;
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/resources/inheritance/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/resources/inheritance/META-INF/ejb-jar.xml (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/resources/inheritance/META-INF/ejb-jar.xml 2008-04-22 16:24:52 UTC (rev 72578)
@@ -0,0 +1,70 @@
+<?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"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+ version="3.0">
+ <display-name>InterceptorsTest</display-name>
+ <!-- Must define a bean here, because we have no annotation on it -->
+ <!-- (Can't use @Stateless within ejb3-interceptors) -->
+ <enterprise-beans>
+ <session>
+ <ejb-name>AnnotatedBean</ejb-name>
+ </session>
+ <session>
+ <ejb-name>XmlBean</ejb-name>
+ <around-invoke>
+ <method-name>baseAround</method-name>
+ </around-invoke>
+ <around-invoke>
+ <method-name>around</method-name>
+ </around-invoke>
+ </session>
+ </enterprise-beans>
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.inheritance.XmlClassInterceptor</interceptor-class>
+ <around-invoke>
+ <method-name>baseAround</method-name>
+ </around-invoke>
+ <around-invoke>
+ <method-name>around</method-name>
+ </around-invoke>
+ <!--
+ <post-construct>
+ <method-name>postConstruct</method-name>
+ </post-construct>
+ <post-construct>
+ <method-name>basePostConstruct</method-name>
+ </post-construct>
+ <pre
+ basePreDestroy
+
+ preDestroy
+ -->
+ </interceptor>
+ <interceptor>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.inheritance.XmlMethodInterceptor</interceptor-class>
+ <around-invoke>
+ <method-name>baseAround</method-name>
+ </around-invoke>
+ <around-invoke>
+ <method-name>around</method-name>
+ </around-invoke>
+ </interceptor>
+ </interceptors>
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>XmlBean</ejb-name>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.inheritance.XmlClassInterceptor</interceptor-class>
+ </interceptor-binding>
+ <interceptor-binding>
+ <ejb-name>XmlBean</ejb-name>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.inheritance.XmlMethodInterceptor</interceptor-class>
+ <method>
+ <method-name>method</method-name>
+ </method>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list