[jboss-cvs] JBossAS SVN: r80195 - in projects/ejb3/trunk/interceptors/src: test/java/org/jboss/ejb3/test/interceptors and 6 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 29 10:37:33 EDT 2008
Author: wolfc
Date: 2008-10-29 10:37:33 -0400 (Wed, 29 Oct 2008)
New Revision: 80195
Added:
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonAnnotatedInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedClassInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedMethodInterceptor.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/OrderedSLSB.java
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/unit/
projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/unit/CorrectOrderTestCase.java
projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/
projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/META-INF/
projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/META-INF/ejb-jar.xml
Modified:
projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
Log:
EJBTHREE-1555: only use method-parameters if specified and make sure we take the most specific interceptor-order
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-10-29 14:36:14 UTC (rev 80194)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -25,6 +25,8 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -60,6 +62,7 @@
import org.jboss.metadata.ejb.spec.InterceptorBindingMetaData;
import org.jboss.metadata.ejb.spec.InterceptorBindingsMetaData;
import org.jboss.metadata.ejb.spec.InterceptorClassesMetaData;
+import org.jboss.metadata.ejb.spec.MethodParametersMetaData;
import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
import org.jboss.metadata.spi.signature.Signature;
@@ -74,6 +77,29 @@
{
private static final Logger log = Logger.getLogger(BeanInterceptorMetaDataBridge.class);
+ private static Comparator<InterceptorBindingMetaData> mostSpecificFirst = new Comparator<InterceptorBindingMetaData>() {
+ public int compare(InterceptorBindingMetaData o1, InterceptorBindingMetaData o2)
+ {
+ return score(o2) - score(o1);
+ }
+
+ private int score(InterceptorBindingMetaData binding)
+ {
+ int s = 0;
+ NamedMethodMetaData method = binding.getMethod();
+ if(method != null)
+ {
+ s++;
+ MethodParametersMetaData params = binding.getMethod().getMethodParams();
+ if(params != null)
+ {
+ s += 1 + params.size();
+ }
+ }
+ return s;
+ }
+ };
+
private volatile boolean initialisedBean;
//Class level stuff
@@ -112,6 +138,29 @@
initialise();
}
+ /**
+ * Find the best/first matching binding for the specified method.
+ *
+ * @param bindings sorted bindings
+ * @param refMethod
+ * @return the binding or null
+ */
+ private static InterceptorBindingMetaData findBestMatch(List<InterceptorBindingMetaData> bindings, DeclaredMethodSignature refMethod)
+ {
+ for (InterceptorBindingMetaData binding : bindings)
+ {
+ NamedMethodMetaData method = binding.getMethod();
+
+ // TODO: this is weird, it should have been caught earlier (invalid xml)
+ if(method.getMethodName() == null)
+ continue;
+
+ if(matches(refMethod, method))
+ return binding;
+ }
+ return null;
+ }
+
protected Class<?> getBeanClass()
{
return beanClass;
@@ -397,19 +446,15 @@
{
if (bindings != null && bindings.size() > 0)
{
+ Collections.sort(bindings, mostSpecificFirst);
+
this.methodInterceptorOrders = new HashMap<DeclaredMethodSignature, InterceptorOrderImpl>();
- for (InterceptorBindingMetaData binding : bindings)
+ for(DeclaredMethodSignature refMethod : methods)
{
- NamedMethodMetaData method = binding.getMethod();
-
- // TODO: this is weird, it should have been caught earlier (invalid xml)
- if(method.getMethodName() == null)
- continue;
-
- for (DeclaredMethodSignature refMethod : methods)
+ // find the best matching interceptor-order
+ InterceptorBindingMetaData binding = findBestMatch(bindings, refMethod);
+ if(binding != null)
{
- if(!matches(refMethod, method))
- continue;
InterceptorOrderImpl interceptors = methodInterceptorOrders.get(refMethod);
if (interceptors == null)
{
@@ -418,7 +463,7 @@
}
add(interceptors, classLoader, binding);
}
- }
+ }
}
}
@@ -500,13 +545,7 @@
if(!signature.getName().equals(method.getMethodName()))
return false;
if(method.getMethodParams() == null)
- {
- if(signature.getParameters() == null || signature.getParameters().length == 0)
- return true;
- else
- return false;
-
- }
+ return true;
return Arrays.equals(signature.getParameters(), method.getMethodParams().toArray());
}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonAnnotatedInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonAnnotatedInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/common/CommonAnnotatedInterceptor.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,58 @@
+/*
+ * 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.ejb3.test.interceptors.common;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * A common interceptor with annotations. Registers the invocations in
+ * the InterceptorChain.
+ *
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CommonAnnotatedInterceptor extends CommonInterceptor
+{
+ @Override
+ @AroundInvoke
+ public Object aroundInvoke(InvocationContext ctx) throws Exception
+ {
+ return super.aroundInvoke(ctx);
+ }
+
+ @Override
+ @PostConstruct
+ public void postConstruct(InvocationContext ctx) throws Exception
+ {
+ super.postConstruct(ctx);
+ }
+
+ @Override
+ @PreDestroy
+ public void preDestroy(InvocationContext ctx) throws Exception
+ {
+ super.preDestroy(ctx);
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedClassInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedClassInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedClassInterceptor.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,33 @@
+/*
+ * 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.ejb3.test.interceptors.ejbthree1555;
+
+import org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class AnnotatedClassInterceptor extends CommonAnnotatedInterceptor
+{
+
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedMethodInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedMethodInterceptor.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/AnnotatedMethodInterceptor.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,32 @@
+/*
+ * 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.ejb3.test.interceptors.ejbthree1555;
+
+import org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class AnnotatedMethodInterceptor extends CommonAnnotatedInterceptor
+{
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/OrderedSLSB.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/OrderedSLSB.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/OrderedSLSB.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,54 @@
+/*
+ * 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.ejb3.test.interceptors.ejbthree1555;
+
+import javax.ejb.Stateless;
+import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.ExcludeDefaultInterceptors;
+import javax.interceptor.Interceptors;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Interceptors(AnnotatedClassInterceptor.class)
+public class OrderedSLSB
+{
+ public void methodWithOwn()
+ {
+
+ }
+
+ @ExcludeClassInterceptors
+ @ExcludeDefaultInterceptors
+ @Interceptors(AnnotatedMethodInterceptor.class)
+ public void methodWithOwn(String s, Integer i)
+ {
+
+ }
+
+ public void methodWithParameter(String s)
+ {
+
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/unit/CorrectOrderTestCase.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/unit/CorrectOrderTestCase.java (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/ejbthree1555/unit/CorrectOrderTestCase.java 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,201 @@
+/*
+ * 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.ejb3.test.interceptors.ejbthree1555.unit;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+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.BeanInterceptorMetaDataBridge;
+import org.jboss.ejb3.interceptors.metadata.InterceptorComponentMetaDataLoaderFactory;
+import org.jboss.ejb3.interceptors.metadata.InterceptorMetaDataBridge;
+import org.jboss.ejb3.metadata.MetaDataBridge;
+import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor;
+import org.jboss.ejb3.test.interceptors.common.CommonInterceptor;
+import org.jboss.ejb3.test.interceptors.common.InterceptorChain;
+import org.jboss.ejb3.test.interceptors.ejbthree1555.AnnotatedClassInterceptor;
+import org.jboss.ejb3.test.interceptors.ejbthree1555.AnnotatedMethodInterceptor;
+import org.jboss.ejb3.test.interceptors.ejbthree1555.OrderedSLSB;
+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.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;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class CorrectOrderTestCase extends TestCase
+{
+ private static final Logger log = Logger.getLogger(CorrectOrderTestCase.class);
+
+ private MyContainer<OrderedSLSB> container;
+ private BeanContext<OrderedSLSB> bean;
+
+ 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 BeanInterceptorMetaDataBridge(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());
+ CommonInterceptor.aroundInvokes = 0;
+ CommonInterceptor.postConstructs = 0;
+ CommonInterceptor.preDestroys = 0;
+
+ AspectManager.verbose = true;
+
+ // To make surefire happy
+ Thread.currentThread().setContextClassLoader(OrderedSLSB.class.getClassLoader());
+
+ // Bootstrap metadata
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+ URL url = Thread.currentThread().getContextClassLoader().getResource("ejbthree1555/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("OrderedSLSB");
+ assertNotNull(beanMetaData);
+
+ assertEquals(0, CommonInterceptor.postConstructs);
+
+ container = new MyContainer<OrderedSLSB>("OrderedSLSB", "Test", OrderedSLSB.class, beanMetaData);
+ container.testAdvisor();
+
+ bean = container.construct();
+
+ {
+ Class<?> c[] = { CommonAnnotatedInterceptor.class, AnnotatedClassInterceptor.class };
+ List<Class<?>> expected = Arrays.asList(c);
+ assertEquals(expected, InterceptorChain.getChain());
+
+ InterceptorChain.clear();
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ container.destroy(bean);
+ InterceptorChain.clear();
+ bean = null;
+ container = null;
+ log.info(deployer.undeploy());
+ }
+
+ public void testMostSpecificBinding() throws Throwable
+ {
+ container.invoke(bean, "methodWithOwn", "Hello world", 1);
+
+ {
+ Class<?> c[] = { AnnotatedMethodInterceptor.class };
+ List<Class<?>> expected = Arrays.asList(c);
+ assertEquals(expected, InterceptorChain.getChain());
+
+ InterceptorChain.clear();
+ }
+
+ container.invoke(bean, "methodWithOwn");
+ {
+ Class<?> c[] = { AnnotatedClassInterceptor.class, CommonAnnotatedInterceptor.class };
+ List<Class<?>> expected = Arrays.asList(c);
+ assertEquals(expected, InterceptorChain.getChain());
+
+ InterceptorChain.clear();
+ }
+ }
+
+ public void testOptionalParameters() throws Throwable
+ {
+ container.invoke(bean, "methodWithParameter", "Hello world");
+
+ Class<?> c[] = { AnnotatedClassInterceptor.class, CommonAnnotatedInterceptor.class };
+ List<Class<?>> expected = Arrays.asList(c);
+ assertEquals(expected, InterceptorChain.getChain());
+ }
+}
Added: projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/META-INF/ejb-jar.xml (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/resources/ejbthree1555/META-INF/ejb-jar.xml 2008-10-29 14:37:33 UTC (rev 80195)
@@ -0,0 +1,53 @@
+<?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>EJBTHREE-1555</display-name>
+ <!-- We don't merge annotation with metadata, so defining bean here also -->
+ <enterprise-beans>
+ <session>
+ <ejb-name>OrderedSLSB</ejb-name>
+ </session>
+ </enterprise-beans>
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>*</ejb-name>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor</interceptor-class>
+ </interceptor-binding>
+ <interceptor-binding>
+ <ejb-name>OrderedSLSB</ejb-name>
+ <interceptor-order>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.ejbthree1555.AnnotatedClassInterceptor</interceptor-class>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor</interceptor-class>
+ </interceptor-order>
+ <method>
+ <method-name>methodWithOwn</method-name>
+ </method>
+ </interceptor-binding>
+ <interceptor-binding>
+ <ejb-name>OrderedSLSB</ejb-name>
+ <interceptor-order>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.ejbthree1555.AnnotatedMethodInterceptor</interceptor-class>
+ </interceptor-order>
+ <method>
+ <method-name>methodWithOwn</method-name>
+ <method-params>
+ <method-param>java.lang.String</method-param>
+ <method-param>java.lang.Integer</method-param>
+ </method-params>
+ </method>
+ </interceptor-binding>
+ <interceptor-binding>
+ <ejb-name>OrderedSLSB</ejb-name>
+ <interceptor-order>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.ejbthree1555.AnnotatedClassInterceptor</interceptor-class>
+ <interceptor-class>org.jboss.ejb3.test.interceptors.common.CommonAnnotatedInterceptor</interceptor-class>
+ </interceptor-order>
+ <method>
+ <method-name>methodWithParameter</method-name>
+ </method>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list