[jboss-cvs] JBossAS SVN: r59151 - in trunk/ejb3: . src/main/org/jboss/ejb3 src/main/org/jboss/ejb3/interceptor src/main/org/jboss/ejb3/metamodel src/resources/test src/resources/test/interceptors3 src/resources/test/interceptors3/META-INF src/test/org/jboss/ejb3/test src/test/org/jboss/ejb3/test/interceptors3 src/test/org/jboss/ejb3/test/interceptors3/unit
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 19 11:19:35 EST 2006
Author: wolfc
Date: 2006-12-19 11:19:17 -0500 (Tue, 19 Dec 2006)
New Revision: 59151
Added:
trunk/ejb3/src/resources/test/interceptors3/
trunk/ejb3/src/resources/test/interceptors3/META-INF/
trunk/ejb3/src/resources/test/interceptors3/META-INF/ejb-jar.xml
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyBean.java
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyInterceptor.java
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyRemoteIF.java
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/unit/
trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/unit/InterceptorsTestCase.java
Modified:
trunk/ejb3/build-test.xml
trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
trunk/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java
trunk/ejb3/src/main/org/jboss/ejb3/metamodel/InterceptorBinding.java
Log:
fix TCK ejb30/assembly
Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/build-test.xml 2006-12-19 16:19:17 UTC (rev 59151)
@@ -930,6 +930,29 @@
</target>
+ <target name="interceptors3"
+ description="Builds all jar files."
+ depends="compile-classes">
+
+ <mkdir dir="${build.lib}"/>
+
+ <jar jarfile="${build.lib}/interceptors3-test.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/ejb3/test/interceptors3/*.class"/>
+ </fileset>
+ <fileset dir="${resources}/test/interceptors3">
+ <include name="META-INF/ejb-jar.xml"/>
+ <include name="META-INF/jboss.xml"/>
+ </fileset>
+ </jar>
+ <copy todir="${build.lib}">
+ <fileset dir="${resources}/test/interceptors3">
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+
+ </target>
+
<target name="clientinterceptor"
description="Builds all jar files."
depends="compile-classes">
@@ -1800,6 +1823,13 @@
<include name="org/jboss/ejb3/test/wolfc/*.class"/>
</fileset>
</jar>
+
+ <ear destfile="${build.lib}/wolfc.ear" appxml="${build.resources}/test/wolfc/application.xml">
+ <zipfileset prefix="META-INF" dir="${build.resources}/test/wolfc">
+ <include name="jboss-app.xml"/>
+ </zipfileset>
+ <fileset dir="${build.lib}" includes="wolfc.jar"/>
+ </ear>
</target>
<target name="scopedclassloader"
@@ -2828,7 +2858,7 @@
entityexception, asynchronous, consumer, clusteredentity, secondary, stateful, service, lob, cache, initial,
timer, benchmark, entity, joininheritance, singletable, tableperclass, dependent, mdb, manytomany, regression,
composite, composite2, entitycallback, relationships, ssl, ssladvanced, clusteredsession, strictpool, jacc,
- localcall, interceptors, interceptors2, iiop, clientinterceptor"/>
+ localcall, interceptors, interceptors2, interceptors3, iiop, clientinterceptor"/>
<target name="test" depends="init" if="test"
description="Execute all tests in the given test directory.">
@@ -3397,6 +3427,9 @@
<param name="test" value="interceptors2"/>
</antcall>
<antcall target="test" inheritRefs="true">
+ <param name="test" value="interceptors3"/>
+ </antcall>
+ <antcall target="test" inheritRefs="true">
<param name="test" value="interceptors"/>
</antcall>
<antcall target="test" inheritRefs="true">
Modified: trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Ejb3DescriptorHandler.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -894,10 +894,13 @@
.getInterceptorBindings();
for (InterceptorBinding binding : interceptorBindings)
{
+ // Wolf: why ignore ordered binding?
+ /*
if (binding.isOrdered())
{
continue;
}
+ */
if (binding.getEjbName().equals(ejbName))
{
if (binding.getMethodName() == null
Modified: trunk/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/main/org/jboss/ejb3/interceptor/InterceptorInfoRepository.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -846,7 +846,7 @@
boolean initialised;
List<InterceptorBinding> orderedBindings;
- void initialise()
+ private void initialise()
{
if (!initialised)
{
@@ -859,7 +859,7 @@
if (binding.isOrdered())
{
//Validate each interceptor only occurs once
- HashSet names = new HashSet();
+ HashSet<String> names = new HashSet<String>();
for (Iterator it = binding.getInterceptorClasses().iterator() ; it.hasNext() ; )
{
String className = (String)it.next();
@@ -880,6 +880,7 @@
}
}
}
+ log.trace("orderedBindings = " + orderedBindings);
initialised = true;
}
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/metamodel/InterceptorBinding.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/metamodel/InterceptorBinding.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/main/org/jboss/ejb3/metamodel/InterceptorBinding.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -91,6 +91,14 @@
return ordered;
}
-
-
+ public String toString()
+ {
+ return InterceptorBinding.class.getName() + "[ejbName=" + getEjbName() +
+ ",methodName=" + getMethodName() +
+ ",ordered=" + isOrdered() +
+ ",excludeClassInterceptors=" + excludeClassInterceptors +
+ ",excludeDefaultInterceptors=" + excludeDefaultInterceptors +
+ ",interceptorClasses=" + interceptorClasses +
+ "]";
+ }
}
Added: trunk/ejb3/src/resources/test/interceptors3/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/interceptors3/META-INF/ejb-jar.xml 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/resources/test/interceptors3/META-INF/ejb-jar.xml 2006-12-19 16:19:17 UTC (rev 59151)
@@ -0,0 +1,42 @@
+<?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" version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
+ <enterprise-beans>
+ <session>
+ <ejb-name>AssemblyBean</ejb-name>
+ <!--business-local>com.sun.ts.tests.ejb30.assembly.common.AssemblyLocalIF</business-local-->
+ <business-remote>org.jboss.ejb3.test.interceptors3.AssemblyRemoteIF</business-remote>
+ <ejb-class>org.jboss.ejb3.test.interceptors3.AssemblyBean</ejb-class>
+ <session-type>Stateless</session-type>
+ <transaction-type>Container</transaction-type>
+ <security-identity>
+ <use-caller-identity/>
+ </security-identity>
+ </session>
+ </enterprise-beans>
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.ejb3.test.interceptors3.AssemblyInterceptor</interceptor-class>
+ <!-- already annotated in class
+ <around-invoke>
+ <method-name>intercept</method-name>
+ </around-invoke>
+ <post-construct>
+ <lifecycle-callback-method>myCreate</lifecycle-callback-method>
+ </post-construct>
+ <pre-destroy>
+ <lifecycle-callback-method>myRemove</lifecycle-callback-method>
+ </pre-destroy>
+ -->
+ </interceptor>
+ </interceptors>
+
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>AssemblyBean</ejb-name>
+ <interceptor-order>
+ <interceptor-class>org.jboss.ejb3.test.interceptors3.AssemblyInterceptor</interceptor-class>
+ </interceptor-order>
+ </interceptor-binding>
+ </assembly-descriptor>
+
+</ejb-jar>
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyBean.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyBean.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejb3.test.interceptors3;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+//@Interceptors({AssemblyInterceptor.class}) // this works, xml doesn't
+public class AssemblyBean implements AssemblyRemoteIF
+{
+ public int remoteAdd(int a, int b)
+ {
+ return a + b;
+ }
+
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyInterceptor.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyInterceptor.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyInterceptor.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejb3.test.interceptors3;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class AssemblyInterceptor
+{
+ @AroundInvoke
+ protected Object intercept(InvocationContext inv) throws Exception
+ {
+ Object params[] = inv.getParameters();
+ Object newParams[] = { (Integer) params[0] + 100, (Integer) params[1] + 100 };
+ inv.setParameters(newParams);
+ return inv.proceed();
+ }
+}
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyRemoteIF.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyRemoteIF.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyRemoteIF.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejb3.test.interceptors3;
+
+import javax.ejb.Remote;
+
+ at Remote
+public interface AssemblyRemoteIF
+{
+ int remoteAdd(int a, int b);
+}
Property changes on: trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/AssemblyRemoteIF.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/unit/InterceptorsTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/unit/InterceptorsTestCase.java 2006-12-19 15:32:09 UTC (rev 59150)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/interceptors3/unit/InterceptorsTestCase.java 2006-12-19 16:19:17 UTC (rev 59151)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.ejb3.test.interceptors3.unit;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.interceptors3.AssemblyRemoteIF;
+import org.jboss.test.JBossTestCase;
+
+/**
+ * From TCK: ejb30/assembly/librarydirectory/defaultname
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class InterceptorsTestCase extends JBossTestCase
+{
+ public InterceptorsTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testIntercept() throws Exception
+ {
+ AssemblyRemoteIF bean = (AssemblyRemoteIF) getInitialContext().lookup("AssemblyBean/remote");
+ int actual = bean.remoteAdd(1, 2);
+ assertEquals(203, actual);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(InterceptorsTestCase.class, "interceptors3-test.jar");
+ }
+}
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list