[jboss-cvs] JBossAS SVN: r109555 - in projects/ejb3/trunk/core: src/main/java/org/jboss/ejb3 and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 30 06:51:25 EST 2010


Author: wolfc
Date: 2010-11-30 06:51:23 -0500 (Tue, 30 Nov 2010)
New Revision: 109555

Added:
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedLocal.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckingContextDataInterceptor.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/unit/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/unit/ContextDataTestCase.java
Modified:
   projects/ejb3/trunk/core/pom.xml
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java
Log:
EJBTHREE-2203: delegate getContextData to ejb3-context


Modified: projects/ejb3/trunk/core/pom.xml
===================================================================
--- projects/ejb3/trunk/core/pom.xml	2010-11-30 11:50:49 UTC (rev 109554)
+++ projects/ejb3/trunk/core/pom.xml	2010-11-30 11:51:23 UTC (rev 109555)
@@ -423,7 +423,7 @@
     <dependency>
       <groupId>org.jboss.ejb3</groupId>
       <artifactId>jboss-ejb3-interceptors</artifactId>
-      <version>1.1.0</version>
+      <version>1.1.1-SNAPSHOT</version>
     </dependency>
 
     <dependency>

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java	2010-11-30 11:50:49 UTC (rev 109554)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBContextImpl.java	2010-11-30 11:51:23 UTC (rev 109555)
@@ -24,6 +24,7 @@
 import org.jboss.aop.joinpoint.Invocation;
 import org.jboss.aspects.currentinvocation.CurrentInvocation;
 import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.context.CurrentInvocationContext;
 import org.jboss.ejb3.context.spi.BeanManager;
 import org.jboss.ejb3.context.spi.EJBContext;
 import org.jboss.ejb3.interceptors.container.InvocationHelper;
@@ -170,8 +171,7 @@
 
    public Map<String, Object> getContextData()
    {
-      // TODO: implement
-      throw new UnsupportedOperationException("Not yet implemented");
+      return CurrentInvocationContext.get().getContextData();
    }
 
    public BeanManager getManager()

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedBean.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedBean.java	2010-11-30 11:51:23 UTC (rev 109555)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.core.test.ejbthree2203;
+
+import org.jboss.ejb3.context.spi.SessionContext;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+ at Stateless
+ at Interceptors(MuckingContextDataInterceptor.class)
+public class MuckedBean implements MuckedLocal
+{
+   @Resource
+   private SessionContext ctx;
+
+   private String fromInterceptor;
+
+   public String getMuck()
+   {
+      return fromInterceptor + ctx.getContextData().get("aroundInvoke");
+   }
+
+   @PostConstruct
+   public void postConstruct()
+   {
+      fromInterceptor = (String) ctx.getContextData().get("postConstruct");
+   }
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedLocal.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedLocal.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckedLocal.java	2010-11-30 11:51:23 UTC (rev 109555)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.core.test.ejbthree2203;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public interface MuckedLocal
+{
+   String getMuck();
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckingContextDataInterceptor.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckingContextDataInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/MuckingContextDataInterceptor.java	2010-11-30 11:51:23 UTC (rev 109555)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.core.test.ejbthree2203;
+
+import javax.annotation.PostConstruct;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class MuckingContextDataInterceptor
+{
+   @AroundInvoke
+   public Object aroundInvoke(InvocationContext ctx) throws Exception
+   {
+      ctx.getContextData().put("aroundInvoke", "mucked-aroundInvoke");
+      return ctx.proceed();
+   }
+
+   @PostConstruct
+   public void postConstruct(InvocationContext ctx) throws Exception
+   {
+      ctx.getContextData().put("postConstruct", "mucked-postConstruct");
+      ctx.proceed();
+   }
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/unit/ContextDataTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/unit/ContextDataTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/ejbthree2203/unit/ContextDataTestCase.java	2010-11-30 11:51:23 UTC (rev 109555)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright (c) 2010, JBoss Inc., 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.core.test.ejbthree2203.unit;
+
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.ejbthree2203.MuckedBean;
+import org.jboss.ejb3.core.test.ejbthree2203.MuckedLocal;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ */
+public class ContextDataTestCase extends AbstractEJB3TestCase
+{
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractEJB3TestCase.beforeClass();
+
+      deploySessionEjb(MuckedBean.class);
+   }
+
+   @Test
+   public void test1() throws Exception
+   {
+      MuckedLocal bean = lookup("MuckedBean/local", MuckedLocal.class);
+
+      String result = bean.getMuck();
+      System.err.println(result);
+   }
+}



More information about the jboss-cvs-commits mailing list