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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Sep 26 12:01:04 EDT 2008


Author: wolfc
Date: 2008-09-26 12:01:03 -0400 (Fri, 26 Sep 2008)
New Revision: 78899

Added:
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceBean.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceRemote.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/unit/
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/unit/ServiceContainerTestCase.java
Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
   projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/AbstractEJB3TestCase.java
Log:
EJBTHREE-1505: service container invocation working

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-09-26 15:40:23 UTC (rev 78898)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/service/ServiceContainer.java	2008-09-26 16:01:03 UTC (rev 78899)
@@ -50,7 +50,6 @@
 import org.jboss.aop.util.PayloadKey;
 import org.jboss.aspects.asynch.FutureHolder;
 import org.jboss.ejb3.BeanContext;
-import org.jboss.ejb3.EJBContainerInvocation;
 import org.jboss.ejb3.Ejb3Deployment;
 import org.jboss.ejb3.annotation.LocalBinding;
 import org.jboss.ejb3.annotation.Management;
@@ -488,7 +487,6 @@
    @Override
    protected StatefulContainerInvocation populateInvocation(StatefulContainerInvocation invocation)
    {
-      invocation.setTargetObject(singleton);
       invocation.setBeanContext(beanContext);
       return invocation;
    }

Modified: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/AbstractEJB3TestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/AbstractEJB3TestCase.java	2008-09-26 15:40:23 UTC (rev 78898)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/common/AbstractEJB3TestCase.java	2008-09-26 16:01:03 UTC (rev 78899)
@@ -40,6 +40,7 @@
 import org.jboss.ejb3.common.registrar.spi.DuplicateBindException;
 import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
 import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.service.ServiceContainer;
 import org.jboss.ejb3.session.SessionContainer;
 import org.jboss.ejb3.stateful.StatefulContainer;
 import org.jboss.ejb3.stateless.StatelessContainer;
@@ -47,6 +48,7 @@
 import org.jboss.ejb3.test.common.MetaDataHelper;
 import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
 import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossServiceBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -76,7 +78,7 @@
     * Types of Containers Supported
     */
    enum ContainerType{
-      SFSB,SLSB
+      SFSB,SLSB,SERVICE
    }
 
    @AfterClass
@@ -185,6 +187,8 @@
       {
          sessionType = ContainerType.SFSB;
       }
+      else if(beanMetaData.isService())
+         sessionType = ContainerType.SERVICE;
 
       // Ensure jndi.properties is accessible
       log.info("Found: " + cl.getResource("jndi.properties"));
@@ -247,6 +251,17 @@
        */
       switch (type)
       {
+         case SERVICE:
+            try
+            {
+               domain = getDomain("Service Bean");
+               container = new ServiceContainer(null, loader, beanClassName, ejbName, domain, ctxProperties, deployment, (JBossServiceBeanMetaData) md);
+            }
+            catch (ClassNotFoundException cnfe)
+            {
+               throw new RuntimeException("Could not create SLSB Container for " + beanClassName, cnfe);
+            }
+            break;
          case SFSB :
             try
             {

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceBean.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceBean.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceBean.java	2008-09-26 16:01:03 UTC (rev 78899)
@@ -0,0 +1,47 @@
+/*
+ * 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.core.test.service;
+
+import javax.ejb.Remote;
+
+import org.jboss.ejb3.annotation.Service;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Service
+ at Remote(ServiceRemote.class)
+public class ServiceBean implements ServiceRemote
+{
+   private int id = -1;
+
+   public int getId()
+   {
+      return id;
+   }
+
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceRemote.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceRemote.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/ServiceRemote.java	2008-09-26 16:01:03 UTC (rev 78899)
@@ -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.core.test.service;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ServiceRemote
+{
+   int getId();
+   
+   void setId(int id);
+}

Added: projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/unit/ServiceContainerTestCase.java
===================================================================
--- projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/unit/ServiceContainerTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/core/src/test/java/org/jboss/ejb3/core/test/service/unit/ServiceContainerTestCase.java	2008-09-26 16:01:03 UTC (rev 78899)
@@ -0,0 +1,76 @@
+/*
+ * 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.core.test.service.unit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ejb3.core.test.common.AbstractEJB3TestCase;
+import org.jboss.ejb3.core.test.service.ServiceBean;
+import org.jboss.ejb3.core.test.service.ServiceRemote;
+import org.jboss.ejb3.session.SessionContainer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ServiceContainerTestCase extends AbstractEJB3TestCase
+{
+   private static List<SessionContainer> containers = new ArrayList<SessionContainer>();
+   
+   @AfterClass
+   public static void afterClass() throws Exception
+   {
+      for(SessionContainer container : containers)
+         undeployEjb(container);
+      containers.clear();
+      
+      AbstractEJB3TestCase.afterClass();
+   }
+   
+   @BeforeClass
+   public static void beforeClass() throws Exception
+   {
+      AbstractEJB3TestCase.beforeClass();
+      
+      containers.add(deploySessionEjb(ServiceBean.class));
+   }
+   
+   @Test
+   public void test1() throws Exception
+   {
+      ServiceRemote bean = lookup("ServiceBean/remote", ServiceRemote.class);
+      
+      assertEquals(-1, bean.getId());
+      
+      bean.setId(1);
+      
+      assertEquals(1, bean.getId());
+   }
+}




More information about the jboss-cvs-commits mailing list